您的位置:首页 > 产品设计 > UI/UE

Loadrunner-soap_request初体验

2015-11-18 13:20 399 查看
最近在学习Loadrunner工具,前几天第一次尝试手工编写soap_request编写脚本,主要适用于webservice接口。

如下所示:

<span style="font-family:Microsoft YaHei;"><span style="font-family:Microsoft YaHei;">Action()
{

web_add_header("SOAPAction", "\"\"");

web_add_header("Accept-Encoding","gzip");

lr_start_transaction("Order");

soap_request("StepName=createBatchTransOrder",
"URL=http://10.0.0.1/xxx?wsdl",              //具体的wsdl文件
"SOAPEnvelope=<?xml version=\"1.0\" encoding=\"US-ASCII\"?>"    //编码方式和xml版本
"<soapenv:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
"xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soapenv=\""  //固定的信息
"http://schemas.xmlsoap.org/soap/envelope/\">"
"<soapenv:Body><ses:createOrder xmlns:ses=\"http://sessionbean.xxx.com/\">"  //通过soapui得到的信息
"<arg0 xmlns= \"\" >"
"<token>xxx</token>"    //验证信息
"</arg0>"
"<arg1 xmlns= \"\">"
"<acceptAddress>{acceptAddress}</acceptAddress>"   //具体参数
"<acceptPerson>{acceptPerson}</acceptPerson>"
"</arg1>"
"</ses:createOrder>"
"</soapenv:Body>"
"</soapenv:Envelope>",
"Snapshot=t2.inf",
"ResponseParam=response",
LAST);

lr_end_transaction("Order", LR_AUTO);
return 0;
}</span>
</span>


除了自己手工编写,也可以通过导入xml文件自动生成代码。
可以参考/article/5452112.html

不过按照第一种web_service_call的方式遇见了一些问题:



内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: