WebService发布后其服务是封装在一个wsdl文件中。客户端发请求主要是向发布好的wsdl地址以SOAP 方式发请求。
SOAP协议请求也是基于http协议传输。利用这一点我们可以用http协议中自定义请求方法web_custom_request()来编写脚本发送请求到WebService。
下面附件是脚本示例:
web_add_header("Content-Type", "text/xml; charset=utf-8"); web_add_header("Accept", "*.*"); web_add_header("Cache-Control", "no-cache"); web_add_header("SOAPAction", ""); //插入添加主菜单事务扩展接口 // lr_rendezvous("addMenuInfo"); lr_start_transaction("addMenuInfo"); web_custom_request("HttpSoapRequest", "URL=http://xxxxxxxxxxx/autovoiceWsiEntrance?wsdl", "Method=POST", "Resource=0", "RecContentType=text/xml", "Referer=", "Snapshot=t1.inf", "Mode=HTML", "EncType=text/xml; charset=utf-8", "Body=<?xml version=\"1.0\" encoding=\"utf-8\"?>" xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx LAST); lr_end_transaction("addMenuInfo", LR_AUTO); |
其中body部分就是请求内容, 可以通过抓包工具获取。
以上是WebService接口性能测试简介以飨大家,有兴趣的兄弟多研究研究。
相关阅读: