The WSDL Tool

The WSDL tool is a handy tool to generate a proxy class to consume a web service.  There is plenty of information out there about it, so I will not go into detail.  I will provide some links though.  One bit of advice is to add a new Environment Variable to your machine.  Here is an example, I named mine Path.

Variable name: Path

Variable value: %PATH%;C:\Program Files\Microsoft SDKs\Windows\v7.0A\bin

You may need to verify that path on your actual machine, it should be the location of wsdl.exe.

Web Services Description Language Tool on MSDN.

This is an update, I thought I should include some examples of how to use the tool just in case you do not want to read everything over at MSDN.  Please keep in mind that normally you would use this for web service that are not on the Microsoft stack, like say one created using Java or something.  For ones that are Microsoft friendly you can add those service references.

There are some basic steps to use this tool and generate the proxy class:

  • ObtaintheWSDL URL
    • If the service URL is different from the WSDL URL you will need that too
  • Use the tool to generate your proxy class
  • Import the proxy class to your project
  • Edit the newly imported proxy class to use the proper URL for the service.  As a short cut you can search the class for “this.URL”

Assume I have a folder on my C drive I call GeneratedProxies, and this is where I want my generated proxy classes to be created.  For this example lets say I want to use the GlobalWeather Service from  To generate that I would use the WSDL tool in a command prompt, so all of this would be on one line.  I apologize for any formatting issues in this post.

wsdl /out:C:\GeneratedProxies\GlobalWeatherProxy.cs

Once that completes I should have a file called GlobalWeatherProxy.cs in my GeneratedProxies folder.  If the service you are using requires a username and password you just add those to your line that generates the proxy.

/username:MyUserName /password:MyPassword

Not too bad is it?  For more detail I still recommend the MSDN article.

About SheldonS

Web developer for over 15 years mainly with Microsoft technologies from classic ASP to .NET 4. Husband, father, and aspiring amateur photographer.

Posted on August 12, 2013, in .NET and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: