SOAP Header

 SOAP Header

作者:w3pop.com 翻译/整理:w3pop.com
<script type="text/javascript"> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>

The optional SOAP Header element contains header information.
可选择的SOAP标题元素包含了标题信息。


The SOAP Header Element
SOAP标题元素

The optional SOAP Header element contains application specific information (like authentication, payment, etc) about the SOAP message. If the Header element is present, it must be the first child element of the Envelope element.
可选择的SOAP标题元素包含了关于SOAP信息的应用程序的详细信息(如:验证(authentication)、返还值(payment)等)。如果标题元素是存在的,那它必须是Envelope元素的第一个子元素。

Note: All immediate child elements of the Header element must be namespace-qualified.
注意:标题(Header)元素的所有紧接着的子元素必须是有命名空间资格(namespace-qualified)的。

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<m:Trans
xmlns:m="http://www.w3schools.com/transaction/"
soap:mustUnderstand="1">234</m:Trans>
</soap:Header>
...
...
</soap:Envelope>

The example above contains a header with a "Trans" element, a "mustUnderstand" attribute value of "1", and a value of 234.
上面的例子包含了含有"Trans"元素的标题,属性值为1的"mustUnderstand"以及一个234值。

SOAP defines three attributes in the default namespace ("http://www.w3.org/2001/12/soap-envelope"). These attributes are: actor, mustUnderstand, and encodingStyle. The attributes defined in the SOAP Header defines how a recipient should process the SOAP message.
SOAP定义了3个默认空间("http://www.w3.org/2001/12/soap-envelope")的属性。这些属性是:actor, mustUnderstand,和 encodingStyle。定义在SOAP中的这些属性定义了容器如何处理SOAP信息。


The actor Attribute
行为(actor)属性

A SOAP message may travel from a sender to a receiver by passing different endpoints along the message path. Not all parts of the SOAP message may be intended for the ultimate endpoint of the SOAP message but, instead, may be intended for one or more of the endpoints on the message path.
SOAP信息会通过不同的端点沿着信息路径从发送人传到接收者。不是所有SOAP部分都会用于SOAP信息的最终端点,但是,作为交换,在信息路径中它们可能用于一个或更多端点。

The SOAP actor attribute may be used to address the Header element to a particular endpoint.
SOAP行为属性可能用于特定端点的标题元素寻址。

Syntax
语法
soap:actor="URI"
Example
实例
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<m:Trans
xmlns:m="http://www.w3schools.com/transaction/"
soap:actor="http://www.w3schools.com/appml/">
234
</m:Trans>
</soap:Header>
...
...
</soap:Envelope>


The mustUnderstand Attribute
mustUnderstand属性

The SOAP mustUnderstand attribute can be used to indicate whether a header entry is mandatory or optional for the recipient to process.
Soap mustUnderstand属性可以用来指明标题入口(header entry)对于接受者信息处理是强制的还是可选的。

If you add "mustUnderstand="1" to a child element of the Header element it indicates that the receiver processing the Header must recognize the element. If the receiver does not recognize the element it must fail when processing the Header.
如果你把"mustUnderstand="1"添加到一个子标题元素的元素上去的话,那就意味着接受者处理标题(Header)元素时,这个(标题)元素必须是可识别的;如果接收器无法识别该元素,那么处理标题元素时将会失败。

Syntax
语法
soap:mustUnderstand="0|1"
Example
实例
<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Header>
<m:Trans
xmlns:m="http://www.w3schools.com/transaction/"
soap:mustUnderstand="1">
234
</m:Trans>
</soap:Header>
...
...
</soap:Envelope>


The encodingStyle Attribute
encodingStyle属性

The SOAP encodingStyle attribute is explained in the previous chapter.
SOAP encodingStyle属性在前一章中已得以阐述。

<script type="text/javascript"> </script><script src="http://pagead2.googlesyndication.com/pagead/show_ads.js" type="text/javascript"> </script>
 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值