postman連不上webservice
时间: 2023-08-21 14:18:13 浏览: 267
在使用Postman连接WebService时,需要确保以下几点:
1. 请求方式为POST。
2. WebService地址正确,例如:http://127.0.0.1:/WebService/LoginService.asmx。
3. 在请求的header中添加Content-Type:text/xml;charset=utf-8。
4. 参数以XML格式传递,例如:
```
<?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>
<Login xmlns="http://tempuri.org/">
<user>admin</user>
<psd>123456</psd>
</Login>
</soap:Body>
</soap:Envelope>
```
5. 确认返回值的格式,例如:
```
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<soap:Body>
<LoginResponse xmlns="http://tempuri.org/">
<LoginResult>{"status": 200, "msg": "登录成功"}</LoginResult>
</LoginResponse>
</soap:Body>
</soap:Envelope>
```
如果无法连接到WebService,可以检查以下几个方面:
1. 确认WebService服务是否正常启动。
2. 确认访问的方法是否存在。
3. 可以在浏览器中访问接口地址查看,例如:http://请求地址/ws/SiMaterialConsumptionSiService?wsdl。
希望以上信息对您有帮助。
#### 引用[.reference_title]
- *1* *2* [postman请求webService](https://blog.csdn.net/u013314974/article/details/126083353)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
- *3* [postman接口测试工具发起webservice请求](https://blog.csdn.net/qq_29950673/article/details/126304958)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v91^insert_down28v1,239^v3^insert_chatgpt"}} ] [.reference_item]
[ .reference_list ]
阅读全文
相关推荐


















