What is the best way to download all of the WSDL files exposed by a WCF service?

Thomas Bratt picture Thomas Bratt · Nov 13, 2008 · Viewed 34.4k times · Source

What is the best way to download all of the WSDL files exposed by a WCF service?

For example, the root WSDL file references the following other WSDL files:

<xsd:import schemaLocation="http://localhost:80/?xsd=xsd0" namespace="http://tempuri.com"/>
<xsd:import schemaLocation="http://localhost:80/?xsd=xsd1" namespace="http://tempuri.com"/>

Ideally it would be possible to automate the download so that every time the WSDL changes it would be easy to distribute the files to a customer or incorporate into a document/SDK.

Answer

Bernard Vander Beken picture Bernard Vander Beken · Dec 23, 2009

Meanwhile, disco.exe is considered obsolete technology by Microsoft.

You can use svcutil.exe /t:metadata to achieve the same in the WCF age. Additional benefits are support for additional features, eg WS-Policy.

Save schema from URL:

svcutil /t:metadata http://host/pathtomy.svc?wsdl

Save schema from assembly, eg in automated build:

svcutil /t:metadata c:\wcfweb\pathToWcfServiceAssembly.dll