性能测试-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; }
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。