SOAP Header element

Source: Internet
Author: User

The optional SOAP Header element contains header information.

SOAP Header element

Optional SOAP header elements can contain application-specific information (such as authentication and payment) about soap messages ). If the Header element is provided, it must be the first child element of the envelope element.

Note: The direct sub-elements of all header elements must be qualified namespaces.

<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Header><m:Transxmlns:m="http://www.w3school.com.cn/transaction/"soap:mustUnderstand="1">234</m:Trans></soap:Header>......</soap:Envelope>

The preceding example contains a header with a "trans" element. Its value is 234. The value of the "mustunderstand" attribute of this element is "1 ".

In the default namespace ("http://www.w3.org/2001/12/soap-envelope"), Soap defines three attributes. These three attributes are: Actor, mustunderstand, and encodingstyle. These attributes defined in the SOAP header can define how the container processes soap messages.

Actor attributes

By passing through different endpoints along the message path, soap messages can be transmitted from a sender to a receiver. Not all parts of a SOAP message are intended to be transmitted to the end endpoint of the SOAP message. However, another aspect may be intended to be transmitted to one or more endpoints on the message path.

The actor attribute of soap can be used to address the Header element to a specific endpoint.

Syntax
soap:actor="URI" 
Instance
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Header><m:Transxmlns:m="http://www.w3school.com.cn/transaction/"soap:actor="http://www.w3school.com.cn/appml/">234</m:Trans></soap:Header>......</soap:Envelope>
Mustunderstand attributes

The mustunderstand attribute of soap can be used to identify whether a title item is mandatory or optional for the recipient to process it.

If you add "mustunderstand =" 1 "to a child element of the header, it indicates that the recipient processing this header must recognize this element. If the recipient cannot recognize this element, it must be invalid when processing this header.

Syntax
soap:mustUnderstand="0|1"
Instance
<?xml version="1.0"?><soap:Envelopexmlns:soap="http://www.w3.org/2001/12/soap-envelope"soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding"><soap:Header><m:Transxmlns:m="http://www.w3school.com.cn/transaction/"soap:mustUnderstand="1">234</m:Trans></soap:Header>......</soap:Envelope>
Encodingstyle attributes

The encodingstyle attribute of soap has been explained in the previous section.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.