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

[StepbyStep]: Notes for SOAP 2 - SOAP元素:HTTP Binding

上一篇 / 下一篇  2008-12-24 14:33:27 / 个人分类:测试技术

HTTP 协议51Testing软件测试网\W1yNK P7pC.p'h

 

/B'D2n2}5y/BC [?:j0

HTTP TCP/IP 之上进行通信。HTTP 客户机使用 TCP 连接到 HTTP 服务器。在建立连接之后,客户机可向服务器发送 HTTP 请求(Request)消息:

Y7Wyeo0

 51Testing软件测试网y(G.O-]8]L1UT

POST /item HTTP/1.1

0i_A n\0

Host: 189.123.345.23951Testing软件测试网"w*@ Q-H%f0{\PR*|

Content-Type: text/plain51Testing软件测试网sKq?k+v5DB

Content-Length: 200

n(it4N,X^i%w7^5U0

 51Testing软件测试网{(v1T]"d}Iy,l

随后服务器会处理此请求,然后向客户机发送一个 HTTP 响应(Response)。此响应包含了可指示请求状态的状态代码:

D a$?'k`T8H GE0

 51Testing软件测试网%{']owY8s;dIU

200 OK

.I~ t^5IgS\0

Content-Type: text/plain

t+FDg1U4lH0

Content-Length: 200

/p!Df)Fng8P0

 51Testing软件测试网]#ttX+p'mZ%RA

在上面的例子中,服务器返回了一个 200 的状态代码。这是 HTTP 的标准成功代码。51Testing软件测试网*yCWh&g

 

A/L(o,O4a3O%o+^&RT0

假如服务器无法对请求进行解码,它可能会返回类似这样的信息:51Testing软件测试网[l;C9O0D o!M

 51Testing软件测试网lte p t YR

400 Bad Request

Mp;q3o_C4EP0

Content-Length: 0

E;\$w O*W}p0

 51Testing软件测试网o$Qb2u@y)ZEmM

SOAP HTTP Binding

\&K8?a#BH%DOq!S0

 51Testing软件测试网S b|ELG8u E

SOAP 方法指的是遵守 SOAP 编码规则的 HTTP 请求/响应。51Testing软件测试网o gN2^t&FW

 51Testing软件测试网)i0ygM Sn(Yf

HTTP + XML = SOAP

\1kU@0D+e#{B0

 51Testing软件测试网e9g`e TzaN0j

SOAP 请求可能是 HTTP POST HTTP GET 请求。51Testing软件测试网*NM*[d$A~ ]

 51Testing软件测试网0^&la o Z T @O

HTTP POST 请求规定至少两个 HTTP Content-Type Content-Length51Testing软件测试网6_'kv#tG2n}l]

 

B`%u$I8L7ov e0

Content-Type51Testing软件测试网 upq/s/~(LAD

 51Testing软件测试网+`,M&[1Is:H'_1I

SOAP 的请求和响应的 Content-Type 头可定义消息的 MIME 类型,以及用于请求或响应的 XML 主体的字符编码(可选)。

s&t"jr m0

 

'`{gT7or0j7{0

语法51Testing软件测试网2Q*l;Ys;_Br

 

z,C\8^]JK-m%T0

Content-Type: MIMEType; charset=character-encoding

k+q'YF;Z0

 51Testing软件测试网+C-Jt0bo

例子

"TW2^/Q5gf$n:\;el+p0

 51Testing软件测试网:rA ^z@(`

POST /item HTTP/1.151Testing软件测试网TM:NM+Y;g \"s6qC

Content-Type: application/soap+xml; charset=utf-8

0Di;D8ECv%d3v0

 

,^k}(dkE3g4EMV0

Content-Length

I t,S1Ny9v0

 51Testing软件测试网kEJ8hEt P

SOAP 的请求和响应的 Content-Length 头规定请求或响应主体的字节数。51Testing软件测试网ObsT4k4G

 

#g:Nzb1C^0

语法

"i8hM!["l0

 51Testing软件测试网;f!H5L$\,U1b@

Content-Length: bytes 51Testing软件测试网n.l T fpZ8]+x(g4c

 

|bQx%F(x\0

例子51Testing软件测试网5h)o3B Evc)BKw

POST /item HTTP/1.1

i3rTex7C{.Y__(S0

Content-Type: application/soap+xml; charset=utf-851Testing软件测试网*{0RMr p(EK]

Content-Length: 250

;]j$D&vgo-_X0

TAG: 测试技术

 

评分:0

我来说两句

Open Toolbar