珍惜现在的每一分钟,全力以赴自己的梦想。 Jump for the sun, at least you land on the moon.

[StepbyStep]: Notes for SOAP 2 - SOAP元素:Header

上一篇 / 下一篇  2008-12-24 13:57:24 / 个人分类:测试技术

SOAP Header 元素

6e@|0^z o"Y0

可选的 SOAP Header 元素可包含有关 SOAP 消息的应用程序专用信息(比如认证、支付等)。如果 Header 元素被提供,则它必须是 Envelope 元素的第一个子元素51Testing软件测试网 Q6TQ O1V'~i%C

 51Testing软件测试网f&B5L7t'R

注释:所有 Header 元素的直接子元素必须是合格的命名空间。

OM L%|~IXp3A%K0

 

.|s[C,GG{Z,S0

<?xml version="1.0"?>51Testing软件测试网N mO a:u7`

<soap:Envelope

Dz2I@*_ro0

xmlns:soap="http://www.w3.org/2001/12/soap-envelope"

$uS8P9[a'XC0

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

-B U4Fw,J e*n}j:}0

 

(a }c+f:\PY0

<soap:Header>

ar/z*B,|cn `;g0

<m:Trans

? DAC VH$?0c#{E4f0

xmlns:m="http://www.w3school.com.cn/transaction/"51Testing软件测试网,Bog%QhZI

soap:mustUnderstand="1">234</m:Trans>51Testing软件测试网0j'lX;FZ

</soap:Header>

1SWNb+U9u+@2T0

 

m2Y`rx2B+R\S j0

...51Testing软件测试网-~+v7Xh}Hd

...

Dz\~2o1Mmo0

 

fg6R nj)l0

</soap:Envelope>上面的例子包含了一个带有一个 "Trans" 元素的头部,它的值是 234,此元素的 "mustUnderstand" 属性的值是 "1"

3}(~q"F\$z({H/p0

 51Testing软件测试网2L+GD?jA~

SOAP 在默认的命名空间中 ("http://www.w3.org/2001/12/soap-envelope") 定义了三个属性。这三个属性是:actor mustUnderstand 以及 encodingStyle。这些被定义在 SOAP 头部的属性可定义容器如何对 SOAP 消息进行处理。51Testing软件测试网;s}(d7[YL_)G8q2A%U

 

,ZwQNqkzb0

actor 属性51Testing软件测试网eo2krwM9D

 51Testing软件测试网wFOj?n;t4xI_7M

通过沿着消息路径经过不同的端点,SOAP 消息可从某个发送者传播到某个接收者。并非 SOAP 消息的所有部分均打算传送到 SOAP 消息的最终端点,不过,另一个方面,也许打算传送给消息路径上的一个或多个端点。

^` fLCJ}0

 

+]+g;W!E6J7H0

SOAP actor 属性可被用于将 Header 元素寻址到一个特定的端点。51Testing软件测试网1JH$z@7s [L\!M

 

0@6A?Ue0

语法

2M1B;b/n#S0

 

4Nj0th"S0

soap:actor="URI" 51Testing软件测试网)mzH2QM |n

 

0M`E B.kKl iL0

实例

!|)~$w%X;Z Ec.^;~/fuH?0

 

7|lC^e iB0N0

<?xml version="1.0"?>51Testing软件测试网*E I3n3U&O\ eU

<soap:Envelope51Testing软件测试网'S!u6_2q%w&[h2j

xmlns:soap="http://www.w3.org/2001/12/soap-envelope"

p$}$iA(z\f0

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">

:ZF haf0

 

2F2x7c iXb4f0

<soap:Header>

6Dv4cZ!cc"S ^t%tG6x0

<m:Trans51Testing软件测试网6OZ??w.nz:Z;v.i

xmlns:m="http://www.w3school.com.cn/transaction/"

*o&C,rGjX$zg`E0

soap:actor="http://www.w3school.com.cn/appml/">51Testing软件测试网 {7ox@.S g5J^5y:T

234

[%N9{"wM!|0

</m:Trans>51Testing软件测试网] w'JUL:wiE^

</soap:Header>

pjM3nE%C0

 51Testing软件测试网9Gr#RbQW h6SE1x

...51Testing软件测试网&{*h S+jqd

...51Testing软件测试网6B9K ^WK'fwW^J

 51Testing软件测试网 W;~F\CP&P0~

</soap:Envelope>

HO-Y-O\'qG0

 51Testing软件测试网$Y-}8@0PXj1?"m

mustUnderstand 属性51Testing软件测试网W+{qagI

 51Testing软件测试网,Q[1@|`

SOAP mustUnderstand 属性可用于标识标题项对于要对其进行处理的接收者来说是强制的还是可选的。

UzD9@7Ny9w5b-T0

 

'Y2P*q$Ay:vl+Z,["K0

假如您向 Header 元素的某个子元素添加了 "mustUnderstand="1",则它可指示处理此头部的接收者必须认可此元素。假如此接收者无法认可此元素,则在处理此头部时必须失效。51Testing软件测试网F[S'p M4O {

 51Testing软件测试网E5k,T]@L;x;wR {

语法

{@oUTI0

 51Testing软件测试网xG!@o }

soap:mustUnderstand="0|1"51Testing软件测试网&zIr"x'{S

 51Testing软件测试网l&dH-Gun;U'U

实例

AMG%R}1^0

 

5R_M"J+W"Mh+k~dC0

<?xml version="1.0"?>51Testing软件测试网-J/T9L2[2Y{

<soap:Envelope

&a)Q2O:\ E0})\8Nd-d I0

xmlns:soap="http://www.w3.org/2001/12/soap-envelope"51Testing软件测试网GF,Zy|WF|

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">51Testing软件测试网@EY[ cs?Pw

 

9G/O;t"x!E4]:m0

<soap:Header>51Testing软件测试网jS%c?PB!l M

<m:Trans

+[$g`J.N a{:|+l0

xmlns:m="http://www.w3school.com.cn/transaction/"

^-H;_Xoi0

soap:mustUnderstand="1">51Testing软件测试网-t9Vt[&w

23451Testing软件测试网:y#q,ew$IqyB

</m:Trans>51Testing软件测试网#ZW,Q1y$h~B

</soap:Header>

"?!b1E7v^Fl0

 51Testing软件测试网iIb#Jk2?+PO?

...

2D,{o![9wLI"f0

...51Testing软件测试网4l6OmF u7C3h

 51Testing软件测试网Tz#oE8{;o]r

</soap:Envelope>

*yCB?y8D0y-?0

TAG: 测试技术

 

评分:0

我来说两句

Open Toolbar