Welcome to MSDN Blogs Sign in | Join | Help

WCF and WSDL

By definition the Web Service Description Language (WSDL) is the XML based document that describes a Web Service. It specifies the location of the service and the operation or methods the service exposes. One of the nice features of both WCF and ASMX services is that you don’t have to understand the inner workings of WSDL. Both of these technologies at run time will automatically generate the WSDL for your service.  However, for those times when changing the WSDL is necessary. For example, exposing different method names or even changing the various elements of how your WSDL is implemented. By default WCF expose the service artifacts based on the named classes and attributes defined in the source files. These artifacts are exposed through the endpoint of the service and typically consumed as WSDL by a client at design time. On the client side, the WSDL is then used to write code that builds the proper message format through which it communicates with the service So, the names you choose for classes, methods and parameters can have an impact beyond the application. With WCF you can control all exposed names from the service within the WSDL by modifying the <ServiceContract> and <OperationContract> and <ServiceBehavior> attributes.

For example if we start with the following base WCF service.

When the service is run it generates the following WSDL

If for example you want to change WSDL Port Type you can use the “name” attribute

When the service is run it changes the generated WSDL Port Type as follows

 

For example we wanted to change exposed operation name in the WSDL we can insert the following attribute

When run this changes the WSDL operation name as follows

 

 

Published Sunday, February 04, 2007 8:53 PM by trobbins
Filed under: ,

Comments

# Link Listing - February 4, 2007

Monday, February 05, 2007 12:14 AM by Christopher Steen

Refactor!T for ASP.NET - Free Download [Via: dhayden ] Prototype 1.5 Documentation in PDF [Via: Dion...

# re: WCF and WSDL

Monday, February 05, 2007 2:00 AM by vikasgoyal77

Thanks for this great tip Thom.

http://DotNetWithMe.blogspot.com

vikas goyal

New Comments to this post are disabled
 
Page view tracker