对于SOAP协议的一些基本概念我们在这里不多赘述了。前面我们也对SOAP封装的内容进行了一些举例讲解,这里我们再来对SOAP协议应答编码的一些例子尽心改一下介绍。
SOAP协议应答编码例1
- HTTP/1.1 200 OK
- Content-Type: text/xml; charset="utf-8"
- Content-Length: nnnn
- <SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- <SOAP-ENV:Header>
- <t:Transaction xmlns:t="some-URI" xsi:type="xsd:int" mustUnderstand="1"> 5 </t:Transaction>
- </SOAP-ENV:Header>
- <SOAP-ENV:Body>
- <m:GetLastTradePriceResponse xmlns:m="Some-URI">
- <Price>34.5</Price>
- </m:GetLastTradePriceResponse>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
SOAP协议应答编码例2
- HTTP/1.1 200 OK
- Content-Type: text/xml; charset="utf-8"
- Content-Length: nnnn
- <SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"
- SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/>
- <SOAP-ENV:Body>
- <m:GetLastTradePriceResponse
- xmlns:m="Some-URI">
- <PriceAndVolume>
- <LastTradePrice> 34.5 </LastTradePrice>
- <DayVolume> 10000 </DayVolume>
- </PriceAndVolume>
- </m:GetLastTradePriceResponse>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
SOAP协议应答编码例3
- HTTP/1.1 500 Internal Server Error
- Content-Type: text/xml; charset="utf-8"
- Content-Length: nnnn
- <SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <faultcode>SOAP-ENV:MustUnderstand</faultcode>
- <faultstring>SOAP Must Understand Error</faultstring>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>
SOAP协议应答编码例4
- HTTP/1.1 500 Internal Server Error
- Content-Type: text/xml; charset="utf-8"
- Content-Length: nnnn
- <SOAP-ENV:Envelope
- xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
- <SOAP-ENV:Body>
- <SOAP-ENV:Fault>
- <faultcode>SOAP-ENV:Server</faultcode>
- <faultstring>Server Error</faultstring>
- <detail>
- <e:myfaultdetails xmlns:e="Some-URI">
- <message>
- My application didn't work
- </message>
- <errorcode> 1001 </errorcode>
- </e:myfaultdetails>
- </detail>
- </SOAP-ENV:Fault>
- </SOAP-ENV:Body>
- </SOAP-ENV:Envelope>