网络学院 w3pop社区 网络资源 IT新闻

w3pop.com :: 网络学院 :: SOAP :: SOAP 实例

会员登陆

帐号

密码

回答

记住密码

忘记密码? 注册

SOAP
SOAP 介绍
SOAP 语法
SOAP Envelope
SOAP Header
SOAP Body
SOAP Fault
SOAP HTTP Bindin..
SOAP 实例
SOAP 总结

SOAP 实例


作者:w3pop.com 翻译/整理:w3pop.com 发布:2007-04-29 修改:2008-02-27 浏览:2821 :: ::

A SOAP Example
Soap 实例

In the example below, a GetStockPrice request is sent to a server. The request has a StockName parameter, and a Price parameter will be returned in the response. The namespace for the function is defined in "http://www.example.org/stock" address.
在下面的例子中,一个 GetStockPrice 请求被发送到了服务器。此请求有一个 StockName 参数,而在响应中则会返回一个 Price 参数。此功能的命名空间被定义在此地址中: "http://www.example.org/stock"

The SOAP request:
SOAP请求:

POST /InStock HTTP/1.1
Host: www.example.org
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn

<?xml version="1.0"?>
<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
   <m:GetStockPrice>
<m:StockName>IBM</m:StockName>
    </m:GetStockPrice>
</soap:Body>
</soap:Envelope>

A SOAP response:
SOAP响应:

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: nnn
<?xml version="1.0"?>

<soap:Envelope
xmlns:soap="http://www.w3.org/2001/12/soap-envelope"
soap:encodingStyle="http://www.w3.org/2001/12/soap-encoding">
<soap:Body xmlns:m="http://www.example.org/stock">
<m:GetStockPriceResponse>
<m:Price>34.5</m:Price>

</m:GetStockPriceResponse>
</soap:Body>
</soap:Envelope>

评论 (0) All