19

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.

Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139

4 Answers4

34

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
  • 4,848
  • 5
  • 54
  • 76
  • Thanks Bernard. Haven't been doing any WCF for a while - do you have a reference? I'll mark your answer as accepted if you can provide one. – Thomas Bratt Nov 14 '12 at 14:21
  • @ThomasBratt Can you clarify what you mean by reference? – Bernard Vander Beken Nov 20 '12 at 15:49
  • @Bernard he means a link to the MS page that says this is so. – Reg Edit Oct 16 '15 at 07:34
  • Hi Thomas and @RegEdit The disco.exe documentation page at https://msdn.microsoft.com/en-US/library/cy2a3ybs(v=vs.100).aspx for its latest version, Framework 4.0, says: This topic is specific to a legacy technology. XML Web services and XML Web service clients should now be created using Windows Communication Foundation. And svcutil is part of the WCF related tools https://msdn.microsoft.com/en-us/library/aa347733(v=vs.110).aspx Hope this clarifies things. – Bernard Vander Beken Oct 19 '15 at 13:32
6

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
  • 13,683
  • 3
  • 38
  • 30
  • The excellent WCFExtras project on codeplex can also be used to generate a single wsdl file. Dead easy to use, find it here - http://wcfextras.codeplex.com/ – Shuft Nov 03 '11 at 16:16
3

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

Thomas Bratt
  • 48,038
  • 36
  • 121
  • 139
2

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).

Update

The blog where the code snippet was shown is not available anymore. Luckily, Pablo Diez created a small project based on my blog post and uploaded it to github. It is available now here: https://github.com/pablod/xsd-downloader

Balazs Zsoldos
  • 6,036
  • 2
  • 23
  • 31
  • 2
    The link is not outdated - the solution is a good one if you're working in Java. – Jason Feb 02 '11 at 08:39
  • That's not what I meant. I either got a 404 or DNS error when trying the link, so I could never read the solution. Site is obviously back up again, so my comment is not valid anymore... – Per-Frode Pedersen Feb 25 '11 at 11:58
  • Link is dead again. Please would you update your answer when possible to include the relevant information as we're [encouraged to do to avoid this issue](http://stackoverflow.com/help/how-to-answer).. – Reg Edit Oct 16 '15 at 17:35