珍惜现在的每一分钟,全力以赴自己的梦想。 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 元素

4Go9_ L*Dj0h0rA0

可选的 SOAP Header 元素可包含有关 SOAP 消息的应用程序专用信息(比如认证、支付等)。如果 Header 元素被提供,则它必须是 Envelope 元素的第一个子元素

&X0H)FEm2y0

 

-Nw}#N,n Q0

注释:所有 Header 元素的直接子元素必须是合格的命名空间。51Testing软件测试网` |jRbC:}'l7A

 

.kM_ UCG9Z E0

<?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 Pq

soap:mustUnderstand="1">234</m:Trans>

FK#kC)F'{H J2L[0

</soap:Header>

m~C*WC`!OT,H0

 

A4Y!n1Y2M2DxF0

...51Testing软件测试网2Ok LPhL;C

...51Testing软件测试网zWef4F EZ!Ys{

 

8d&j5XbS_ z9v9m}0

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

y4x4F5W,`*sr+~B9w\0

 51Testing软件测试网1H {/BW u}

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)WG p?i8v

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

rG?.WcOw}e^0

 

Z&`%rrn8A0

SOAP actor 属性可被用于将 Header 元素寻址到一个特定的端点。

'F'}5L(l ?6CK?0

 51Testing软件测试网&txD1H9G

语法51Testing软件测试网#\igW!a k1~r2Y

 

,al+~'~r0

soap:actor="URI" 51Testing软件测试网(gcoV7H1h%[G

 

G1s5\#Rs7ig0

实例51Testing软件测试网3H*G^-L'ZR{2St?S

 51Testing软件测试网 eZ"m#SAN5P cZ{

<?xml version="1.0"?>

+h A(SQ Z [ gC0

<soap:Envelope51Testing软件测试网&_nKH3v_ej']hs#J

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

P#Me$y7hjN(c0

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

5|z'X,y'bTt#kx0

 

$Z-]m1E#m|f"I0

<soap:Header>

pBVsEC0

<m:Trans

'@'C$J%B.r X:O0

xmlns:m="http://www.w3school.com.cn/transaction/"51Testing软件测试网9aR#[I G| |2P

soap:actor="http://www.w3school.com.cn/appml/">51Testing软件测试网oMw&?!G)@ m9c

23451Testing软件测试网3Qn/? lL/Z)fr,H

</m:Trans>51Testing软件测试网)O$Kv6{7vh/{9v

</soap:Header>

:_ FH*I.?2~!J5g"p0

 51Testing软件测试网%wP%b;^B~)ef

...

2p/x;E X#\-CS ^0

...

P2E&|8G:TUuL0

 51Testing软件测试网*Pr8v*|(? `O W

</soap:Envelope>51Testing软件测试网n-Y)G3obu

 

0X3W-Y O2|_/E0

mustUnderstand 属性51Testing软件测试网|*`XTQZ

 

S\3y0[Z*H1Q0

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

JigL g0

 

p,nW1F1x OZ%u,w0

假如您向 Header 元素的某个子元素添加了 "mustUnderstand="1",则它可指示处理此头部的接收者必须认可此元素。假如此接收者无法认可此元素,则在处理此头部时必须失效。

,vE;[%u)q.X2j-f9H0

 51Testing软件测试网7c8\iD!IP

语法

%B/`Fkv__g9{sS0

 51Testing软件测试网a}*s\K!gJ

soap:mustUnderstand="0|1"51Testing软件测试网-AzHqT _

 

q[~ ^ S5KK*@ a0

实例51Testing软件测试网e B^m D'^)lw

 

!T HJa A:fb[,P0

<?xml version="1.0"?>51Testing软件测试网5a*N6t8w;Ab1M8\\d{

<soap:Envelope51Testing软件测试网}vSzdl0^

xmlns:soap="http://www.w3.org/2001/12/soap-envelope"51Testing软件测试网0|{a&G:O~

soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">51Testing软件测试网3J5L!o9I8v

 51Testing软件测试网)g`vYTz/m3t

<soap:Header>51Testing软件测试网0L hk(E&eK-w

<m:Trans51Testing软件测试网l\;iO[&GWY8?c&l

xmlns:m="http://www.w3school.com.cn/transaction/"51Testing软件测试网-@? ]$j5@#fC

soap:mustUnderstand="1">

#T:R/]P(z'lT{0

234

y;sj:U%@`Ln"r0

</m:Trans>

D1Pn@2~(|+r0

</soap:Header>

vCp&K,p]}0

 51Testing软件测试网O!wV#d d9M

...51Testing软件测试网-wwP5k_7P

...

,Y`2?4~3]0

 51Testing软件测试网@L RH-j N

</soap:Envelope>51Testing软件测试网0mVU0H!vSq Zs|3qh


TAG: 测试技术

 

评分:0

我来说两句

Open Toolbar