Loadrunner模拟soap/webservice请求
作者:网络转载 发布时间:[ 2015/4/24 11:13:20 ] 推荐标签:LoadRunner webservice soap
模拟请求前需要开发提供
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;
}
相关推荐
更新发布
功能测试和接口测试的区别
2023/3/23 14:23:39如何写好测试用例文档
2023/3/22 16:17:39常用的选择回归测试的方式有哪些?
2022/6/14 16:14:27测试流程中需要重点把关几个过程?
2021/10/18 15:37:44性能测试的七种方法
2021/9/17 15:19:29全链路压测优化思路
2021/9/14 15:42:25性能测试流程浅谈
2021/5/28 17:25:47常见的APP性能测试指标
2021/5/8 17:01:11