|
SOAP Messages
Let's take a look at an example of a SOAP
message and examine the individual parts of the message. Keep in
mind that a SOAP message is an XML document, it just adheres to the SOAP
message schema.
The Envelope
must be the first element in a SOAP message. It
identifies an XML document as being a SOAP message and encapsulates all
the other parts of a message. The Envelope contains the version information about the
message, and it identifies the rules used by the application to serialize
data. Both the version and encoding rules are represented as namespace
URIs in the Envelope.
After the Envelope, a SOAP message can
contain a Header element.
The Header element is optional and can be used to extend the message
syntax independently from a particular application. For example,
information could be added to the Header element to add authorization or
transaction information to a message. If a Header appears, it must
immediately follow the Envelope.
The Body
element is the area of a SOAP message where the application-specific data
is placed. In the example message below, the SOAP Body represents a
remote procedure call to the method DoCreditCheck. The encoding
rules of the Envelope element describe what syntax was used to encode data
in the Body. The next page deals with how that data is represented in more
detail, but the Body element can hold any XML that your application needs
to send or receive through messages.
The example message below shows how the
Envelope, Header, and Body are used to build a complete message. Move your
mouse over the message below and you can see each part separately.
|