18.7. Summary

 < Day Day Up > 

.NET supports the development of both Web Service provider and Web Service consumer applications. On the server side, a .NET Web Service is easily constructed using a WebService directive to define the Web Service class and a WebMethod attribute to identify methods accessible to HTTP requests. For the Web Service to be used by clients, a description of the service(s) must be made available. This is the purpose of the Web Service Description Language (WSDL) contract. This XML file describes the service, the methods available, and a description of the arguments each method accepts. You can generate the contract by using a browser to navigate to a URL address that consists of the URL of the Web Service with ?WSDL appended to it.

The WSDL information is used on the client side to create a Proxy class that is used to actually communicate with the Web Service. This proxy is created using the wsdl.exe utility or within a Visual Studio.NET project as part of the Add Web Service option. The proxy defines methods that permit the Web Service methods to be accessed synchronously or asynchronously. The latter technique returns control to the application while the request is being processed.

SOAP (Simple Object Access Protocol) describes the XML format that is used to transport information between a Web Service provider and consumer. Its structure consists of an envelope, optional header, and body. The body contains the actual data or message; the header may contain annotation about the message. One such use is to include user authentication information. The main advantage of SOAP over the other two wire protocols HTTP GET and HTTP POST is that it supports the transmission of non-text data such as images and objects. We demonstrated this by building a client to access the Amazon Web Services.

     < Day Day Up > 

    Core C# and  .NET
    Core C# and .NET
    ISBN: 131472275
    EAN: N/A
    Year: 2005
    Pages: 219

    flylib.com © 2008-2017.
    If you may any questions please contact us: flylib@qtcs.net