四个SOAP协议应答编码例子


对于SOAP协议的一些基本概念我们在这里不多赘述了。前面我们也对SOAP封装的内容进行了一些举例讲解,这里我们再来对SOAP协议应答编码的一些例子尽心改一下介绍。

SOAP协议应答编码例1

  1. HTTP/1.1 200 OK  
  2. Content-Type: text/xml; charset="utf-8" 
  3. Content-Length: nnnn  
  4. <SOAP-ENV:Envelope 
  5. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  6. SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
  7. <SOAP-ENV:Header> 
  8. <t:Transaction xmlns:t="some-URI" xsi:type="xsd:int" mustUnderstand="1"> 5 </t:Transaction> 
  9. </SOAP-ENV:Header> 
  10. <SOAP-ENV:Body> 
  11. <m:GetLastTradePriceResponse xmlns:m="Some-URI"> 
  12. <Price>34.5</Price> 
  13. </m:GetLastTradePriceResponse> 
  14. </SOAP-ENV:Body> 
  15. </SOAP-ENV:Envelope> 

SOAP协议应答编码例2

  1. HTTP/1.1 200 OK  
  2. Content-Type: text/xml; charset="utf-8" 
  3. Content-Length: nnnn  
  4. <SOAP-ENV:Envelope 
  5. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  6. SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
  7. <SOAP-ENV:Body> 
  8. <m:GetLastTradePriceResponse 
  9. xmlns:m="Some-URI"> 
  10. <PriceAndVolume> 
  11. <LastTradePrice> 34.5 </LastTradePrice> 
  12. <DayVolume> 10000 </DayVolume> 
  13. </PriceAndVolume> 
  14. </m:GetLastTradePriceResponse> 
  15. </SOAP-ENV:Body> 
  16. </SOAP-ENV:Envelope> 

SOAP协议应答编码例3

  1. HTTP/1.1 500 Internal Server Error  
  2. Content-Type: text/xml; charset="utf-8" 
  3. Content-Length: nnnn  
  4. <SOAP-ENV:Envelope 
  5. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
  6. <SOAP-ENV:Body> 
  7. <SOAP-ENV:Fault> 
  8. <faultcode>SOAP-ENV:MustUnderstand</faultcode> 
  9. <faultstring>SOAP Must Understand Error</faultstring> 
  10. </SOAP-ENV:Fault> 
  11. </SOAP-ENV:Body> 
  12. </SOAP-ENV:Envelope> 

SOAP协议应答编码例4

  1. HTTP/1.1 500 Internal Server Error  
  2. Content-Type: text/xml; charset="utf-8" 
  3. Content-Length: nnnn  
  4. <SOAP-ENV:Envelope 
  5. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> 
  6. <SOAP-ENV:Body> 
  7. <SOAP-ENV:Fault> 
  8. <faultcode>SOAP-ENV:Server</faultcode> 
  9. <faultstring>Server Error</faultstring> 
  10. <detail> 
  11. <e:myfaultdetails xmlns:e="Some-URI"> 
  12. <message> 
  13. My application didn't work  
  14. </message> 
  15. <errorcode> 1001 </errorcode> 
  16. </e:myfaultdetails> 
  17. </detail> 
  18. </SOAP-ENV:Fault> 
  19. </SOAP-ENV:Body> 
  20. </SOAP-ENV:Envelope> 

相关内容

    暂无相关文章