测试地址: http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl 免费公共webservice
使用测试的协议是 SOAP 1.2
1. 打开postman,左上角 +New Collection 添加一个集合
2. 添加测试请求,左侧找到添加的 免费ws测试集合
也可以右键添加 add request
3. 选择请求方式为POST ,设置headers Content-Type application/soap+xml; charset=utf-8
4. 解析wsdl描述将参数添加到body里面
4.1 浏览器打开地址 http://ws.webxml.com.cn/WebServices/WeatherWS.asmx?wsdl 找空间命名,这个位置是固定的。这个下面会用到,这里是 http://WebXml.com.cn/
4.2 现在找一个 getSupportCityDataset的方法
4.2 postman设置body内容,啥子 raw内容
这是固定的xml格式
<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
调用方法描述写在这里
</soap12:Body>
</soap12:Envelope>
调用方法描述,其中要描述“表空间”+“方法名称”+“入参”
<getSupportCityString xmlns="http://WebXml.com.cn/">
<theRegionCode>重庆</theRegionCode>
</getSupportCityString>
设置完成,如图。 测试获取结果