Linux下使用ab测试webservice性能

来源:互联网 发布:上海数据交易中心待遇 编辑:程序博客网 时间:2024/05/01 23:46

准备工作

1、安装apache httpd server
2、准备好待测试报文,即在SoupUI上调通后的客户端发送报文,保存为t.xml。

使用ab模拟调用webservice

ab命令:

ab -c 10 -t 30 -p t.xml  -H 'Content-Type: text/xml;charset=UTF-8' -H 'SOAPAction: ""' +web服务接口地址

其中,-c 表示并发数;-t 表示时间,-p t.xml, t.xml为。

报文示例:

<soapenv:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:web="http://webservice.***.com">   <soapenv:Header/>   <soapenv:Body>      <web:callProcedure soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">         <spxml xsi:type="xsd:string" xs:type="type:string" xmlns:xs="http://www.w3.org/2000/XMLSchema-instance"><![CDATA[<?xml version="1.0" encoding="UTF-8"?><root>**接口交互报文**</root>]]>        </spxml>      </web:callProcedure>   </soapenv:Body></soapenv:Envelope>
0 0
原创粉丝点击