SOAP (Simple Object Access Protocol)

SOAP (Simple Object Access Protocol) was introduced to the world in late 1999. Its purpose was to provide an RPC-like structure for managing distributed objects over the Internet. The original standard called for the use of HTTP as the transport protocol, and XML as the data structure. SOAP is the carrier…the pickup truck for moving objects serialized as XML across the Internet. SOAP is a lightweight, message-based protocol that is built on XML and Internet standards. Every SOAP message is a one-way transmission, but SOAP messages can be combined to implement patterns such as request/response.

Although it is out of the scope of this book to go into much detail about SOAP, I felt that a very brief introduction was in order. I am not spending much of your time on this because you do not need to know how to construct and work with SOAP messages when building ASP.NET applications. However, a slight familiarity couldn't hurt.

The Structure of SOAP

A SOAP message is basically a chunk of data that contains an XML payload, which can be simple XML data, or a complex, serialized object. The basic SOAP structure is seen in Listing 12.14.

Listing 12.14. Basic SOAP Structure
01: <soap:Envelope
02: xmlns:xsi="http://www.w3.org/2000/10/XMLSchema-instance"
03: xmlns:xsd="http://www.w3.org/2000/10/XMLSchema"
04: xmlns:soap="http://schemas.xmlsoap.org/soap/envelope">
05:  <soap:Body>
06:  <User xmlns:m="User-Uri/">
07:   <Name>Willy Wonka</Name>
08:   <Email>[email protected]</Email>
09:  </User>
10:  </soap:Body>
11: </soap:Envelope>

Every SOAP message is an Envelope, containing an optional Header (SOAP-ENV:Header) and a required Body (SOAP-ENV:Body). The Header can carry specific data, such as a username and password for authentication when making a SOAP method call.

When looking at the SOAP structure in Listing 12.14, you can see why SOAP can be useful in Internet-based, distributed applications. The SOAP message is XML-based text, which can be read by any system that can parse XML. The payload, the XML data in the Body, can be raw data, or a representation of an object, such as a representation of a User object that exposes Name and Email properties.

SOAP Abstraction in .NET

The .NET Framework does a great job of abstracting SOAP functionality. In Chapter 14, you will learn about Web services, and how to consume Web services using SOAP messages in a request/response format. You will see how to transfer raw data and serialized objects from a provider to a consumer via SOAP. Because of the .NET Framework's abstraction of SOAP functionality, you will never need to build your own SOAP message; the .NET Framework will assemble the SOAP messages for distributing the data and objects between the provider and consumer.

Note

For a great book on SOAP, read Understanding SOAP by Kennard Scribner and Mark C. Stiver, Sams Publishing, ISBN 0-672-31922-5.


..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.16.48.181