两个SOAP封装例子


对于SOAP协议的内容,我们在前面的文章中已经讲解过了它的基础内容。这里我们主要针对SOAP封装进行一下案例的分析。那么下边我们主要举出了两个SOAP封装的例子,给大家提供一个参考。

SOAP封装:请求编码举例

SOAP封装例1

  1. POST /StockQuote HTTP/1.1  
  2. Host: www.stockquoteserver.com  
  3. Content-Type: text/xml; charset="utf-8" 
  4. Content-Length: nnnn  
  5. SOAPAction: "Some-URI"  
  6. <SOAP-ENV:Envelope 
  7. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  8. SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
  9. <SOAP-ENV:Header> 
  10. <t:Transaction 
  11. xmlns:t="some-URI" 
  12. SOAP-ENV:mustUnderstand="1"> 
  13. 5  
  14. </t:Transaction> 
  15. </SOAP-ENV:Header> 
  16. <SOAP-ENV:Body> 
  17. <m:GetLastTradePrice xmlns:m="Some-URI"> 
  18. <symbol>DEF</symbol> 
  19. </m:GetLastTradePrice> 
  20. </SOAP-ENV:Body> 
  21. </SOAP-ENV:Envelope> 

SOAP封装例2

  1. POST /StockQuote HTTP/1.1  
  2. Host: www.stockquoteserver.com  
  3. Content-Type: text/xml; charset="utf-8" 
  4. Content-Length: nnnn  
  5. SOAPAction: "Some-URI"  
  6. <SOAP-ENV:Envelope 
  7. xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
  8. SOAP-ENV:encodingstyle="http://schemas.xmlsoap.org/soap/encoding/"/> 
  9. <SOAP-ENV:Body> 
  10. <m:GetLastTradePriceDetailed 
  11. xmlns:m="Some-URI"> 
  12. <Symbol>DEF</Symbol> 
  13. <Company>DEF Corp</Company> 
  14. <Price>34.1</Price> 
  15. </m:GetLastTradePriceDetailed> 
  16. </SOAP-ENV:Body> 
  17. </SOAP-ENV:Envelope> 

相关内容

    暂无相关文章