The wsdl tool accepts various parameters, as seen in our previous call. Here is an overview of the parameters used:

  • /language: Allows you to specify the language used to create the proxy class. The default is C#, so its inclusion in the previous call is extraneous. You can specify CS (C#; default), VB (Visual Basic), JS (JScript), or VJS (Visual J#) as the language argument.

  • /protocol: The protocol implemented in the proxy class with SOAP as the default setting. The additional options are SOAP12, HttpGet/ HttpPost, or a custom protocol.

  • The url points to the Web service. It may also point to an XSD schema or .discomap document. You can obtain discovery documents for an XML Web service using the Web Services Discovery Tool (Disco.exe). The .discomap, .disco, .wsdl, and .xsd files produced by this tool can be used as input to wsdl.exe. You should refer to the wsdl.exe tool documentation for more information on the additional command-line options available.

The following line generates a proxy class using VB.NET:

wsdl /language:vb /protocol:soap
http://localhost/WebServiceExample/Service1.asmx

Listing B contains a portion of the VB.NET proxy class generated by the wsdl tool.

Listing B

With the proxy class in place, it can be utilised to test our Web service. (Note: The proxy class may be developed using the language of your choice. It doesn't have to use the same language as used in the actual Web service.)

Using the proxy class
We can utilise this proxy class in a client application to use the features of our Web service. The client application may be developed with Windows Forms, ASP.NET, or any other .NET application. The ASP.NET Web Form in Listing C utilises the proxy class and C# to retrieve products by the product id entered by the user (entered via text box on Web Form).

Listing C

Listing D offers the VB.NET equivalent.

Listing D

The ASP.NET Web Form is simple; it accepts a value via a textbox and passes this value to the service's GetProductByID method. You might consider adding validation to ensure the user enters a valid integer value.

Making it available
You may be wondering how the proxy class helps customers using the class take advantage of the service. The proxy class may be distributed (along with a sample application) as a demonstration of how to use the service. In addition, customers (developers) may use the Web service URL to discover the service details and to utilise in their own application to create proxy classes. It's easy to develop a Web site using the proxy class, allowing customers to query through the site rather than developing their own custom solution.

The next step
At this point, we've developed our service, proxy class, and tested the service via the proxy class and Web site. In the next installment in this series, we'll cover different scenarios of using the service within other applications.

Related links

Comments

1

H@K - 28/08/07

the above email doesnt work...dont email me... just tell me if you can put a proxy on my webpage ....

webpage... myotaku.com
username.... instantaccess
password... xxxx
( seriously its four x's )
thanx 4 ur help if u help me
fix asap

» Report offensive content

2

H@K - 28/08/07

the above email doesnt work...dont email me... just tell me if you can put a proxy on my webpage ....

webpage... myotaku.com
username.... instantaccess
password... xxxx
( seriously its four x's )
thanx 4 ur help if u help me
fix asap

» Report offensive content

3

Neeraj - 30/01/09

Great example for someone reading about proxy class.

Thanks alot!

» Report offensive content

Leave a comment

You must read and type the 6 chars within 0..9 and A..F

* indicates mandatory fields.

3

Neeraj - 30/01/09

Great example for someone reading about proxy class. Thanks alot! ... more

2

H@K - 28/08/07

the above email doesnt work...dont email me... just tell me if you can put a proxy on my webpage .... webpage... ... more

1

H@K - 28/08/07

the above email doesnt work...dont email me... just tell me if you can put a proxy on my webpage .... webpage... ... more

Log in


Sign up | Forgot your password?

Most popular tags

What's on?

  • Optus Deal

    Broadband + home phone + PlayStation®3 in a single package price!