webService(SOAP)性能测试脚本
本文以天气预报的webService为基础进行学习
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: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)性能测试脚本的更多相关文章
- Loadrunner Webservice接口性能测试脚本编写优化总结
		
本文主要介绍使用Loadrunner Webservice接口性能测试脚本编写及优化总结. 1.Webservice协议脚本编写流程 下面介绍使用Loadrunner 11调用Webservice接口 ...
 - 【JMeter4.0学习(三)】之SoapUI创建WebService接口模拟服务端以及JMeter对SOAP协议性能测试脚本开发
		
目录: 创建WebService接口模拟服务端 下载SoapUI 新建MathUtil.wsdl文件 创建一个SOAP项目 接口模拟服务端配置以及启动 JMeter对SOAP协议性能测试脚本开发 [阐 ...
 - RobotFrameWork webservice soap接口测试 (二)
		
上一篇提到做soap接口测试自己简单的写了个py,然后就简单的实现了个客户端能对远程接口进行调用,对返回的数据进行解析,可后面想着也觉得不对劲,soap协议虽说不像http协议那么普及,但是现在很多公 ...
 - 如何高效的进行WebService接口性能测试
		
版权声明:本文为原创文章,转载请先联系并标明出处 关于接口测试的理解,主要有两类,一类是模块与模块间的调用,此类接口测试应该归属于单元测试的范畴,主要测试模块与模块之间联动调用与返回.此类测试大多关注 ...
 - LR实现http协议性能测试脚本
		
1. GET方式的HTTP请求性能测试脚本 Action() { web_set_max_html_param_len("); web_reg_save_param("retCo ...
 - 老李分享:Python开发性能测试脚本
		
老李分享:Python开发性能测试脚本 测试开发工程师的工作主要是根据测试目标来完成,帮助测试人员完成测试目标,测试的业务需求是测试人员提出,但是由于环境的制约,手中没有性能测试工具的时候,性能测 ...
 - Loadrunner Http接口Get/Post方法性能测试脚本解析
		
最近使用LoadRunner 11进行了一次完整的Http WEB接口性能测试,下面介绍下Http接口Get/Post方法性能测试脚本通用编写方法. 1. Http接口性能测试基本流程 首先定义了一个 ...
 - Fiddler系列教程3:使用Fiddler录制Jmeter性能测试脚本
		
今天继续给大家带来Fiddler工具的教程3:使用Fiddler录制Jmter性能测试脚本. 我们知道Jmeter本身可以录制脚本,也可以通过BadBoy,BlazeMeter等工具进行录制,其实Fi ...
 - 品味性能之道<九>:利用Loadrunner编写socket性能测试脚本简述
		
一.概述 Loadrunner拥有极为丰富的工具箱,供予我们制造出各种奇妙魔法的能力.其中就有此次要讨论的socket套接字操作. 二.socket概述 ...
 
随机推荐
- python-标识符(Identifiers)和关键字(keywords)
			
标识符:Identifiers 标识符必须以字母(大小写均可)或者"_"开头,接下来可以重复0到多次(字母|数字|"_") 特点: 1.没有长度限制 2.区分大 ...
 - [转]bootstrap的table插件动态加载表头
			
原文地址:https://blog.csdn.net/abubu123/article/details/78060321 bootstrap的table属性已经很熟悉了,最近遇到一个问题,犹豫每个列表 ...
 - C语言  ·  比较字符串
			
算法训练 比较字符串 时间限制:1.0s 内存限制:512.0MB 编程实现两个字符串s1和s2的字典序比较.(保证每一个字符串不是另一个的前缀,且长度在100以内).若s1和s2相 ...
 - Java编程的逻辑 (49) - 剖析LinkedHashMap
			
本系列文章经补充和完善,已修订整理成书<Java编程的逻辑>,由机械工业出版社华章分社出版,于2018年1月上市热销,读者好评如潮!各大网店和书店有售,欢迎购买,京东自营链接:http:/ ...
 - 在android中使用logback-android日志框架配置 slf4j + logback
			
为什么使用 slf4j + logback logbak定位于log4j的替代者,logback同样支持slf4j,方便被替换.在Android平台上,我在使用log4中遇到tag混乱的问题.相比lo ...
 - WebRTC 源码分析(五):安卓 P2P 连接过程和 DataChannel 使用
			
从本篇起,我们将迈入新的领域:网络传输.首先我们看看 P2P 连接的建立过程,以及 DataChannel 的使用,最终我们会利用 DataChannel 实现一个 P2P 的文字聊天功能. P2P ...
 - 通过 Spark R 操作 Hive
			
作为数据工程师,我日常用的主力语言是R,HiveQL,Java与Scala.R是非常适合做数据清洗的脚本语言,并且有非常好用的服务端IDE——RStudio Server:而用户日志主要储存在hive ...
 - 安卓程序代写 网上程序代写[原]BluetoothDevice详解
			
一. BluetoothDevice简介 1. 继承关系 public static Class BluetoothDevice extends Object implement Parcelable ...
 - CSS弹出背景半透明窗口
			
<script type="text/javascript" src="<ww:url value='/js/jquery-1.8.3.min.js'/> ...
 - 关于GO语言遇到illegal UTF-8 encoding 随手记录
			
在使用汉字的时候会报错 解决方案 editpad++ 修改编码为UTF-8 保存就可以了~bingo