|
You can use a Web browser to invoke the Web service methods, and the following short exercise will show you how.
Start Microsoft Internet Explorer.
Type the URL for the Web service’s .asmx file into the Address bar. If you’ve named the Web service Converter and installed it on IIS on your local computer in the default virtual directory, the address will be http://localhost/Converter/Converter.asmx.
Note | If you’ve installed the service on a remote computer or used another virtual directory, you’ll have to amend the address accordingly. |
When you press ENTER, the Web server will return you details of the Converter service and the methods it supports.
You can see how metadata has been extracted from the class and used to provide a description of the service.
Click one of the two methods. An HTTP GET command is sent to the server, which results in the server autogenerating a Web service consumer and sending it back to the browser.
The consumer takes the form of an HTML page that contains a description of the service, a way of testing the method, and descriptions of how to use the service using HTTP GET, HTTP POST, and SOAP.
Test the method by entering a suitable value into the text box and clicking Invoke. The Web service will invoke the method and return the answer as XML.
<?xml version="1.0" encoding="utf-8" ?> <double xmlns="http://VCSBS/WebServices/">42</double>
The double element identifies the value as a double, and the namespace is used to identify the Web service that is returning the result.
|