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>

 

posted @   单纯的桃子  阅读(335)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· TypeScript + Deepseek 打造卜卦网站:技术与玄学的结合
· Manus的开源复刻OpenManus初探
· AI 智能体引爆开源社区「GitHub 热点速览」
· 三行代码完成国际化适配,妙~啊~
· .NET Core 中如何实现缓存的预热?
点击右上角即可分享
微信分享提示