首页 > 代码库 > Loadrunner test web service which need username and password

Loadrunner test web service which need username and password

Action()
{

 char  * position;
 char * str;

 int  offset;
 char * search_str = "ERROR";

   // web_set_sockets_option("INITIAL_BASIC_AUTH","1");
   
    web_set_user("21652362","zxcv!123","g1u2367.austin.hp.com:8020");

 

 lr_start_transaction("MPO_LP");

 soap_request("StepName=SOAP Request",          
  //"URL=http://g1u2367.austin.hp.com:8020/sap/bc/srt/rfc/sap/ZMPO_LP?sap-client=445",          
  "URL=http://g1u2367.austin.hp.com:8020/sap/bc/srt/rfc/sap/ZMPO_LP?sap-client=445&wsdl=1.1",
  "SOAPEnvelope="
  "<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:urn=\"urn:sap-com:document:sap:soap:functions:mc-style\">"
   "<soapenv:Header></soapenv:Header>"
   "<soapenv:Body>"
    "<urn:Z9pMpoPriceRfc>"
     "<PriceRecord>"
      "<item>"
       "<Product>{Product}</Product>"
       "<ProdOption></ProdOption>"
       "<PriceGeo>{PriceGeo}</PriceGeo>"
       "<Currency>USD</Currency>"
       "<PriceListType></PriceListType>"
       "<Incoterm>DDP</Incoterm>"
       "<EndDate>2014-12-31</EndDate>"
       "<StartQuantity>1</StartQuantity>"
       "<StartDate>2014-08-30</StartDate>"
       "<Amount>50</Amount>"
       "<Uom>EA</Uom>"
       "<ScaleFlag></ScaleFlag>"
       "<DeleteFlag></DeleteFlag>"
       "<PrsPubStPk>{PrsPubStPk}</PrsPubStPk>"
      "</item>"
     "</PriceRecord>"
    "</urn:Z9pMpoPriceRfc>"
   "</soapenv:Body>"
  "</soapenv:Envelope>",          
  "SOAPAction=SendbyMPO",          
  "ResponseParam=response",          
  "Snapshot=t1409203819.inf",            
  LAST);

 


 str= lr_eval_string("{response}");

 position = (char *)strstr(str, search_str);

 if (position == NULL) {
  lr_end_transaction("MPO_LP", LR_PASS);
 }
 else
  lr_end_transaction("MPO_LP", LR_FAIL);


    lr_message ("*****************");

 lr_message ("message returned as: %s", lr_eval_string("{response}"));

 lr_message ("*****************");

 return 0;
}

 

Loadrunner test web service which need username and password