使用PostMan測試WebService接口
參考資料:
通過XML請求WebServer https://blog.csdn.net/qq_33933408/article/details/53149435
WebService發布與訪問並通過Postman測試WebService接口 https://blog.csdn.net/up123456789/article/details/79474446
一、操作步驟
1、設置URL
2、設置請求模式:Post
3、設置Header:添加 Content-Type ,值為 text/xml;charset=utf-8
4、設置Body:勾選raw
5、輸入Body內容:(詳見 二)
二、請求WebService時的Body結構
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getWeather xmlns="http://WebXml.com.cn/">
<theCityCode>string</theCityCode>
<theUserID>string</theUserID>
</getWeather>
</soap:Body>
</soap:Envelope>
詳細說明:
(1) getWeather是方法名。
(2)theCityCode、theUserID是方法參數。
三、WebService響應時的Body結構
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
<getWeatherResponse xmlns="http://WebXml.com.cn/">
<getWeatherResult>
<string>string</string>
<string>string</string>
</getWeatherResult>
</getWeatherResponse>
</soap:Body>
</soap:Envelope>
詳細說明:
(1)getWeatherResult是方法的返回值。