关于LR录制json报文请求的问题
本帖最后由 aspir1313 于 2011-3-25 16:46 编辑vuser_init 中的脚本:
#include "lrs.h"
#include "lrun.h"
#include "web_api.h"
#include "lrw_custom_body.h"
vuser_init()
{
lrs_startup(257);
return 0;
}
Action 中的脚本:
#include "lrs.h"
int rc;
long file;
char *filename = "D:\\logfile.txt";
Action()
{
web_custom_request("IPPUSH_SETTING",
"Method=POST",
"URL=http://192.168.21.75/gegwi//PushServlet",
"RecContentType=application/x-www-form-urlencoded;charset=UTF-8",
"EncType=application/x-www-form-urlencoded;charset=UTF-8",
"Mode=HTML",
RAW_BODY_START,
"{\"result\":\"0\",\"ippush_setting\":{\"ippush_port\":\"5333\",\"ippush_name\":\"13911853854\",\"ippush_ip\":\"192.168.0.114\",\"apn\":\"cmwap\",\"ippush_password\":\"13911853854\"},\"business_setting\":[{\"ippush_proxy_ip\":\"192.168.0.2\",\"ippush_proxy_port\":\"1080\",\"cmpop_port\":\"18110\",\"password\":\"1429\",\"account_status\":\"C\",\"cmpop_ip\":\"218.200.243.234\",\"businessid\":\"MIG_MIG\",\"cmsmtp_port\":\"18025\",\"cmsmtp_ip\":\"218.200.243.234\",\"ippush_proxy_name\":\"test\",\"email\":\"13611093072@139.com\",\"ippush_proxy_pwd\":\"12345\",\"cellphone\":\"13911853854\",\"apn\":\"cmwap\"}]}",
610,
RAW_BODY_END,
LAST);
return 0;
}
vuser_end 中的脚本:
#include "lrs.h"
#include "lrun.h"
#include "web_api.h"
#include "lrw_custom_body.h"
vuser_end()
{
lrs_cleanup();
return 0;
}
data.ws 中的脚本:
;WSRData 2 1
sendbuf0 1000
"POST /gegwi/PushServlet HTTP/1.1\r\n"
"Content-type: application/x-www-form-urlencoded;charset=UTF-8\r\n"
"X-PUSH-USER-AGENT: 1.2.1\r\n"
"x-up-calling-line-id: 13911853854\r\n"
"X-PUSH-METHOD: push-setting\r\n"
"Cache-Control: no-cache\r\n"
"Pragma: no-cache\r\n"
"User-Agent: Java/1.6.0_20\r\n"
"Host: localhost:80\r\n"
"Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2\r\n"
"Connection: keep-alive\r\n"
"Content-Length: 24\r\n"
"\r\n"
"{\"businessid\":\"MIG_MIG\"}{\"result\":\"0\",\"ippush_setting\":{\"ippush_port\":\"5333\",\"ippush_name\":\"13911853854\",\"ippush_ip\":\"192.168.0.114\",\"apn\":\"cmwap\",\"ippush_password\":\"13911853854\"},\"business_setting\":[{\"ippush_proxy_ip\":\"192.168.0.2\",\"ippush_proxy_port\":\"1080\",\"cmpop_port\":\"18110\",\"password\":\"1429\",\"account_status\":\"C\",\"cmpop_ip\":\"218.200.243.234\",\"businessid\":\"MIG_MIG\",\"cmsmtp_port\":\"18025\",\"cmsmtp_ip\":\"218.200.243.234\",\"ippush_proxy_name\":\"test\",\"email\":\"13611093072@139.com\",\"ippush_proxy_pwd\":\"12345\",\"cellphone\":\"13911853854\",\"apn\":\"cmwap\"}]}",
"\r\n"
recvbuf1 218
"HTTP/1.1 200 OK\r\n"
"Server: Apache-Coyote/1.1\r\n"
"X-Powered-By: Servlet 2.4; JBoss-4.3.0.GA_CP02 (build: SVNTag=JBPAPP_4_3_0"
"_GA_CP02 date=200808051050)/JBossWeb-2.0\r\n"
"Content-Length: 0\r\n"
"Date: Wed, 09 Mar 2011 06:40:39 GMT\r\n"
"\r\n"
-1
编译没有错误。
但是执行脚本时出现:
虚拟用户脚本已启动
正在开始操作 vuser_init。
vuser_init.c(19): lrs_startup(257)
正在结束操作 vuser_init。
正在运行 Vuser...
正在开始迭代 1。
正在开始操作 Action。
Action.c(12): 错误: C interpreter run time error: Action.c (12):Error -- Unresolved symbol : web_custom_request.
Action.c(12): 通知: CCI 跟踪: Compiled_code(0): Action()
.
操作已中止。
正在结束 Vuser...
正在开始操作 vuser_end。
vuser_end.c(17): lrs_cleanup()
正在结束操作 vuser_end。
Vuser 已终止。
请哪位高人给指点一下。不胜感激。谢谢 自己顶一下。开发就给一个json的报文,但是不知道该怎么用LR进行请求给服务器。很是郁闷。望高手指点 顶上去! 继续 继续 就是这么倔! 同问,绑定了,求高手解答
页:
[1]