性能测试-loadrunner模拟soap/webservice请求

模拟请求前需要开发提供

1、wsdl地址

2、消息体

3、返回值

Action()
{  
int offset;
char *checkValue="ROUTING";
char *isFound;
char *strResponse;
char *strValue="(null)";
lr_think_time(10);
lr_start_transaction("GetVehicleProduct");

soap_request("StepName=SOAP Request",                                                                                                                                              "URL=https://ip:port/services/global/GetVehicleProduct/2?wsdl",                                       
"SOAPEnvelope="
"<S:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\">"
  " <S:Header>"
     " <urn:ServiceControl xmlns:urn=\"xxxx:2\">"
"<urn:EmergencyRequestIndicator>TRUE</urn:EmergencyRequestIndicator>"
         "<urn:VersionID>2.0</urn:VersionID>"
        " <urn:LanguageCode type=\"translationLocale\">zh-CN</urn:LanguageCode>"
         "<urn:CountryID>CN</urn:CountryID>"
         "<urn:ApplicationID>xx</urn:ApplicationID>"
         "<urn:LogicalID>xx-soa</urn:LogicalID>"
         "<urn:ComponentID>GetVehicleProduct</urn:ComponentID>"
         "<urn:TaskID>GetVehicleProduct</urn:TaskID>"
        " <urn:ReferenceID>111111</urn:ReferenceID>"
         "<urn:SentTimeStamp>2011-11-14T16:32:22Z</urn:SentTimeStamp>"
         "<urn:MessageType>ShowVehicleProduct</urn:MessageType>"
        " <urn:ChannelID>WEB</urn:ChannelID>"
        " <urn:Environment>4.0</urn:Environment>"
     " </urn:ServiceControl>"
     " <oas:Security xmlns:oas=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\">"
        " <oas:UsernameToken>"
           " <oas:Username>SODW_user</oas:Username>"
            "<oas:Password Type=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText\">SODW_password</oas:Password>"
         "</oas:UsernameToken>"
      "</oas:Security>"
   "</S:Header>"
   "<S:Body>"
     " <ns4:GetVehicleProduct languageCode=\"zh-CN\" releaseID=\"9.2\" systemEnvironmentCode=\"Production\" versionID=\"2.0\" xmlns:ns1=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd\" xmlns:ns10=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/Resource\" xmlns:ns11=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/Service\" xmlns:ns12=\"http://www.w3.org/2000/09/xmldsig#\" xmlns:ns13=\"urn:com:onstar:global:common:schema:GenericFault:2\" xmlns:ns14=\"http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd\" xmlns:ns15=\"urn:com:onstar:global:common:schema:ServiceControl:2\" xmlns:ns2=\"http://www.openapplications.org/oagis/9\" xmlns:ns3=\"urn:com:onstar:global:common:schema:components:2\" xmlns:ns4=\"urn:com:onstar:global:common:schema:VehicleProduct:2\" xmlns:ns5=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/Common\" xmlns:ns6=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/Enterprise\" xmlns:ns7=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/Product\" xmlns:ns8=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/MarketSales\" xmlns:ns9=\"http://www.tmforum.org/NGOSS/SID/Business/8.0/Customer\">"
         "<ns2:ApplicationArea>"
           " <ns2:Sender>"
              " <ns2:LogicalID>onslabz-soa</ns2:LogicalID>"
               "<ns2:ComponentID>String</ns2:ComponentID>"
               "<ns2:TaskID>GetVehicleProduct</ns2:TaskID>"
              " <ns2:ReferenceID>0000429599</ns2:ReferenceID>"
              " <ns2:AuthorizationID>IG</ns2:AuthorizationID>"
            "</ns2:Sender>"
            "<ns2:CreationDateTime>2011-11-14T16:31:58Z</ns2:CreationDateTime>"
        " </ns2:ApplicationArea>"
        " <ns4:DataArea>"
            "<ns2:Get>"
               "<ns2:Expression>lookupByVehicleID</ns2:Expression>"
               "<ns2:Expression>//VehicleProduct</ns2:Expression>"
           " </ns2:Get>"
            "<ns4:VehicleProduct>"
               "<ns3:ID>1</ns3:ID>"
               "<ns3:VehicleID>{VIN}</ns3:VehicleID>"
           " </ns4:VehicleProduct>"
         "</ns4:DataArea>"
     " </ns4:GetVehicleProduct>"
   "</S:Body>"
"</S:Envelope>",                                                                                                                                             
"SOAPAction=GetVehicleProduct",                                                                                                           
"ResponseParam=response",                                                                                                                          
"Snapshot=t1389317519.inf",                                                                                                                        
LAST);

strResponse
=lr_eval_string("{response}"); isFound= (char *)strstr(strResponse, checkValue); isFound=(char *)isFound; offset = (int)(isFound - strResponse + 1); if (offset>0) { lr_end_transaction("GetVehicleProduct",LR_PASS); } else { lr_end_transaction("GetVehicleProduct",LR_FAIL); lr_error_message("Vin ID is %s",lr_eval_string("{VIN}")); } return 0; }

 

转载于:https://www.cnblogs.com/focusOnPT/p/4435171.html

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值