SOAP 范例

假设我们有一个查询股票的 SOAP WEB 服务

我们的范例中,一个 GetStockPrice 请求被发送到了服务器。

此请求有一个 StockName 参数,而在响应中则会返回一个 Price 参数。

此功能的命名空间被定义在此地址中: "https://www.twle.cn/soap"

SOAP 请求

POST /soap/add HTTP/1.1
Host: www.twle.cn
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="https://www.twle.cn/soap">
        <m:GetStockPrice>
            <m:StockName>IBM</m:StockName>
        </m:GetStockPrice>
    </soap:Body>
</soap:Envelope>

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="https://www.twle.cn/soap">
        <m:GetStockPriceResponse>
            <m:Price>34.5</m:Price>
        </m:GetStockPriceResponse>
    </soap:Body>
</soap:Envelope>
关于   |   FAQ   |   我们的愿景   |   广告投放   |  博客

  简单教程,简单编程 - IT 入门首选站

Copyright © 2013-2022 简单教程 twle.cn All Rights Reserved.