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

来源:互联网 发布:c语言计算元音字母 编辑:程序博客网 时间:2024/05/16 11:03

http://boyun.sh.cn/blog/?p=1076

 

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-25-beta2

soapui-25-beta2

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

新建计划

新建计划

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

web service的服务列表

web service的服务列表

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

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

soapui-25-beta25

3.5 示例2 fetchBatch(编辑请求)

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

fetchBatch

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>

提交返回结果

返回结果

返回结果

4 说明

本文只是对SoapUI 做了简单的介绍,主要用其来查看web service提供的接口,以及返回的结果,以便进一步的利用,但是SoapUI的功能远不止这些,其可以对web service进行功能上和性能上的测试。

原创粉丝点击