1、订购套餐
Action()
{
lr_start_transaction("subscribeProduct");
web_add_header("Content-Type","text/xml; charset=utf-8");
web_add_header("User-Agent", "gSOAP/2.7");
web_add_header("Host","localhost");
web_add_header("SOAPAction","\"\"");
//web_reg_find("Text=result", "SaveCount=ResultCount",LAST);
// web_reg_find("Text=result",LAST);
web_reg_find("Text=<ns1:errorCode>","SaveCount=para_count", LAST);
// web_reg_save_param("result_str","LB=<ns1:errorCode>","RB=</ns1:errorCode>","Notfound=warning",LAST);
// lr_error_message("result_str");
web_custom_request("subscribeProduct",
"URL=http://172.16.31.109:18080/bme/services/CCEngineService",
"Method=POST",
"Resource=0",
"Referer=",
"Mode=HTTP",
"Body=<?xml version='1.0' encoding='UTF-8'?>"
"<soapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://service.soap.ccengine.mdsp.huawei.com\" xmlns:xsd=\"http://struct.soap.ccengine.mdsp.huawei.com/xsd\">\r\n"
"<soapenv:Header/>\r\n"
"<soapenv:Body>\r\n"
"<ser:in7>\r\n"
"<xsd:version>11</xsd:version>\r\n"
"<xsd:transactionID>111</xsd:transactionID>\r\n"
"<xsd:extensionInfo>\r\n"
"<xsd:namedParameters>\r\n"
"<!--Zero or more repetitions:-->\r\n"
"<ser:item>\r\n"
"<xsd:key>channelnum</xsd:key>\r\n"
"<xsd:value>12046000</xsd:value>\r\n"
"</ser:item>\r\n"
"</xsd:namedParameters>\r\n"
"</xsd:extensionInfo>\r\n"
"<xsd:channelID>0</xsd:channelID>\r\n"
"<xsd:subInfo>\r\n"
"<xsd:channelID>1</xsd:channelID>\r\n"
"<xsd:productID>802000040376</xsd:productID>\r\n"
"<xsd:isAutoExtend>0</xsd:isAutoExtend>\r\n"
"<xsd:extensionInfo>\r\n"
"<xsd:namedParameters>\r\n"
"<!--Zero or more repetitions:-->\r\n"
"<ser:item>\r\n"
"<xsd:key>1</xsd:key>\r\n"
"<xsd:value>0</xsd:value>\r\n"
"</ser:item>\r\n"
"</xsd:namedParameters>\r\n"
"</xsd:extensionInfo>\r\n"
"<xsd:operCode>0</xsd:operCode>\r\n"
"</xsd:subInfo>\r\n"
"<xsd:userID>\r\n"
"<xsd:ID>86157014{id}</xsd:ID>\r\n"
"<xsd:type>0</xsd:type>\r\n"
"</xsd:userID>\r\n"
"</ser:in7>\r\n"
"</soapenv:Body>\r\n"
"</soapenv:Envelope>\r\n",
LAST);
//if (strcmp(1,lr_eval_string("{para_count}"))!=0)
if (atoi(lr_eval_string("{para_count}")) > 0)
{
lr_end_transaction("subscribeProduct", LR_FAIL);
}
else
{
lr_end_transaction("subscribeProduct", LR_PASS);
}
return 0;
}
2、价格批价
Action()
{
lr_start_transaction("getAdvicePrice");
web_add_header("Content-Type","text/xml; charset=utf-8");
web_add_header("User-Agent", "gSOAP/2.7");
web_add_header("Host","localhost");
web_add_header("SOAPAction","\"\"");
//web_reg_find("Text=result", "SaveCount=ResultCount",LAST);
// web_reg_find("Text=result",LAST);
// web_reg_find("Text=<ns1:errorCode>","SaveCount=para_count", LAST);
// <resultCode xsi:type="xsd:int">200000</resultCode>
web_reg_save_param("result_str","LB=<resultCode xsi:type=\"xsd:int\">","RB=</resultCode>",LAST);
// web_reg_save_param("result_str","LB=<ns1:errorCode>","RB=</ns1:errorCode>","Notfound=warning",LAST);
// lr_error_message("result_str");
web_custom_request("getAdvicePrice",
"URL=http://172.16.31.117:8082/portalone/services/PortalService",
"Method=POST",
"Resource=0",
"Referer=",
"Mode=HTTP",
"Body=<soapenv:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:ser=\"http://service.storefront.portalone.huawei.com\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
"<soapenv:Header/>\r\n"
"<soapenv:Body>\r\n"
"<ser:getAdvicePrice soapenv:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">\r\n"
"<advicePriceReq xsi:type=\"req:AdvicePriceReq\" xmlns:req=\"http://request.service.storefront.portalone.huawei.com\">\r\n"
"<accessChannelID xsi:type=\"xsd:string\">0</accessChannelID>\r\n"
"<countryCode xsi:type=\"xsd:string\">86</countryCode>\r\n"
"<deviceID xsi:type=\"xsd:string\">9990001</deviceID>\r\n"
"<language xsi:type=\"xsd:string\">zh_CN</language>\r\n"
"<security xsi:type=\"xsd:string\">cdf+SaiyXS+2NLK7Rp678ZNaiCHZDpnQ9fB0pmbJgAk=</security>\r\n"
"<timestamp xsi:type=\"xsd:string\">20110415152000</timestamp>\r\n"
"<userID xsi:type=\"xsd:string\">15701{user}</userID>\r\n"
"<adviceType xsi:type=\"xsd:string\">1</adviceType>\r\n"
"<consumeCode xsi:type=\"xsd:string\">000068527011</consumeCode>\r\n"
"<contentCode xsi:type=\"xsd:string\">000068527000</contentCode>\r\n"
"<extensionInfo xsi:type=\"ser:ArrayOf_tns2_NamedParameter\" soapenc:arrayType=\"bean:NamedParameter[]\" xmlns:bean=\"http://bean.service.storefront.portalone.huawei.com\"/>\r\n"
"<packageId xsi:type=\"xsd:string\"></packageId>\r\n"
"<saleChannelId xsi:type=\"xsd:string\">12046000</saleChannelId>\r\n"
"<serviceId xsi:type=\"xsd:string\">760000009544</serviceId>\r\n"
"<source xsi:type=\"xsd:string\">5</source>\r\n"
"<spId xsi:type=\"xsd:string\">741298</spId>\r\n"
"<userIDType xsi:type=\"xsd:string\">1</userIDType>\r\n"
"</advicePriceReq>\r\n"
"</ser:getAdvicePrice>\r\n"
"</soapenv:Body>\r\n"
"</soapenv:Envelope>\r\n",LAST);
//if (strcmp(1,lr_eval_string("{para_count}"))!=0)
// if (atoi(lr_eval_string("{para_count}")) > 0)
if(strcmp(lr_eval_string("{result_str}"), "200000") == 0)
{
lr_end_transaction("getAdvicePrice", LR_PASS);
}
else
{
lr_end_transaction("getAdvicePrice", LR_FAIL);
}
return 0;
}
3、安全计费
Action()
{
web_add_header("x-wap-profile","http://www.huawei.com");
web_add_header("User-Agent","NokiaN95");
//web_add_header("LogTransId","12345678{date}{NewParam}");
web_add_header("SOAPAction","\"\"");
//web_reg_save_param("result_str","LB=<resultCode xsi:type=\"xsd:int\">","RB=</resultCode>",LAST);
web_reg_save_param("result_str","LB=<status>","RB=</status>",LAST);
//lr_rendezvous("securityCharge");
lr_start_transaction("securityCharge");
web_custom_request("securityCharge",
"URL=http://172.16.31.104:8080/portalone/sportal/securityCharge",
//"URL=http://172.16.31.106:8082/portalone/sportal/securityCharge",
//"URL=http://172.16.31.106:9050/portalone/sportal/securityCharge",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
"EncType=text/xml; charset=utf-8",
"Body="
"<?xml version=\"1.0\" encoding=\"UTF-8\" ?>\r\n"
"<SecurityChargeReq>\r\n"
"<req>ProtocolNum=00&feeType=28&SDKVersion=22101&cpparam=0000000000000000&ms=15298511724&cpid=710386&cid=638616020084&chargeid=006049489001&chid=40390000&pakId=00000000000&loginUserId=&dId=123456789&chargepolicy=1&apkstatus=0&vcode=0000&packer=0&sessionId=000000&SDKSessionID=243456789011&IMSI=243456789012&packer=</req>\r\n"
"<ms>{num}</ms>\r\n"
"<accessType>1</accessType>\r\n"
"<gameType>6</gameType>\r\n"
//"<tokenMs>0</tokenMs>\r\n"
"<command></command>\r\n"
"</SecurityChargeReq>\r\n",LAST);
if(strcmp(lr_eval_string("{result_str}"), "200000") == 0)
{
lr_end_transaction("securityCharge", LR_PASS);
}
else
{
lr_end_transaction("securityCharge", LR_FAIL);
}
return 0;
}
4、点数充值
Action()
{
lr_start_transaction("getDiscountTips");
web_add_header("Content-Type","text/xml; charset=utf-8");
web_add_header("User-Agent", "gSOAP/2.7");
web_add_header("Host","localhost");
web_add_header("SOAPAction","\"\"");
//web_reg_find("Text=result", "SaveCount=ResultCount",LAST);
// web_reg_find("Text=result",LAST);
web_reg_find("Text=<ns1:errorCode>","SaveCount=para_count", LAST);
// web_reg_save_param("result_str","LB=<ns1:errorCode>","RB=</ns1:errorCode>","Notfound=warning",LAST);
// lr_error_message("result_str");
web_custom_request("getDiscountTips",
"URL=http://172.16.31.103:11111/most/rpc/chargeTips/getDiscountTips",
"Method=POST",
"Resource=0",
"Referer=",
"Mode=HTTP",
"EncType=application/xml",
"Body=<Request>\n"
"<traceUniqueID>1111111111111111111111{uniqueid}</traceUniqueID>\n"
"<chargeInfo>\n"
"<type>1</type>\n"
"<propertyFeeCode>006117473001</propertyFeeCode>\n"
"<contentCode>006117473000</contentCode>\n"
"<basePrice>300</basePrice>\n"
"<paidPrice>24</paidPrice>\n"
"<rechargePoint>300</rechargePoint>\n"
"<discountId></discountId>\n"
"<promotionId>2735</promotionId>\n"
"</chargeInfo>\n"
"</Request>",
LAST);
if (atoi(lr_eval_string("{para_count}")) > 0)
{
lr_end_transaction("getDiscountTips", LR_FAIL);
}
else
{
lr_end_transaction("getDiscountTips", LR_PASS);
}
return 0;
}
5、阳光计费
Action()
{
web_add_header("x-wap-profile","http://www.huawei.com");
web_add_header("User-Agent","NokiaN95");
//web_add_header("LogTransId","12345678{date}{num}");
web_add_header("SOAPAction","\"\"");
//web_reg_save_param("result_str","LB=<resultCode xsi:type=\"xsd:int\">","RB=</resultCode>",LAST);
web_reg_save_param("result_str","LB=<ResultCode>","RB=</ResultCode>",LAST);
//lr_rendezvous("securityCharge");
lr_start_transaction("ChargeBuy");
web_custom_request("ChargeBuy",
//"URL=http://172.16.31.104:8080/portalone/sportal/securityCharge",
"URL=http://172.16.31.117:8082/portalone/ChargeBuy",
//"URL=http://172.16.31.106:9050/portalone/sportal/securityCharge",
"Method=POST",
"Resource=0",
"RecContentType=text/xml",
"Referer=",
"Snapshot=t1.inf",
"Mode=HTML",
"EncType=text/xml; charset=utf-8",
"Body="
"<ChargeRequest>\r\n"
"<Header>\r\n"
"<MsgType></MsgType>\r\n"
"<ActionCode>0</ActionCode>\r\n"
"<TransactionID>1122334</TransactionID>\r\n"
"<Version>1223</Version>\r\n"
"<ProcessTime>20160119111201</ProcessTime>\r\n"
"</Header>\r\n"
"<Body>\r\n"
"<ORDER_ID>0301606060943244820000</ORDER_ID>\r\n"
"<PHONENUMBER>{num}</PHONENUMBER>\r\n"
"<REQUESTTIME>20160414140416</REQUESTTIME>\r\n"
"<VasType>3</VasType>\r\n"
"<CPCode>710386</CPCode>\r\n"
"<Amount>10</Amount>\r\n"
"<BillFlag>1</BillFlag>\r\n"
"<itemId>006049489001</itemId>\r\n"
"<reservedParam>638616020084,40390000,123</reservedParam>\r\n"
//"<reservedParam>638616020084,40390000,123,{num},70</reservedParam>\r\n"
"<SettleDate>20160414</SettleDate>\r\n"
"<ContentID>006049489000</ContentID>\r\n"
"<ChannelId>40007825232</ChannelId>\r\n"
"<extendAttr>we2fdsf</extendAttr>\r\n"
"</Body>\r\n"
"</ChargeRequest>\r\n",LAST);
if(strcmp(lr_eval_string("{result_str}"), "00000") == 0)
{
lr_end_transaction("ChargeBuy", LR_PASS);
}
else
{
lr_end_transaction("ChargeBuy", LR_FAIL);
}
return 0;
}
本文详细介绍了五种计费系统接口的测试脚本,包括订购套餐、价格批价、安全计费、点数充值和阳光计费的具体实现过程。通过定制的HTTP请求和SOAP消息,这些脚本验证了系统的响应和错误处理能力。
275

被折叠的 条评论
为什么被折叠?



