//实战代码如下所示:
Action()
{
lr_start_transaction("事物");
// 断言内容:processcode":"0000","processdes:"处理成功"
web_reg_save_param("processcode",
"NotFound=warning",
"LB=processcode\":\"",
"RB=\",\"processdes",
"Ord=1",
"Search=Body",
LAST);
web_reg_save_param("processdes",
"NotFound=warning",
"LB=processdes\":\"",
"RB=\",\"checkresult",
"Ord=1",
"Search=Body",
LAST);
//接口1:发送指定key:value参数的json报文
web_submit_data("request",
"Action=http://IP:port/sss/idCardCheck11",
"Method=POST",
"Mode=HTTP",
"RecContentType=application/json",
ITEMDATA,
"Name=msgbody", "Value={\"app_sign\":\"287cca63e9316c031\",\"businesscode\":\"05\","
"\"note\":\"\",\"brnchcd\":\"4001\",\"b64pic\":\"\",\"inputtype\":\"11\",\"teller\":\"2666\","
"\"idcardno\":\"139891119211X\",\"name\":\"user\",\"wthrespic\":\"1\",\"app_id\":null,"
"\"bankcode\":\"31100396\",\"timestamp\":\"1536118078193\"}", ENDITEM,
LAST);
//接口2:发送json格式报文
web_custom_request("request",
"Url=http://IP:port/sss/idCardCheck11",
"Method=POST",
"Mode=HTTP",
"EncType=application/json",
"RecContentType=application/json",
"Body={\"app_sign\":\"287cca63e9316c031\",\"businesscode\":\"05\",\"note\":\"\",\"brnchcd\":\"4001\","
"\"b64pic\":\"\",\"inputtype\":\"11\",\"teller\":\"2666\",\"idcardno\":\"139891119211X\","\"name\":"
"\"user\",\"wthrespic\":\"1\",\"app_id\":null,\"bankcode\":\"31100396\",\"timestamp\":\"1536118078193\"}",
LAST);
//响应报文key值和预期结果比较,如果等于0则请求处理成功
if(strcmp(lr_eval_string("{processcode}"),"0000") == 0){
lr_end_transaction("事物", LR_PASS);
}else{
lr_end_transaction("事物", LR_FAIL);
//事物失败后打印processdes字段的值,也就是错误信息,但是LR打印出来的中文出现乱码,所以这里做了转码的操作
lr_convert_string_encoding(lr_eval_string("{processdes}"),LR_ENC_UTF8,LR_ENC_SYSTEM_LOCALE,"resultMsg");
//解码后返回单笔核对请求处理成功
lr_error_message("错误信息:%s",lr_eval_string("{resultMsg}"));
}
// lr_end_transaction("事物",LR_AUTO);
return 0;
}