Search code examples
loadrunner

how can i use web_reg_save_param when LoadRunner protocol is C Vuser?


I use LoadRunner 11, and need send some web_custom_request. I start with a C Vuser protocol because i need some c lib(MD5). When i replay, i meet the error below: vuser_init.c(24): Error: C interpreter run time error: vuser_init.c (24): Error -- Unresolved symbol : web_reg_save_param.

How can i use web_reg_save_param when i select C Vuser protocol? How can i make LoadRunner recognize web_reg_save_param when the protocol is C Vuser?

Thanks a lot.

My code is :

vuser_init()
{   
char *digest;
char jsonBody[500];
char jsonBodyFirst[500];
char *key = "3KJBI23U923B8W0NF8WB29B98DAYP9AUBI2UQPF98AF9ABEWFPAOINOANSFPOAIN";

strcpy(jsonBodyFirst, lr_eval_string("{\"channelId\":\"2\",\"loginType\":\"2\",\"userId\":\"{loginMobile}\",\"password\":\"GGDSuDK6SlEidji9\\/BtPlQ==\",\"osName\":\"Android\",\"deviceNo\":\"865982027651010\",\"clientVersion\":\"1.0.3\",\"osVersion\":\"6.0.1\",\"deviceModel\":\"MI NOTE LTE\",\"imsi\":\"460008011671383\""));        

strcpy(jsonBody, jsonBodyFirst);        
strcat(jsonBody,"}");
digest = (char *)hmac_md5(jsonBody, key);

memset(jsonBody,0,sizeof(jsonBody));
sprintf(jsonBody, "Body=%s,\"digest\":\"%s\"}", jsonBodyFirst, digest);

web_reg_save_param("jsessionid",
                   "LB/IC=JSESSIONID=",
                   "RB/IC=;",
                   "LAST");

web_custom_request("autoLogin",
                   "Method=POST",
                   "Mode=HTML",
                   "EncType=application/json",
                   "URL=https://testsys.szsharelink.com:8443/service/autoLogin.app",
                   jsonBody,
                   "LAST");

return 0;

}


Solution

  • web_reg_save_param is specific to the Web virtual user. When you run a C virtual user you do not have access to the functions for the web specific protocol virtual user.

    However, you may run a web virtual user, which by default uses the ANSI C language. In such a case you can incorporate any C code you wish and still have access to the web virtual user specific functions.