Browsing a Web Service

Browsing a Web Service

Once you’ve created and built a Web service, you can easily browse the contents of the service through a Web browser by navigating to the URL of the Web service page. When you browse to a page without providing any parameters, the Web service will display its discovery information and other documentation if you provided it in the WebService attribute, as shown in Figure 21-5.

Figure 21-5.
Browsing a Web service by browsing to the .asmx file.

This page will give you a quick look at the public methods of the Web service that have been exposed as Web methods. Further, if you’ve provided a Description property for the WebMethod attribute, that information will be displayed here. By clicking the link to any of these methods, you’ll load a page that displays the details of the particular method, as shown in Figure 21-6.

Figure 21-6.
Displaying the details for a Web service method.

This page is divided into four sections labeled Test, SOAP, HTTP GET, and HTTP POST. In the Test section, you’ll find input boxes that can be used to pass any required parameters to the Web service method. Click the Invoke button to call the method and display the results in a second browser window, as shown in Figure 21-7.

Figure 21-7.
The results of the Web service method, displayed in a second browser window.

In addition, the Web service method page displays the XML schemas used to send and receive data from the Web service via the SOAP, HTTP GET, and HTTP POST protocols. (See the next section for more information about these protocols.)



Part III: Programming Windows Forms