如何使用Postman和SoapUI工具测试WebService接口
导读:本文共1762.5字符,通常情况下阅读需要6分钟。同时您也可以点击右侧朗读,来听本文内容。按键盘←(左) →(右) 方向键可以翻页。
摘要: 一、使用Postman测试WebService接口Postman:适用RESTful接口(HTTP/HTTPS协议)的功能测试通过浏览器访问http://oa.tmt.tcl.com/ekp/sys/webservice/scbcWebserviceEntrance?wsdl可以看到如下信息:打开Postman界面如下:设置请求方式为”POST”设置Conten... ...
目录
(为您整理了一些要点),点击可以直达。一、使用Postman测试WebService接口
Postman:适用RESTful接口(HTTP/HTTPS协议)的功能测试
通过浏览器访问http://oa.tmt.tcl.com/ekp/sys/webservice/scbcWebserviceEntrance?wsdl可以看到如下信息:
打开Postman界面如下:
设置请求方式为”POST”
设置Content-Type为text/xml;charset=UTF-8
设置body请求调用的方法excute及对应的参数param
注意引用变量{{pw}}
说明:
(1)xmlns:ser="http://service.util.odm.kmss.landray.com/"里面地址http://service.util.odm.kmss.landray.com/"需要和WebService地址保持一致;
(2)xmlns:ser的命名空间web需要和上面方法 <ser:execute>里面的web保持一致;
(3)execute为方法名;
(4)arg0为参数;
设置脚本和登录令牌
//生成令牌varpw="scbcsmes"+getMyDate(newDate());console.log("pw:==",pw);varmd5Str=CryptoJS.MD5(pw);postman.setGlobalVariable("pw",md5Str.toString(CryptoJS.enc.Hex).toUpperCase());functiongetMyDate(str){if(str==null||str==""){return'';}varoDate=newDate(str),oYear=oDate.getFullYear(),oMonth=oDate.getMonth()+1,oDay=oDate.getDate(),oHour=oDate.getHours(),oMin=oDate.getMinutes(),oTime=oYear+''+getzf(oMonth)+''+getzf(oDay)+''+getzf(oHour)+''+getzf(oMin);//最后拼接时间returnoTime;};functiongetzf(num){if(parseInt(num)<10){num='0'+num;}returnnum;}
请求结果如下:
二、用SoapUI测试WebService接口
SoapUI:适用WebService接口(SOAP协议)的测试
1、菜单栏File -> New SOAP Project -> 打开窗口 ->Initial WSDL 输入http://oa.tmt.tcl.com/ekp/sys/webservice/scbcWebserviceEntrance?wsdl-> OK,SoapUI会自动把所有方法把列出来了。
-> 双击节点execute下面的Request,自动打开Request 1窗口,如下图
2、现在只需在 <arg0>?</arg0>中输入参数值, 点击窗口的三角块,返回结果如下图:
</div> <div class="zixun-tj-product adv-bottom"></div> </div> </div> <div class="prve-next-news">
如何使用Postman和SoapUI工具测试WebService接口的详细内容,希望对您有所帮助,信息来源于网络。