Creating a WSDL File and Clients for Your ASP.NET Web Service | WebReference

Creating a WSDL File and Clients for Your ASP.NET Web Service

By Leidago Noabeb


[next]

In my previous article I explained how to create a fully functioning ASP.NET Web service that integrates with a database. In this article I discuss the Web Services Description Language (WSDL) file that is generated for that Web service (used to look up names in a database) and then explain how to create both Web- and desktop-based clients to access and consume the service.

The WSDL File for the Web Service

A WSDL file is a document that describes a Web service and also tells you how to access and use its methods. When you run the name-lookup service you will see how its SOAP message works and what parameters it works with. Here is the request message:

The search term variable has a placeholder called string, which you of course will replace with the value that you want to search with. The response message has the following text:

Notice that the response message contains the following line, where the same string that you enter is sent back to the browser in the result tags:

Notice also that the entire envelope is created using XML.

If you want to see the WSDL for the demo Web service, simply add ?wsdl to the end of the URL that you used to access the service. In short, you type the following in your browser to access the service:

To view the WSDL file, you simply append the ?wsdl text:

This will give you the following information about the service:

The information in the file tells you everything about the methods that are exposed and the parameters that are expected to be used. Take a look at this section from the file:

The name and type are clearly laid out. You can see that the service expects a parameter of type string and that the operation of a method called searchname.


[next]