- How to Consume a Web Service
- Creating the Web Service Consumer
- Testing the Web Service Consumer
Testing the Web Service Consumer
Now it is time to test what you've created.
Open your Web browser to
Enter the value 8 and click the Go button.
You should see the screen shown in Figure 3.3.
Figure 3.3 Testing your Web Service.
The first time you run your Web Service and your Web Forms application, a .NET Just In Time Compiler specific to your operating system, processor, and so forth compiles the assembly into real machine-level instruction code. This might take a few moments, so be patient. After the compilation is done, it doesn't have to be compiled again, and you will benefit from the ASP.NET caching feature, thus enjoying a tremendous performance benefit over traditional Active Server Page applications.
Examining the Results
If everything worked correctly, you should see the screen shown in Figure 3.4.
Figure 3.4 Results of consuming your Web Service
You can see that the Web Service successfully returned your result and that it was consumed by your Web page.
If you see anything other than the result in Figure 3.4, you could have mistyped some code. Double-check your code against the previous code listings. It is imperative that you pay attention to capitalization in C#! If you are convinced you typed the code correctly, you might want to check your configuration. For other suggestions, refer to Chapter 10, "Exceptions and Error Handling."