ASP.NET Web应用程序创建的webservice接口如何在postman里测试调用
ASMX中的方法
启动项目浏览器展示的页面如下
点击ReceiveOrder,展示该方法的请求和响应示例
在postman中输入以下信息
选择raw--xml,粘贴浏览器中的SOAP1.1或者SOAP1.2中的请求示例
点击Send按钮发生请求
SOAP 1.1
以下是 SOAP 1.1 请求和响应示例。所显示的占位符需替换为实际值。
POST /WebService.asmx HTTP/1.1 Host: localhost Content-Type: text/xml; charset=utf-8 Content-Length: length SOAPAction: "http://server.webservice.example.com/ReceiveOrder" <?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> <ReceiveOrder xmlns="http://server.webservice.example.com"> <xmlString>string</xmlString> </ReceiveOrder> </soap:Body> </soap:Envelope>
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?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> <ReceiveOrderResponse xmlns="http://server.webservice.example.com"> <ReceiveOrderResult>string</ReceiveOrderResult> </ReceiveOrderResponse> </soap:Body> </soap:Envelope>
SOAP 1.2
以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。
POST /WebService.asmx HTTP/1.1 Host: localhost Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?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> <ReceiveOrder xmlns="http://server.webservice.example.com"> <xmlString>string</xmlString> </ReceiveOrder> </soap12:Body> </soap12:Envelope>
HTTP/1.1 200 OK Content-Type: application/soap+xml; charset=utf-8 Content-Length: length <?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> <ReceiveOrderResponse xmlns="http://server.webservice.example.com"> <ReceiveOrderResult>string</ReceiveOrderResult> </ReceiveOrderResponse> </soap12:Body> </soap12:Envelope>
HTTP POST
以下是 HTTP POST 请求和响应示例。所显示的占位符需替换为实际值。
POST /WebService.asmx/ReceiveOrder HTTP/1.1
Host: localhost
Content-Type: application/x-www-form-urlencoded
Content-Length: length
xmlString=string
HTTP/1.1 200 OK Content-Type: text/xml; charset=utf-8 Content-Length: length <?xml version="1.0" encoding="utf-8"?> <string xmlns="http://server.webservice.example.com">string</string>
分类:
http接口
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?