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.

Advertisements

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.

    http://mindstick.com/Articles/8b01f39d-841d-4ec4-a393-507e692cd080/?Web%20Service%20in%20NET

    http://msdn.microsoft.com/en-us/library/ms972326.aspx

    http://publib.boulder.ibm.com/infocenter/cmx/v8r3m0/index.jsp?topic=%2Fcom.ibm.cmx.doc%2Fcmbapmst231.htm

Leave a Reply

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

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s