Loadrunner測試webservice介面

來源:互聯網
上載者:User

標籤:調試   reference   function   inf   ror   referer   ecc   size   soap   

轉:http://blog.csdn.net/liu870915/article/details/52066517

方法一:土辦法是使用LR內建的webservice協議,按照嚮導的提示:匯入wsdl、選擇服務名、形成指令碼的架構、讀懂並設定參數值,參照log返回資訊,調試指令碼,很簡單,這裡就不多講了........

方法二:利用LR的web(http/html)協議內建的web_custom_request()函數,向指定的URL地址POST相應的SOAP協議的HTTP訊息,LR function reference對web_custom_request()函數的解釋和樣本,簡直是悲劇,下面首先給出根據wsdl檔案產生SOAP訊息的方法,然後給出函數樣本:

 

SOAP協議本身,這裡就不累贅了,根據wsdl檔案產生SOAP訊息可以藉助工具XMLSpy這類的工具,它通過匯入wsdl檔案,建立相應服務的SOAP請求,樣本如下:

 

 

http://schemas.xmlsoap.org/soap/envelope/" xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
 <SOAP-ENV:Body>
  <m:r11OrderReq xmlns:m="http://service.intf.vsop.bss">
   <m:in0>String</m:in0>
  </m:r11OrderReq>
 </SOAP-ENV:Body>
</SOAP-ENV:Envelope>

 

下面給出函數樣本:

 

http://133.37.51.126:7010/xxxxxx/xxxxxx/xxxxxx", "service");//lc

 

 

 
 lr_start_transaction("xxxxxxx");

 

 

 

       "URL={service}",
       "Method=POST",
       "Resource=0",
       "RecContentType=text/xml",
       "Referer=",
       "Snapshot=t1.inf",
       "Mode=HTML",
       "EncType=text/xml;charset=utf-8",
       "Body=<SOAP-ENV:Envelope xmlns:SOAP-ENV=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:SOAP-ENC=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"< CDATA>10000000000172010-4-13‘>http://service.intf.vsop.bss\"><m:in0><![CDATA[<WorkListFKToVSOPReq><streamingNo>1000000000017</streamingNo><TimeStamp>2010-4-1314:00:01</TimeStamp><OrderId>1200000000000017</OrderId><SystemId>FK</SystemId><ActionType>0</ActionType><ProdSpecCode>CDMA</ProdSpecCode><ProductNo>18982765613</ProductNo><UserState>1</UserState></WorkListFKToVSOPReq>]]></m:in0></m:r11OrderReq></SOAP-ENV:Body></SOAP-ENV:Envelope>",
        LAST);

 

 
 if(strcmp(lr_eval_string("{rspcode}") ,"0")) {
  //lr_error_message("xxxxxxx fail:%s", lr_eval_string("{rspcode}" ));
  lr_error_message("xxxxxxx fail");
 }

 

ps:在<![CDATA]>標記下,所有的標記、實體引用都被忽略,而被XML處理常式一視同仁地當做字元資料看待。

 

 

Loadrunner測試webservice介面

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.