Technology blog written by a Microsoft C# MVP

Posts Tagged MetaDataExchange

One of the semi-hidden features of WCF found both as a consumer and a producer of webservices is the industry standard Web Services Description Language (WSDL) which can be consumed and exposed by the tools and code of a .Net web service. This article talks about the Tribal Knowledge that optionally allows one to expose a WSDL as a publisher and can consume a foreign WSDL to be used by code by a generated proxy. To access a wsdl simply ad a ?wsdl to the address and see if it comes back as xml such as http://localhost:8000/Omega?wsdl.

Expose a WSDL using MetaDataExchange (MEX)

The ability to expose a WSDL is not a default when creating a webservice. One has two options to expose the WSDL. The first is programmatically in code such as this when creating the service host

Consume a WSDL to create a Proxy

If a foreign webservice has exposed a WSDL, one can consume that webservice methods by a generated proxy. Again there are two ways to generate that proxy. Both actually use the same tool. That tool is Svcutil.exe which does its magic on the command line or one can browse for it in VS2008 by using the Add Service Reference command. That command simply encapsulates the SVCUtil.exe to generate a proxy class from the exposed wsdl. To see more on SVCUtil.exe see Retrieving Metadata.