PostMan测试Web Service


1、设置URL

2、设置请求模式:Post

3、设置Header:添加 Content-Type ,值为 text/xml;charset=utf-8

4、设置Body:勾选raw

5、输入Body内容

Body案例:

以下几点是要修改替换地方:

<soap:Body>父级节点是固定不变的

xmlns 标识,命名空间   比如:http://WebXml.com.cn/

<soap:Body>节点下的getWeather 节点 是调用的web service的方法名

<getWeather>下的节点是 web serivce方法需要传输的参数  theCityCode、theUserID是方法参数

请求web serivce时的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>

web service响应时的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>

getWeatherResult是方法的返回值内容


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM