LR关联右边界添加之后无法匹配报错-26377解决办法,截取关联的部分参数办法。
1 Action() 2 { 3 //定义接口url 4 char *interface_url; 5 char errorMeg; 6 int strlen = 39;//定义从第39位开始截字符 7 8 lr_save_string( "http://192.168.2.99:80/client/v3/login","login_url" );//登录地址 9 lr_save_string( "http://192.168.2.99:80/client/v3/strategy/application/","getUserApp_url" );//获取用户应用 10 lr_save_string( "http://192.168.2.99:80/client/v3/strategy/configuration/", "getUserOpt_url" );//获取用户功能配置 11 lr_save_string( "http://192.168.2.99:80/client/v3/swa/","WSAOpt_url" );//获取用户功能配置 12 13 14 web_set_max_html_param_len("2048"); //关联函数报错-26377解决办法 15 /** 16 *Error -26377: No match found for the requested parameter "access_token". 17 *Check whether the requested boundaries exist in the response data. 18 * 19 *Also, if the data you want to save exceeds 256 bytes, use 20 *web_set_max_html_param_len to increase the parameter size 21 * 22 */ 23 24 web_reg_save_param("token", 25 "LB=\"sso\":{},\"token\":", 26 "RB=", 27 LAST); 28 29 web_reg_save_param("access_token", 30 "LB=\"access_token\":\"", 31 "RB=\",\"", 32 LAST); 33 34 35 web_reg_find("Text=\"errCode\":\"0\"", 36 "SaveCount=check", 37 LAST); 38 39 40 web_reg_save_param("activeId", 41 "LB=\"activeId\":\"", 42 "RB=\"},\"sso", 43 LAST); 44 45 web_reg_save_param("userid", 46 "LB=\"user\":{\"id\":\"", 47 "RB=\",\"departmentId", 48 LAST); 49 50 //--------------------------------用户登录-------------------- 51 52 //lr_rendezvous("login"); 53 54 lr_think_time(30); 55 56 lr_start_transaction("用户登录"); 57 58 web_custom_request("login", 59 "URL={login_url}", 60 "Method=POST", 61 "Resource=0", 62 "Referer=", 63 "Mode=HTML", 64 "EncType=application/x-www-form-urlencoded; charset=UTF-8", 65 "Body=domainName={domainName}&loginName={loginName}&password={password}&deviceInfo={\"appVersion\": \"3.0.34\",\"deviceId\": \"{deviceID}\", \"systemVersion\": \"Windows 7\", \"model\": \"ASUS_All Series\", \"architecture\": \"64\",\"platform\": \"1 \" }", 66 LAST); 67 68 if (atoi(lr_eval_string("{check}"))>0) 69 { 70 71 lr_end_transaction("用户登录", LR_PASS); 72 } 73 else 74 { 75 lr_end_transaction("用户登录", LR_FAIL); 76 } 77 78 lr_think_time(10); 79 //--------------------------------获取用户应用-------------------- 80 lr_save_var( lr_eval_string("{token}") + strlen, 341, 0, "tokena" ); 81 //截取字符 82 //取得登录后的token 83 84 lr_message( "tokena: %s", 85 lr_eval_string("{tokena}") ); 86 87 88 89 90 web_reg_find("Text=\"errCode\":\"0\"", 91 "SaveCount=check", 92 LAST); 93 94 95 web_add_header("access-token", 96 "{access_token}"); 97 98 lr_start_transaction("获取用户应用"); 99 100 web_url("getUserApp", 101 "URL={getUserApp_url}{activeId}", 102 "Resource=0", 103 "RecContentType=text/html", 104 "Referer=", 105 LAST); 106 107 if (atoi(lr_eval_string("{check}"))>0) 108 { 109 110 lr_end_transaction("获取用户应用", LR_PASS); 111 } 112 else 113 { 114 lr_end_transaction("获取用户应用", LR_FAIL); 115 } 116 117 118 lr_think_time(10); 119 //--------------------------------获取用户功能配置-------------------- 120 121 122 web_reg_find("Text=\"errCode\":\"0\"", 123 "SaveCount=check", 124 LAST); 125 126 127 128 web_add_header("access-token", 129 "{access_token}"); 130 lr_start_transaction("获取用户功能配置"); 131 132 133 134 web_url("getUserOpt", 135 "URL={getUserOpt_url}{userid}/{activeId}", 136 "Resource=0", 137 "RecContentType=text/html", 138 "Referer=", 139 LAST); 140 141 if (atoi(lr_eval_string("{check}"))>0) 142 { 143 144 lr_end_transaction("获取用户功能配置", LR_PASS); 145 } 146 else 147 { 148 lr_end_transaction("获取用户功能配置", LR_FAIL); 149 } 150 151 //--------------------------------获取用户的SWA配置-------------------- 152 153 154 web_reg_find("Text=\"errCode\":\"0\"", 155 "SaveCount=check", 156 LAST); 157 158 159 160 web_add_header("access-token", 161 "{access_token}"); 162 lr_start_transaction("获取用户的SWA配置"); 163 164 165 166 web_url("WSAOpt_url", 167 "URL={WSAOpt_url}{userid}/{activeId}", 168 "Resource=0", 169 "RecContentType=text/html", 170 "Referer=", 171 LAST); 172 173 if (atoi(lr_eval_string("{check}"))>0) 174 { 175 176 lr_end_transaction("获取用户的SWA配置", LR_PASS); 177 } 178 else 179 { 180 lr_end_transaction("获取用户的SWA配置", LR_FAIL); 181 } 182 183 184 185 return 0; 186 }
1.LR关联右边界添加之后无法匹配报错-26377解决办法
主要表现在报错-26377提示,一般98%是关联的问题,但在关联没有任何问题仍然报错,可以考虑是此问题导致。
web_set_max_html_param_len("2048"); //关联函数报错-26377解决办法
2.截取关联的部分参数办法。
int lr_save_var( const char *param_value, unsigned long const value_len, unsigned long const options, const char *param_name);
"{token}":字符串
+strlen :截取从第几位开始
341:截取长度
0:从几位计数
"tokena":另存为的参数名称。
lr_save_var( lr_eval_string("{token}") + strlen, 341, 0, "tokena" );

浙公网安备 33010602011771号