<a href="http://www.micropoll.com/akira/mpview/585320-168921">Click Here for Poll</a><a href="http://www.questionpro.com" title="online surveys">Online Survey</a><BR> | <a href="http://www.micropoll.com" title="Website Polls">Website Polls</a><BR> | <BR><a href="http://www.micropoll.com/akira/MicroPoll?mode=html&id=168921">View MicroPoll</A></div>

Visual Studio 2010!

Read now >

Windows Mobile Development Thoughts

Read now >

View Now
DevSource RSS FEEDS
XML Want an easy way to keep up with breaking tech news? And the Get DevSource headlines delivered to your desktop with RSS.
ADVERTISEMENT
ADVERTISEMENT

 

DevSource.com: Your Source for Visual Studio on Facebook
ADVERTISEMENT
Using WSE 3.0 Today to Secure Web Services for Tomorrow
By Julia Lerman

Rate This Article: Add This Article To:

Using WSE 3.0 Today to Secure Web Services for Tomorrow - ' BP Conformance '
( Page 2 of 4 )

Basic Profile, or "BP", Conformance

The Basic Profile is defined by WS-I, the Web Services Interoperability Organization.

It is a guideline for building consistent web services that can be consumed across technology platforms. WCF conforms to Basic Profile 1.1.

Therefore, by ensuring that your web services also conform to the Basic Profile 1.1 guidelines, you can be confident that WCF clients will be able to communicate with them.

In Visual Studio 2005, the Web Service template makes services BP 1.1 compliant by default using the WebServiceBinding attribute to decorate the service.


<WebService(Namespace:="http://services.thedatafarm.com") > _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _ 
Public Class MyService
End Class

This attribute's purpose is to help ensure that the service you are writing conforms to whichever profile you tell it. Since there are a lot of rules to remember, the test for conformance is done by .NET for you.

So if you break one of the rules, the web service will return a big fat, yet very informative, error when you try to call it. For example, you could overload your web method; it's something .NET allows you to do (using the MessageName parameter) but is a big no-no for proper web services.

Here is an example:

<WebService(Namespace:="http://services.thedatafarm.com/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1)> _
Public Class Service
     Inherits System.Web.Services.WebService
  <WebMethod(MessageName:="PlainMessage")> _
    Public Function HelloWorld() As String
    Return "Hello World"
  End Function
  <WebMethod(MessageName:="MessagewithName")> _
    Public Function HelloWorld(ByVal myname As String) As String
    Return "Hello World"
  End Function
End Class

Here is the error which very explicitly explains that the web service does not follow BP 1.1 conformance and why.

Even if you do not know all of the rules of BasicProfile 1.1 — and there are a lot of them! — using the binding attribute protects you from accidentally breaking that rule.

There is an additional binding parameter that you can use, though it is not required: EmitConformanceClaims. It looks like this in your web service's binding attribute:

<WebService(Namespace:="http://services.thedatafarm.com/")> _
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicProfile1_1, 
   EmitConformanceClaims:=True)> 

This puts a flag into the WSDL for your service that says, "Hey! This message conforms to [whichever standard you are conforming to]". This is an additional help to clients of your web service. To see this, browse to your web service, then type ?wsdl at the end of the url (e.g. http://localhost/testWebService/Service.asmx?wsdl).

Here you see the description of your web service. If you search for the section wsdl: binding name = ServiceSoap", you see the claim that was inserted just below.



 
 
>>> More Using Microsoft Visual Studio Articles          >>> More By Julia Lerman