分享web开发知识

注册/登录|最近发布|今日推荐

主页 IT知识网页技术软件开发前端开发代码编程运营维护技术分享教程案例
当前位置:首页 > 教程案例

使用PostMan测试WebService接口

发布时间:2023-09-06 02:19责任编辑:顾先生关键词:Web

使用PostMan测试WebService接口

参考资料:

通过XML请求WebServer  https://blog.csdn.net/qq_33933408/article/details/53149435 

WebService发布与访问并通过Postman测试WebService接口 https://blog.csdn.net/up123456789/article/details/79474446

  

一、操作步骤

1、设置URL

2、设置请求模式:Post

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

4、设置Body:勾选raw

5、输入Body内容:(详见 二)

二、请求WebService时的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>


详细说明:

(1) getWeather是方法名。

(2)theCityCode、theUserID是方法参数。

三、WebService响应时的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>

详细说明:

(1)getWeatherResult是方法的返回值。

使用PostMan测试WebService接口

原文地址:https://www.cnblogs.com/marlonstudio/p/9830086.html

知识推荐

我的编程学习网——分享web前端后端开发技术知识。 垃圾信息处理邮箱 tousu563@163.com 网站地图
icp备案号 闽ICP备2023006418号-8 不良信息举报平台 互联网安全管理备案 Copyright 2023 www.wodecom.cn All Rights Reserved