There's something out there in life that will delight and amaze you.
Get up, get moving, and go find out what it is. - (Ralph Marston)

Tuesday, June 06, 2006

Creating a proxy class using wsdl.exe tool.

Why do we need to create a proxy class if we can add the web service as a reference? Good question, well… the answer is simple; because we could write web services not only in .NET languages; but others as well. So in any case where we are given only the WSDL document as to work with the web service client here is what we need to do.

We need to create a proxy class in order to create objects from it and expose the methods available. As to do this task, .NET Framework gives the WSDL.EXE tool, you may easily find it if you do a simple search for wsdl.exe in your machine.

Following is the syntax to generate the proxy class.

Go to Visual Studio command prompt.

Wsdl /language:language /protocol:protocol /namespace:myNameSpace
/out:filename /username:username /password:password
/domain:domain url or path

Out of the parameters above the URL is the only mandatory parameter, and others are optional.

This command will create the proxy class in the current directory path you are; in the command prompt. What you need to do is add this created class into the web service client and then start using.
It’s as simple as it is.

There are some few tips we need to remember rather just getting a copy of the proxy class and use. Here is a brief glimpse to it.

When WSDL.EXE creates a proxy class, it converts array lists to object arrays. So there for we got to open the proxy class and do this change in the data types.

Further, in the proxy classes if we are using out parameters and in parameters we need to declare the in parameters first and then the out parameters.
Guess this gives a complete proxy class to work with the web service client.

1 Comments:

At 12:28 PM, Anonymous Hullky said...

"Why do we need to create a proxy class if we can add the web service as a reference?"
Haha is this the way u ask questions in the training?
ela kiriYO.
nice work akkio.

 

Post a Comment

<< Home