Using Web Services

If an application wraps a method call into a SOAP envelope and uses the HTTP protocol, it could use the method described in Figure 22.5 to communicate with the BasicWebService Web service. Alternatively, the client could use one of the HTTP GET or POST methods from Figure 22.6. It's possible, but that would be a lot of work.

The .NET Framework comes with a utility called wsdl that frees a client from creating all this plumbing. This utility takes the URL to a Web service and creates a proxy, which is used by the client to call the Web service. The following command line creates a proxy to the BasicWebService Web service with the name BasicWebService.cs, shown in Listing 22.3:

 wsdl http://csharp/csu/ch22/BasicWebService/BasicWebService.asmx?wsdl ...

Get C# Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.