SOAP

SOAP relies on the HTTP 1.0 and higher protocol and supports W3C's XML specifications. A Web server supporting the standard HTTP protocol communication will support SOAP requests. If required, this can be a secure connection using the HTTPS protocol. The content type for a SOAP request is text/xml-SOAP and the MPOST verb is used (similar to a GET/POST/HEAD HTTP verbs). This enables the firewalls to easily recognize SOAP messages and filter them. It must be noted that SOAP does not replace the earlier COM or CORBA services but acts only as a protocol through which these services can communicate.

The W3C SOAP Abstract states:

SOAP is a lightweight protocol for exchange of information in a decentralized, distributed environment. It is an XML-based protocol that consists of three parts: an envelope that defines a framework for describing what is in a message and how to process it, a set of encoding rules for expressing instances of application-defined data types, and a convention for representing remote procedure calls and responses. SOAP can potentially be used in combination with a variety of other protocols; however, the only bindings defined in this document describe how to use SOAP in combination with HTTP and HTTP Extension Framework.

From this definition, you can see that SOAP is a high-level, lightweight messaging protocol, a mechanism to send messages between distinct applications without being concerned about the technology of the talking applications.

SOAP, unlike the other messaging systems, does not provide distributed garbage collection or batching of messages. It also is not capable of sending objects by reference requiring garbage collection. These features have been avoided to keep SOAP's design simple and extensible.

A SOAP object is an XML-based object. The basic structure of SOAP, shown in Figure 22.2, is as follows:

  1. A framework giving information about what the message consists of, for whom the message is meant, and whether the message is optional or not. This framework is called the envelope. This is the topmost element of the SOAP XML. The name of this XML element is Envelope. This is not an optional parameter. Namespace declarations and additional attributes are allowed if they are namespace-qualified. Also, if subelements are namespace-qualified, they can be used. In this case, they should follow the SOAP Body element (the third element of a SOAP object, described a little later).

  2. A SOAP message header contains information on who should handle the message. This section of the message has the capability to add features to the message in a decentralized manner, with no agreement between the communicating parties. The XML element name is Header. This is not a mandatory element in the message. However, if present, the Header element should occur immediately after the Envelope element of the SOAP XML. Also, the Header element may contain a set of header elements, each occurring as an immediate child of the Header element. In this case, however, the immediate child elements must be namespace qualified.

  3. The Body element contains the actual message meant for the recipient. This is a mandatory part of the message. SOAP defines only one Body element, called the Fault element, used to define errors. This element must exist as the immediate child of the SOAP Header element, if the Header element is present. If the Header element is not present, the Fault element must be the immediate child element of the Envelope element. In case multiple child elements of the Body element exist, they should exist as the immediate children of the SOAP Body element. These need not be namespace qualified. It should be noted, in conjunction with point 1, that in case Envelope subelements exist, they have to be present after the SOAP Body element.

Figure 22.2. Structure of a SOAP object.

graphics/22fig02.gif

A sample code snippet for a SOAP request message, requesting the taste of an apple pie (an item), is:

 <soap:Envelope>    <soap:Body>     <GetTaste>       <Item>Apple Pie</Item>     </GetTaste>   </soap:Body> </soap:Envelope> 

Note

The link to the default namespace for SOAP envelopes is http://www.w3.org/2001/12/soap-envelope.

The link to the default namespace for SOAP encoding and data types is http://www.w3.org/2001/12/soap-encoding.


SOAP has the ability to handle not only text messages, but also messages in the form of attachments or in binary format. A separate abstract has been defined by the W3C for SOAP with Attachments specifications. The MIME-type for these kinds of messages is multipart/related. The message containing the SOAP envelope attachment has a content-type text/html. The SOAP message header and body can access any part of the SOAP message.

Limitations of SOAP

Take a look at some of the limitations of SOAP:

  • The SOAP specifications talk only about communicating using the HTTP protocol but do not talk about any of the other protocols.

  • The potential hazards that the network security could face due to HTTP requests are almost replicated in SOAP. However, it is possible to get around this by providing explicit filters for HTTP headers containing the text/xml-SOAP content-type.

  • Bi-directional communication is not explicitly defined in SOAP.

  • Higher-level management issues, such as the life of a SOAP object and object activation, are not handled by SOAP.

  • One important aspect of SOAP is that it currently supports only synchronous communication. For efficiency purposes, it is more useful for SOAP to support asynchronous communication as well.

  • The specifications of SOAP do not make any language mandatory for interface definitions, although it does suggest that XML is a good language for performing the same.



Sams Teach Yourself BEA WebLogic Server 7. 0 in 21 Days
Sams Teach Yourself BEA WebLogic Server 7.0 in 21 Days
ISBN: 0672324334
EAN: 2147483647
Year: 2002
Pages: 339

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