html的loadrunner脚本

 Action()
{

   char strs[20];

   lr_start_transaction("api_sync_order");
   web_add_header("SOAPAction", "syncProvisionData");
   soap_request("StepName=api_sync_order_1",
                  "ExpectedResponse=AnySoap",
      "URL=http://{MVAS_IP_ADDR}:40417/IB/services/ProvisionServices2",
                  "SOAPEnvelope="
     "<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ib="http://ib.huawei.com">"
        "<soapenv:Header/>"
        "<soapenv:Body>"
        "<ib:syncProvisionDataReq>"
        "<ib:reqHeader>"
        "<accessAuth>"
           "<accessCode>f38e4521fd347bba9b32c5f5b7e04fd7ba0bd147b83a73c638c99467961bf7a3</accessCode>"
           "<neID>0000000001</neID>"
           "<timeStamp>20140408194630</timeStamp>"
        "</accessAuth>"
        "<actionType>Create</actionType>"
        "<dataType>syncProvisionData1</dataType>"        
        "<operatorID>123</operatorID>"
                                "<svrCommInfo>"
                                  "<serviceID>123</serviceID>hh"
                                  "<spID>123</spID>"
                                  "<userID>123</userID>"
                                "</svrCommInfo>"
        "<traceUniqueID>000001100781307161400010001001</traceUniqueID>"
        "<transactionID>001</transactionID>"
        "<version>1</version>"
        "</ib:reqHeader>"
        "<reqBody>"
        "<mvasSubscribeUnsubscribeService>"
           "<userID>"
           "<ID>{UserID_order}</ID>"
           "<type>0</type>"
           "</userID>"
           "<syncDevCode>000000001</syncDevCode>"
           "<spID>IB</spID>"
           "<subInfoList>"
           "<subInfos>"
           "<item>"
           "<productID>{ProductID}</productID>"            
           "</item>"
           "</subInfos>"
           "</subInfoList>"
           "<updateType>1</updateType>"
           "<updateTime>20140509191230</updateTime>"
           "<updateDesc>1:add,2:delete</updateDesc>"
           "<try>false</try>"
           "<notifyAddress>123</notifyAddress>"
           "<rentSuccess>true</rentSuccess>"            
        "</mvasSubscribeUnsubscribeService>"
        "</reqBody>"
        "</ib:syncProvisionDataReq>"
        "</soapenv:Body>"    
     "</soapenv:Envelope>",
                 "Snapshot=t1.inf",
     "ResponseParam=result",
      LAST);

     //ͳ¼Æÿһ¸ö¶©¹ºÒµÎñµÄ¾ßÌåÃû³Æ
     sprintf(strs,"api_sync_order_%s",lr_eval_string("{ProductID}"));

  lr_save_string(strs,"Order_product");
  lr_start_transaction(lr_eval_string("{Order_product}"));

  lr_xml_get_values("xml={result}",
                      "ValueParam=Param_resultCode",
                       "Query=//result/item/resultCode",
        "NotFound=Continue",
                       LAST);
  

 if (0 == strcmp(lr_eval_string("{Param_resultCode}"), "00000000"))

 {
        
   lr_end_transaction(lr_eval_string("{Order_product}"), LR_PASS);

   lr_output_message("Order porduct %s successful",(lr_eval_string("{ProductID}")));
  
   lr_end_transaction("api_sync_order", LR_PASS);

 }else{

  lr_output_message("Error: Order porduct %s Failed, Result cdoe is %s",(lr_eval_string("{ProductID}"),lr_eval_string("{Param_resultCode}")));

  lr_end_transaction("api_sync_order", LR_FAIL);
 }

    lr_think_time(1);
 return 0;
}

原文地址:https://www.cnblogs.com/wensiyang0916/p/5832337.html