Running the Service
Now that you have successfully built the service, it is time to make sure that it actually runs. Visual Studio includes a very helpful method for running your services without the need to write any code at all.
To run your service, type F5 or choose Start from the Debug menu. When you have done this, Visual Studio will open your asmx file in Internet Explorer, as shown in Figure 7.3.
Figure 7.3 Our four-function calculator in Internet Explorer.
The Internet Explorer interface to your service is very slick and can be used to expose a lot of information to potential users. Notice in Figure 7.3 that the names of all of your methods are listed. Also note that you are provided with a link to the WSDL contract. This is a very important feature; you will make use of this link in just a few moments.
By clicking on any of the method names, you will be taken to a page that Internet Explorer includes for each of your methods. In these pages, you are shown the names of input parameters and the variable type to be returned by the method, as well as SOAP, HttpPost, and HttpGet return and response information.
You are also given a Web form with which to use each method. Figure 7.4 shows your Add Method in Internet Explorer. Type a few values for the Add method and click on the button labeled "Invoke."
Figure 7.4 Using the Add method of your XML Web service.
Internet Explorer now opens a new window containing the XML that will be returned to clients that use your service (see Figure 7.5). Notice that you receive your value wrapped in XML tags that contain the data type being returned. This allows your client application to type check data in much the same way that COM applications do.
Figure 7.5 The answer returned by your XML Web service.