UNIT -8
SOAP HEADER
Structure of Soap Message
The SOAP <Envelope> is the root element in every SOAP message.
It contains two child elements, an optional <Header>, and a mandatory <Body>.
The SOAP <Header> is an optional sub-element of the SOAP envelope.
It is used to pass application-related information that has to be processed by SOAP nodes along the message path.
The SOAP <Body> is a mandatory sub-element of the SOAP envelope.
It contains information intended for the ultimate recipient of the message.
SOAP Header
- The immediate child elements of the <Header> element are called header blocks.
- A header block is an application-defined XML element .
- SOAP nodes represent logical grouping of data that can encounter in the path of the message from sender to receiver.
- SOAP header blocks can be processed by SOAP intermediary nodes and by the ultimate SOAP receiver node.
- Each node is typically designed to process particular header blocks.
- Each header block is intended to be processed by particular nodes.
- SOAP header allows features to be added to a SOAP message in a decentralized manner.
- Although the header blocks are application-defined, SOAP-defined attributes on the header blocks indicate how the header blocks has to be processed by the SOAP nodes.
The attributes are:
- EncodingStyle
Indicates rules to encode parts of a SOAP message.
Role (SOAP 1.2)
Actor (SOAP 1.1)
In SOAP 1.2 role attribute specifies whether a particular node operates on a message. If the role specified for the node matches the role attribute of the header block then the node processes the header.
In SOAP 1.1 actor attribute has the same function.
- MustUnderstand
Indicates whether processing of the header block is mandatory or optional
The mustUnderstand attribute has these values:
True (SOAP 1.2)
1 (SOAP 1.1)
The node must either process the header block in a manner consistent with its specification, or not at all (and throw a fault).
False (SOAP 1.2)
0 (SOAP 1.1)
The node is not obliged to process the header block.
- Relay
Relay (SOAP 1.2 only)
By default, it also removes any header blocks that it ignored, because the mustUnderstand attribute had a value of false.
However, when the relay attribute is specified with a value of true, the node retains the unprocessed header block in the message.
- Actor
The SOAP protocol defines a message path as a list of SOAP service nodes. Each of these intermediate nodes can perform some processing and then forward the message to the next node in the chain. By setting the Actor attribute, the client can specify the recipient of the SOAP header.