views:

1818

answers:

4

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"/&gt;
<xsd:import schemaLocation="http://localhost:80/?xsd=xsd1" namespace="http://tempuri.com"/&gt;

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.

+2  A: 

It looks like Microsoft provide Disco.exe for doing this.

Thomas Bratt
+4  A: 

If you own the service, another interesting option you could explore is using Christian Weyer's FlatWSDL behavior, which will force WCF to generate everything in a single WSDL document, which should make it a lot easier for you to distribute it.

tomasr
+4  A: 

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

Bernard Vander Beken
+1  A: 

There is a simple code snippet that makes it possible downloading a wsdl and all the belonging xsd files for offline use (for example for code generation). It is available here.

Balazs Zsoldos
+1 for Java solution.
Thomas Bratt