利用SoapUI 测试web service的方法介绍

时间:2023-03-08 22:43:03
利用SoapUI 测试web service的方法介绍

1. 简介

SoapUI是用java开发的测试web service的工具。

2. 安装

2.1. 下载地址

http://www.soapui.org/

2.2. 安装

By downloading and installing soapUI using the windows installer from SourceForge soapUI Web Site, which includes the required 1.6 JRE (Java Runtime Environment). Use the installer if you are unsure about your systems Java installation or if you want startup menu icons and an uninstaller.

1.6 JRE 环境
双击安装就可以使用了。

2.3. 使用说明

http://www.soapui.org/userguide/index.html

3. 开始测试

3.1. 准备

soapUI已经安装成功
知道要测试的服务的地址,这里以EBI的WSDbfetch为例wsdl地址为:
http://www.ebi.ac.uk/Tools/webservices/wsdl/WSDbfetch.wsdl

3.2. 启动程序

利用SoapUI 测试web service的方法介绍

soapui-25-beta2

3.3. 新建计划
File->New soapUI Project

利用SoapUI 测试web service的方法介绍

新建计划

Ok后,查看提供的web service的服务。

利用SoapUI 测试web service的方法介绍

web service的服务列表

3.4 示例1 getSupportedDBs(不需要编辑请求)

双击Request1,显示Request界面,点击绿色的提交按钮,就会递交请求,同时会在右侧返回结果,请求与结果都为XML格式。

利用SoapUI 测试web service的方法介绍

3.5 示例2 fetchBatch(编辑请求)

请求的页面有问号的地方,都是需要你编辑,如同查询时你选择数据库输入查询结果一样。

利用SoapUI 测试web service的方法介绍

fetchBatch

<soapenv:Body>
      <wsd:fetchBatch soapenv:encodingStyle=”http://schemas.xmlsoap.org/soap/encoding/“>
         <db xsi:type=”xsd:string”>uniprotkb</db>
         <ids xsi:type=”xsd:string”>WAP_MOUSE,WAP_RAT</ids>
         <format xsi:type=”xsd:string”>default</format>
         <style xsi:type=”xsd:string”>default</style>
      </wsd:fetchBatch>
   </soapenv:Body>

提交返回结果

利用SoapUI 测试web service的方法介绍

返回结果