Loadrunner-soap_request初体验

最近在学习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文件自动生成代码。

可以参考http://www.cnblogs.com/spo22/archive/2010/06/17/1759795.html


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



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章