poley 发表于 2011-12-26 14:44:52

sessionid被放在了XML文件中,我如何进行关联操作?

web_custom_request("dispatchclient",
                "URL=http://192.168.10.85/dispatcher/dispatchclient",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t11.inf",
                "Mode=HTML",
                "EncType=",
                "Body=<?xml version=\"1.0\"?>\r\n<dasclient ver=\"3,2,10,15\">\r\n\t<reqhead>\r\n\t\t<sessionid>2F46CCBE198AE34E88B2B25C20C173AA</sessionid>\r\n\t\t<language>EN_US</language>\r\n\t</reqhead>\r\n\t<reqbody>\r\n\t\t<recfleetlogo uuid=\"-1\">\r\n\t\t\t<oid>11</oid>\r\n\t\t\t<updatetime>0</updatetime>\r\n\t\t</recfleetlogo>\r\n\t</reqbody>\r\n</dasclient>\r\n",
                LAST);

poley 发表于 2011-12-26 19:32:06

不会啊,参数化一直不太懂,能否帮忙写一下看看。多谢

poley 发表于 2011-12-26 19:38:51

web_reg_save_param("sid","LB=<sessionid>","RB=</sessionid>",LAST);
        web_custom_request("dispatchclient",
                "URL=http://192.168.10.85/dispatcher/dispatchclient",
                "Method=POST",
                "Resource=0",
                "RecContentType=text/html",
                "Referer=",
                "Snapshot=t11.inf",
                "Mode=HTML",
                "EncType=",
                "Body=<?xml version=\"1.0\"?>\r\n<dasclient ver=\"3,2,10,15\">\r\n\t<reqhead>\r\n\t\t<sessionid>{sid}</sessionid>\r\n\t\t<language>EN_US</language>\r\n\t</reqhead>\r\n\t<reqbody>\r\n\t\t<recfleetlogo uuid=\"-1\">\r\n\t\t\t<oid>11</oid>\r\n\t\t\t<updatetime>0</updatetime>\r\n\t\t</recfleetlogo>\r\n\t</reqbody>\r\n</dasclient>\r\n",
                LAST);
回放依旧报错:
vuser_init.c(179): Error -26631: HTTP Status-Code=400 (Bad Request) for "http://192.168.10.85/dispatcher/dispatchclient"       
vuser_init.c(179): web_custom_request("dispatchclient") highest severity level was "ERROR", 234 body bytes, 225 header bytes, 16 chunking overhead bytes       
Abort was called from an action.
到现在不知道是不是session的问题

poley 发表于 2011-12-27 10:28:18

谢谢szyszy2000 的回复,按照你的方法进行了如下设置。
我们的系统sessionid是存在Header里面的,我用了下面的方法进行了参数化,但是仍然不行。
Cookie: JSESSIONID在回放日志里面,有很多地方出现,是不是因为超出范围了,但是我用了","Ord=1",
应该取第一次出现的啊。

web_reg_save_param("sid","LB=Cookie: JSESSIONID=","RB=\r\n","Ord=1",LAST);

vuser_init.c(179): Error -26631: HTTP Status-Code=400 (Bad Request) for "http://192.168.10.85/dispatcher/dispatchclient"       
vuser_init.c(179): t=31989ms: Closing connection to server 192.168.10.85 - server indicated that the connection should be closed       
vuser_init.c(179): t=31994ms: Closed connection to 192.168.10.85:80 after completing 45 requests       
vuser_init.c(179): t=31998ms: Request done "http://192.168.10.85/dispatcher/dispatchclient"       
vuser_init.c(179): Error -26377: No match found for the requested parameter "sid". Check whether the requested boundaries exist in the response data. Also, if the data you want to save exceeds 256 bytes, use web_set_max_html_param_len to increase the parameter size       
vuser_init.c(179): Notify: Saving Parameter "sid = "
vuser_init.c(179): web_custom_request("dispatchclient") highest severity level was "ERROR", 234 body bytes, 225 header bytes, 16 chunking overhead bytes       
Abort was called from an action.

poley 发表于 2011-12-27 10:49:48

回放日志:
vuser_init.c(167):   Host: 192.168.10.85\r\n
vuser_init.c(167):   Cookie: JSESSIONID=0CC24E84400773782E81B68E7A633081\r\n
vuser_init.c(167):   Content-Length: 0\r\n
vuser_init.c(167):   \r\n
参数化:
web_reg_save_param("sid","LB/IC=Cookie: JSESSIONID=","RB/IC=\r\n","Ord=1",LAST)

lr_log_message("getvalue : %s",web_reg_save_param("sid","LB/IC=Cookie: JSESSIONID=","RB/IC=\r\n","Ord=1",LAST));
打印日志:
getvalue =null

就是说,我并没有取到sessionid,这个是为什么啊???

poley 发表于 2011-12-27 16:38:29

研究了一天我靠,发现
web_reg_save_param()
这个函数要写在
web_submit_data()的前面
通过:lr_output_message("the jsessionid is: %s", lr_eval_string("{sid}"));
可以看到取的值。
一定要注意3个函数的顺序,汗。。。
页: [1]
查看完整版本: sessionid被放在了XML文件中,我如何进行关联操作?