header image

A2Z WCF Hands On Lab (HOL) – Tutorial/Lab # 01 (a) – Metadata Exchange – WSDL

Posted by: | January 5, 2009 | No Comment |

The metadata is to describe how to interact with the service’s endpoints. We could generate Proxy class for the Client as well as it updates the .config files[App.config/Web.config] for the Client Application.
For example Svcutil.exe could automatically generated client code for accessing the service..
Trough Visual Studio 2008/2005 with WCF extension, we can “Add Service Reference” which does the entire necessary task for us.

For is purpose it is the following code added to the Service Code.

using System.ServiceModel.Description;

ServiceMetadataBehavior svcMetaBehav = new ServiceMetadataBehavior();
svcMetaBehav.HttpGetEnabled = true;
svcHost.Description.Behaviors.Add(svcMetaBehav);

 

 

The WSDL of this service looks like as following:
  

WSDL of WCF Service

WSDL - WCF

<wsdl:binding name=”BasicHttpBinding_IMyFirstService type=”i0:IMyFirstService>
  <soap:binding transport=”http://schemas.xmlsoap.org/soap/http />
<wsdl:operation name=”MyFirstMethod>
  <soap:operation soapAction=”http://KolkataNET.WCF.HOL/IMyFirstService/MyFirstMethod style=”document />
 <wsdl:input>
  <soap:body use=”literal />
  </wsdl:input>
<wsdl:output>
  <soap:body use=”literal />
  </wsdl:output>
  </wsdl:operation>
  </wsdl:binding>
 
 

 <wsdl:service name=”MyFirstService>
 <wsdl:port name=”BasicHttpBinding_IMyFirstService binding=”tns:BasicHttpBinding_IMyFirstService>
  <soap:address location=”http://abu:8080/WCFKolkataNET/HOL/MyService />
  </wsdl:port>
  </wsdl:service>

 

 

under: Uncategorized