Archive

Posts Tagged ‘wsdl’

WCF Multipart WSDL Download

March 30th, 2009 raymondr No comments

In the old days of ASMX webservices it was very easy to distribute the wsdl file of your service to other people, for example if you develop a service that’s not available to that person yet. The only thing you had to do was browse to http://myserver/mywebservice.asmx?wsdl and save the result of it. But nowadays the wsdl provided by your wcf service contains multiple files, the wsdl files uses import elements to include these file in the wsdl.

If you use svcutil.exe, wsdl.exe or some other tool to create a webservice client and reference a webservice directly this doesn’t matter. But this week I had to distribute my wsdl file and my service isn’t published yet. The only option was to download the wsdl file and each included file by hand.

After some searching for a neat solution I found a blog post by Mike Hadlow for downloading a wsdl and all included files to local disc. His solution makes use of the DiscoveryClientProtocol class in the .Net framework. This piece of code downloads all files but leaves the references of the xsd files pointing to the original url of the service. But this was also easy to solve. The WriteAll method of the DiscoveryClientProtocol class also creates a information file with the original location and the new filename. The only thing that has to be done is to replace the original urls with their local values.

Wsdl Download Executable
Wsdl Download source code

Categories: .Net, Dev Tags: , ,