本文以天气预报的webService为基础进行学习

 
操作步骤:
1、启动Jmeter后,新建线程组,然后添加一个WebService(SOAP) request取样器。
后点击“载入WSDL”,载入成功后就可以看到web Methods中有可选项的出现,这里面的可选项就是该服务中包含的用户可调用的方法。
3、选择一个方法后(例如:getSupportCity)后,点击"配置",此时,Jmeter会自动填充协议、服务器名称、端口、路径和SOAPAction字段,记得每次切换方法时都要重新点击“配置”一遍,生成新的配置
4、填写webService Message信息,这里填写的信息就是需要向服务器的SOAP请求信息,请求信息的格式可以在天气预报的帮助页面中看到,例如getSupportCity的请求和响应信息。http://www.webxml.com.cn/WebServices/WeatherWebService.asmx?op=getSupportCity

SOAP 1.1

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /WebServices/WeatherWebService.asmx HTTP/1.1
Host: www.webxml.com.cn
Content-Type: text/xml; charset=utf-8
Content-Length:lengthSOAPAction: "http://WebXml.com.cn/getSupportCity" <?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>
<getSupportCity xmlns="http://WebXml.com.cn/">
<byProvinceName>string</byProvinceName>
</getSupportCity>
</soap:Body>
</soap:Envelope>
HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length:length<?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>
<getSupportCityResponse xmlns="http://WebXml.com.cn/">
<getSupportCityResult>
<string>string</string>
<string>string</string>
</getSupportCityResult>
</getSupportCityResponse>
</soap:Body>
</soap:Envelope>

SOAP 1.2

以下是 SOAP 1.2 请求和响应示例。所显示的占位符需替换为实际值。

POST /WebServices/WeatherWebService.asmx HTTP/1.1
Host: www.webxml.com.cn
Content-Type: application/soap+xml; charset=utf-8
Content-Length:length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<getSupportCity xmlns="http://WebXml.com.cn/">
<byProvinceName>string</byProvinceName>
</getSupportCity>
</soap12:Body>
</soap12:Envelope>
HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length:length<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
<soap12:Body>
<getSupportCityResponse xmlns="http://WebXml.com.cn/">
<getSupportCityResult>
<string>string</string>
<string>string</string>
</getSupportCityResult>
</getSupportCityResponse>
</soap12:Body>
</soap12:Envelope>
我们只需要将请求信息中的文本信息输入Soap/XML-RPC data输入框中,并替换需要查询的信息
例如getSupportCity的可以输入一下信息获取广东省支持的城市
<?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>
<getSupportCity xmlns="http://WebXml.com.cn/">
<byProvinceName>广东</byProvinceName>
</getSupportCity>
</soap:Body>
</soap:Envelope>

注意在选项区域中勾选“读取SOAP响应”的复选框。
这样取样器的基本配置就完成了。
5、添加一个响应断言,响应字段选择“响应文本”,匹配规则选择“包括”,添加测试的模式,输入“深圳”。
6、添加一个断言结果监控器,之前建好一个CSV文件,在断言结果中选择该文件将数据保存在里面
,添加一个保存响应文本监控器(用户查看放回的数据是否正确)。
7、最后,点击运行,OK!!!完工!
运行完成后,查看断言结果监控器看是否正确,正确的话会只放回:WebService(SOAP) Request
如果错误的话,会提示错误原因例如:
WebService(SOAP) Request
webservice_assue : Response was null
-------------------------------华丽的分隔线-------------------------------------------
再来看下CSV文件中保存的信息:
<sample t="218" lt="0" ts="1354524669558" s="true" lb="WebService(SOAP) Request" rc="200" rm="OK" tn="绾跨▼缁?1-1" dt="text" by="1052">
<assertionResult>
<name>webservice_assue</name>
<failure>false</failure>
<error>false</error>
</assertionResult>
</sample>
这个的内容于Configure中选择的项有关。有点奇怪的是采用的了<failure>和<error>两个字段,这两个字段的值为false时则表示成功。这里跟一般人的思维有点绕,开始我就没反应过来,汗!
在看个响应结果保存文件(默认应该在启动目录中可以找到)
<?xml version="1.0" encoding="utf-8"?><soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema"><soap:Body><getSupportCityResponse xmlns="http://WebXml.com.cn/"><getSupportCityResult><string>广州 (59287)</string><string>深圳 (59493)</string><string>潮州 (59312)</string><string>韶关 (59082)</string><string>湛江 (59658)</string><string>惠州 (59298)</string><string>清远 (59280)</string><string>东莞 (59289)</string><string>江门 (59473)</string><string>茂名 (59659)</string><string>肇庆 (59278)</string><string>汕尾 (59501)</string><string>河源 (59293)</string><string>揭阳 (59315)</string><string>梅州 (59117)</string><string>中山 (59485)</string><string>德庆 (59269)</string><string>阳江 (59663)</string><string>云浮 (59471)</string><string>珠海 (59488)</string><string>汕头 (59316)</string><string>佛山 (59279)</string></getSupportCityResult></getSupportCityResponse></soap:Body></soap:Envelope>
 
里面的信息就是getSupportCity(广东)的信息。如果需要获取里面市区的天气的话,就可以把这个所为一个关联的数据源获取值给变量赋值,可以使用正则表达式提取器。

webService(SOAP)性能测试脚本的更多相关文章

  1. Loadrunner Webservice接口性能测试脚本编写优化总结

    本文主要介绍使用Loadrunner Webservice接口性能测试脚本编写及优化总结. 1.Webservice协议脚本编写流程 下面介绍使用Loadrunner 11调用Webservice接口 ...

  2. 【JMeter4.0学习(三)】之SoapUI创建WebService接口模拟服务端以及JMeter对SOAP协议性能测试脚本开发

    目录: 创建WebService接口模拟服务端 下载SoapUI 新建MathUtil.wsdl文件 创建一个SOAP项目 接口模拟服务端配置以及启动 JMeter对SOAP协议性能测试脚本开发 [阐 ...

  3. RobotFrameWork webservice soap接口测试 (二)

    上一篇提到做soap接口测试自己简单的写了个py,然后就简单的实现了个客户端能对远程接口进行调用,对返回的数据进行解析,可后面想着也觉得不对劲,soap协议虽说不像http协议那么普及,但是现在很多公 ...

  4. 如何高效的进行WebService接口性能测试

    版权声明:本文为原创文章,转载请先联系并标明出处 关于接口测试的理解,主要有两类,一类是模块与模块间的调用,此类接口测试应该归属于单元测试的范畴,主要测试模块与模块之间联动调用与返回.此类测试大多关注 ...

  5. LR实现http协议性能测试脚本

    1.  GET方式的HTTP请求性能测试脚本 Action() { web_set_max_html_param_len("); web_reg_save_param("retCo ...

  6. 老李分享:Python开发性能测试脚本

    老李分享:Python开发性能测试脚本   测试开发工程师的工作主要是根据测试目标来完成,帮助测试人员完成测试目标,测试的业务需求是测试人员提出,但是由于环境的制约,手中没有性能测试工具的时候,性能测 ...

  7. Loadrunner Http接口Get/Post方法性能测试脚本解析

    最近使用LoadRunner 11进行了一次完整的Http WEB接口性能测试,下面介绍下Http接口Get/Post方法性能测试脚本通用编写方法. 1. Http接口性能测试基本流程 首先定义了一个 ...

  8. Fiddler系列教程3:使用Fiddler录制Jmeter性能测试脚本

    今天继续给大家带来Fiddler工具的教程3:使用Fiddler录制Jmter性能测试脚本. 我们知道Jmeter本身可以录制脚本,也可以通过BadBoy,BlazeMeter等工具进行录制,其实Fi ...

  9. 品味性能之道<九>:利用Loadrunner编写socket性能测试脚本简述

            一.概述         Loadrunner拥有极为丰富的工具箱,供予我们制造出各种奇妙魔法的能力.其中就有此次要讨论的socket套接字操作.     二.socket概述     ...

随机推荐

  1. .net System.IO之Stream的使用详解

    本篇文章是对.Net中System.IO之Stream的使用进行了详细的分析介绍,需要的朋友参考下 Stream在msdn的定义:提供字节序列的一般性视图(provides a generic vie ...

  2. 【Unity】角色沿路线移动/朝着目标移动

    先在场景中放置一连串物体作为角色移动路线的关键点,可以把关键点的触发器Trigger拉得大一些方便角色接触到(如酷跑/赛车类项目可以把关键点的触发器做成拦截整个道路的墙面形状).让角色从开始位置朝着第 ...

  3. C语言 · 彩票

    算法提高 彩票   时间限制:1.0s   内存限制:256.0MB      问题描述 为丰富男生节活动,贵系女生设置彩票抽奖环节,规则如下: 1.每张彩票上印有7个各不相同的号码,且这些号码的取值 ...

  4. table中超过长度的列,显示省略号

    <style type="text/css"> .table-ellipsis { table-layout: fixed; width: 100%; } .table ...

  5. hbase 学习(十三)集群间备份原理

    集群建备份,它是master/slaves结构式的备份,由master推送,这样更容易跟踪现在备份到哪里了,况且region server是都有自己的WAL 和HLog日志,它就像mysql的主从备份 ...

  6. 【C】——itoa 函数的实现

    itoa函数的实现,函数实现功能:输入一个 int 型的数据然后修改成 十六进制的字符串. 例如:  输入 100  输出 0x64 主函数: int main(void){ ]; my_atoi(v ...

  7. 【C】——网络编程-聊天室

    功能介绍: 此demo是基于TCP套接字编程,目的是实现一个聊天室效果.类似于QQ群效果,如果上线可以通知其他好友,下线也会通知其他好友. 需要用的技术: 一.socket编程. 1> sock ...

  8. java socket 服务端 客户端

    Server package com.witwicky.socket.basicsocket; import java.io.IOException; import java.io.InputStre ...

  9. maven工程如何引用css和js文件

    工程目录结构如下图: 目的: 在index.jsp中引用hello.js和base.css文件 实现: 在web.xml中,新增<servlet-mapping>     <serv ...

  10. DevExpressXtraReport—制作雷达图

    存储过程: SET ANSI_NULLS ON GO SET QUOTED_IDENTIFIER ON GO -- ========================================== ...