SoapUI, Postman test WebService

Before installed SoapUI, recently installed Postman, they were used to test the WebService, for the following usage.

Online WebService test (data from the China Meteorological Administration)
Endpoint: http://www.webxml.com.cn/WebServices/WeatherWebService.asmx
the WSDL: http://www.webxml.com.cn/WebServices/WeatherWebService.asmx ? wsdl

First, with SoapUI test
1, the menu bar File -> New SOAP Project -> Open Window ->
Initial the WSDL input http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
-> the OK, SoapUI automatically all the methods listed.
-> Double-node getSupportCity following Request, Request 1 automatically open window, as shown below

 

2, now simply <web: byProvinceName>: input parameter values, such as <byProvinceName / web>:? Guangdong,
click on the window triangle blocks, returns the results as shown below:

 


Second, with Postman test
1, plus central click occurs Get Untitled Request tab, as shown below

 

2、把Get改成POST,后面输入WebService地址:http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?wsdl
点击下面的Headers,设置Key为Content-Type,Value为text/xml;charset=UTF-8
点击Body,点击raw,在下面输入窗口中,输入SoapUI窗口的请求串:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://WebXml.com.cn/">
   <soapenv:Header/>
   <soapenv:Body>
      <web:getSupportCity>
         <!--Optional:-->
         <web:byProvinceName>广东</web:byProvinceName>
      </web:getSupportCity>
   </soapenv:Body>
</soapenv:Envelope>

说明:

(1) xmlns:web="http://WebXml.com.cn/" 里面地址http://WebXml.com.cn需要和WebService地址保持一致;
(2)xmlns:web的命名空间web需要和下面方法<web:getSupportCity>里面的web保持一致;
(3)getSupportCity为方法名;
(4)byProvinceName为参数;
点击上面的Send按钮,返回结果如下图

 

总结:

在测试WebService方面,用SoapUI非常方便,不单把所有方法把列出来,测试方法时也只需要输入参数值。
Postman测试过程很繁琐,好多地方都需要手动输入。

 

Guess you like

Origin www.cnblogs.com/gdjlc/p/11280783.html