一、前言
昨天分公司的小伙伴突然问我怎么用PostMan调用WebService接口,我瞬间懵了,没这么干过呀,能行不?网上搜了下还真的可以,把相关资料及过程记录下来,供小伙伴们及自己参考。
二、过程
2.1、确认 url 可用性
可以在外网访问 http://www.oorsprong.org/websamples.countryinfo/countryinfoservice.wso?wsdl (实操时把这里换成我们自己的业务url)
2.2、PostMan 调用
(1)将业务 url 填入 PostMan 的地址栏,使用 POST 方法调用:
(2)header中增加 Content-Type选项(值为text/xml)
(3)填充body(内容生成方法看后面介绍)
<Envelope xmlns="http://schemas.xmlsoap.org/soap/envelope/">
<Body>
<CountryFlag xmlns="http://www.oorsprong.org/websamples.countryinfo">
<sCountryISOCode>CN</sCountryISOCode>
</CountryFlag>
</Body>
</Envelope>
(4)验证结果
三、生成 soap body(可能需要FQ)
3.1、为浏览器安装 Wizdler 插件
可以在谷歌或Edge浏览器中直接访问 https://chrome.google.com/webstore/detail/wizdler/oebpmncolmhiapingjaagmapififiakb 并点击【添加至Chrome】。
3.2、在地址栏打开 webservice 的 url
例如打开 http://www.oorsprong.org/websamples.countryinfo/countryinfoservice.wso?wsdl 。
3.3、使用 Wizdler 生成 body
点击 Wizdler 插件,并选择自己想要调用的方法,使用生成的 body:
四、参考资料
生成soap信息 https://www.cnblogs.com/testway/p/9878186.html
使用postman调用webservice https://blog.csdn.net/qq_37160920/article/details/86504832
示例的postman请求下载地址 https://download.csdn.net/download/leandzgc/13125520
转载仅为方便学习查看,一切权利属于原作者,本人只是做了整理和排版,如果带来不便请联系我删除。

发表评论