SOAP Header 元素
4Go9_ L*Dj0h0rA0
可选的 SOAP Header 元素可包含有关 SOAP 消息的应用程序专用信息(比如认证、支付等)。如果 Header 元素被提供,则它必须是 Envelope 元素的第一个子元素。
&X0H)FEm2y0
-Nw}#N,nQ0
注释:所有 Header 元素的直接子元素必须是合格的命名空间。51Testing软件测试网`
|jRbC:}'l7A
.kM_
UCG9ZE0
<?xml version="1.0"?>51Testing软件测试网$d3`v.\I'az
<soap:Envelope51Testing软件测试网2Hqwe![S#|O3E
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"51Testing软件测试网{[(bZ y UW1Wo,G
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">51Testing软件测试网'niM:u,ex
51Testing软件测试网3T0h,WaH8h-RBmE
<soap:Header>51Testing软件测试网p
i%h(QLZ
<m:Trans
|7c7nH#zXfUi0
xmlns:m="http://www.w3school.com.cn/transaction/"51Testing软件测试网O2M&~;at
P q
soap:mustUnderstand="1">234</m:Trans>
FK#kC)F'{H
J2L[0
</soap:Header>
m~C*WC`!OT,H0
A4Y!n1Y2M2DxF0
...51Testing软件测试网2OkLPhL;C
...51Testing软件测试网zWef4FEZ!Ys{
8d&j5XbS_
z9v9m}0
</soap:Envelope>上面的例子包含了一个带有一个 "Trans" 元素的头部,它的值是 234,此元素的 "mustUnderstand" 属性的值是 "1"。
y4x4F5W,`*sr+~B9w\0
51Testing软件测试网1H{/BWu}
SOAP 在默认的命名空间中 ("http://www.w3.org/2001/12/soap-envelope") 定义了三个属性。这三个属性是:actor、 mustUnderstand 以及 encodingStyle。这些被定义在 SOAP 头部的属性可定义容器如何对 SOAP 消息进行处理。51Testing软件测试网@U`s l8C1Wj L
51Testing软件测试网H2@]*[3u4m
actor 属性51Testing软件测试网.| g/UI!b
51Testing软件测试网OY.U)WGp?i8v
通过沿着消息路径经过不同的端点,SOAP 消息可从某个发送者传播到某个接收者。并非 SOAP 消息的所有部分均打算传送到 SOAP 消息的最终端点,不过,另一个方面,也许打算传送给消息路径上的一个或多个端点。
rG?.WcOw}e^0
Z&`%rrn8A0
SOAP 的 actor 属性可被用于将 Header 元素寻址到一个特定的端点。
'F'}5L(l?6CK?0
51Testing软件测试网&txD1H9G
语法51Testing软件测试网#\igW!ak1~r2Y
,al+~'~r0
soap:actor="URI" 51Testing软件测试网(gco V7H1h%[G
G1s5\#Rs7ig0
实例51Testing软件测试网3H*G^-L'ZR{2St?S
51Testing软件测试网
eZ"m#SAN5PcZ{
<?xml version="1.0"?>
+h A(SQ Z [ gC0
<soap:Envelope51Testing软件测试网&_