hy286 发表于 2009-5-11 11:52:45

获取不到服务器返回的SessionID

用的是LoadRunner9.0,协议采用的是Web Services,测试时导入了相应的wsdl文件
脚本如下,灰色部分为次要内容,只是为了方便看得更清楚
   web_add_auto_header("User-Agent", "Mozilla/4.0 (compatible; MSIE 6.0; MS Web Services Client Protocol 2.0.50727.42)");
    web_add_header("Content-Type", "text/xml; charset=utf-8");
    web_add_header("SOAPAction", "\"xjuuaclientAppLogin\"");
   
    web_reg_save_param("RETURNSESSIONID",
                                        "LB=<xjuuaclientAppLoginReturn>",
                                        "RB=</xjuuaclientAppLoginReturn>",
                                        "ORD=1",
                                        LAST);

    soap_request("StepName=xjuuaclientAppLogin",
                "URL=http://10.72.27.102:9080/IntegrationKMService/services/"
                "IntegrationModelServiceImpl",
                "SOAPEnvelope=<?xml version=\"1.0\" encoding=\"US-ASCII\" standalone=\""
                "no\"?><soap:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" "
                "xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:soap=\""
                "http://schemas.xmlsoap.org/soap/envelope/\"><soap:Body>"
                "<xjuuaclientAppLogin xmlns=\"http://"
                "integration.webservice.petrochina.com\"><userName xmlns=\"\">hy22</"
                "userName><userPass xmlns=\"\">981286</userPass><ipAddress xmlns=\"\""
                ">10.72.27.29</ipAddress><processFlag xmlns=\"\">2009-05-04 18:14:49 "
                "890</processFlag></xjuuaclientAppLogin></soap:Body></soap:Envelope>",
                "Snapshot=t2.inf",
                "ResponseParam=response",
                LAST);
   lr_log_message("getvalue : %s",lr_eval_string("{RETURNSESSIONID}"));
web_add_auto_header("SOAPAction", "\"writeOperationLog\"");
   web_add_header("Content-Type", "text/xml; charset=utf-8");
   return 0;

RETURNSESSIONID参数化时,参数类型选为File

日志中返回结果如下

Action.c(16): t=2619ms: 183-byte response headers for "http://10.72.27.102:9080/IntegrationKMService/services/IntegrationModelServiceImpl" (RelFrameId=1, Internal ID=1)
Action.c(16):   HTTP/1.1 200 OK\r\n
Action.c(16):   Content-Type: text/xml; charset=utf-8\r\n
Action.c(16):   Content-Language: zh-CN\r\n
Action.c(16):   Content-Length: 507\r\n
Action.c(16):   Date: Thu, 07 May 2009 04:15:22 GMT\r\n
Action.c(16):   Server: WebSphere Application Server/6.1\r\n
Action.c(16):   \r\n
Action.c(16): t=2667ms: 507-byte response body for "http://10.72.27.102:9080/IntegrationKMService/services/IntegrationModelServiceImpl" (RelFrameId=1, Internal ID=1)
Action.c(16):   <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc=
Action.c(16):   "http://schemas.xmlsoap.org/soap/encoding/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" x
Action.c(16):   mlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><p927:
Action.c(16):   xjuuaclientAppLoginResponse xmlns:p927="http://integration.webservice.petrochina.com"><xju
Action.c(16):   uaclientAppLoginReturn>136133920090507$10143688545</xjuuaclientAppLoginReturn></p927:xjuua
Action.c(16):   clientAppLoginResponse></soapenv:Body></soapenv:Envelope>
Action.c(16): t=2709ms: Request done "http://10.72.27.102:9080/IntegrationKMService/services/IntegrationModelServiceImpl"         
Action.c(16): SOAP request "xjuuaclientAppLogin" was successful
Action.c(34): Notify: Parameter Substitution: parameter "RETURNSESSIONID" =""
getvalue : Value
Action.c(36): web_add_auto_header("SOAPAction") was successful         
Action.c(38): Warning -26593: The header being added may cause unpredictable results when applied to all ensuing URLs. It is added anyway         
Action.c(38): web_add_header("Content-Type") highest severity level was "warning"         
Ending action Action.
Error -27257: Pending web_reg_save_param/reg_find/create_html_param request(s) detected and reset at the end of iteration number 1         
Action was aborted.
Ending Vuser...
Starting action vuser_end.
Ending action vuser_end.
Vuser Terminated.

在日志中可以看到返回的SessionID为136133920090507$10143688545,但RETURNSESSIONID参数却读不到这个数据,而且出错后也不允许进行多次迭代了,不知道问题出在哪里?
各位帮忙看看吧。

[ 本帖最后由 hy286 于 2009-5-11 13:29 编辑 ]

creatysun 发表于 2009-5-11 17:07:20

建议设置参数 的长度, 另外把所有请求放在action()里。
不知道是什么样的结构,试试http协议吧:)
页: [1]
查看完整版本: 获取不到服务器返回的SessionID