SOAP Message Structure

[Previous] [Next]

A SOAP document is an electronic envelope into which you place your payload. The payload consists of the tags that describe the method you want to invoke and the data that method invocation needs to do its job. Figure 8-2 shows the SOAP package.

click to view at full size.

Figure 8-2. A SOAP document is an envelope containing a payload sent to the SOAP server.

A SOAP envelope document has two subelements, SOAP:Header and SOAP:Body. The SOAP:Header element contains information about the transaction. This information is user-defined, and its content depends on what you want to achieve. In the following example, the SOAP:Header element indicates a Transaction element that has a value of 5. The receiving application can use this value to do something useful. Notice that the Transaction element is in a user-defined namespace called trans.

 <SOAP:Header> <trans:Transaction xmlns:trans="http://schemas.architag.com/transaction.xsd" SOAP:mustUnderstand="1">5</trans:Transaction> </SOAP:Header> 

A SOAP element can have the SOAP:mustUnderstand global attribute. This attribute indicates whether a header entry is mandatory or optional for the recipient to process. The value of this attribute is either 1 or 0. It is designed to allow the specification to evolve over time. You could, for example, send a new SOAP document to a server that is written to an older specification. The SOAP:Header element is optional.

NOTE
SOAP works well over HTTP, but the SOAP spec indicates that other transport protocols can be used.

The SOAP:Header element is the envelope's second subelement. For the SOAP request, the body contains tags defined by the method you are invoking. These tags contain information that the method needs to do its job. For the SOAP response document, the SOAP:Body element contains the data created as the result of the message. (I've just described what happens if the method succeeds. An optional SOAP:Fault element can indicate whether the SOAP server had a problem processing the request.)

SOAP also provides rich semantics for indicating encoding style, array structure, and data types. All this information is available from the SOAP spec.



XML and SOAP Programming for BizTalk Servers
XML and SOAP Programming for BizTalk(TM) Servers (DV-MPS Programming)
ISBN: 0735611262
EAN: 2147483647
Year: 2000
Pages: 150

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