Creating a Proxy class for a WebService in .NET

The easiest way to create a WebService Client in .NET is right clicking in the Project you want the reference and chosing Add a Service Reference.

Although that is quite easy and simple, there are some cases where you might prefer only the proxy class that calls the WebService. For instance, when you don’t want to mess up with the Web.Config file or load the URL from somewhere else other than a config file, i.e. the registry, or when you want to create a DLL to use in another project. For those cases you can open a Visual Studio Command Prompt from the Start Menu and use the command line below:

wsdl /l:CS /protocol:SOAP http://localhost/WebServiceTest/MyWebService.asmx?WSDL

The first parameter tells the wsdl.exe to use the language CS (CSharp) and the second tells that we are going to use the SOAP protocol. The third is the URL of the WebService – it can be a file path as well.

There are more parameters you can pass in besides those used in here. You can add /? to see those other parameters.

Any comments or opinions about this post will be welcome.


One thought on “Creating a Proxy class for a WebService in .NET

  1. Hi,

    Today web service are used widely in web application. Provided information by you, are very informative. Thanks for sharing your knowledge. There are few other

    article/blog (related to web service) that also useful for developers.

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