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的方式遇見了一些問題:



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