51Testing软件测试论坛

 找回密码
 (注-册)加入51Testing

QQ登录

只需一步,快速开始

微信登录,快人一步

查看: 2784|回复: 1
打印 上一主题 下一主题

[原创] 获取不到服务器返回的SessionID

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2009-5-11 11:52:45 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用的是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"          [MsgId: MMSG-26000]
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          [MsgId: MMSG-26392]
Action.c(38): Warning -26593: The header being added may cause unpredictable results when applied to all ensuing URLs. It is added anyway          [MsgId: MWAR-26593]
Action.c(38): web_add_header("Content-Type") highest severity level was "warning"          [MsgId: MMSG-26391]
Ending action Action.
Error -27257: Pending web_reg_save_param/reg_find/create_html_param[_ex] request(s) detected and reset at the end of iteration number 1          [MsgId: MERR-27257]
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 编辑 ]
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
发表于 2009-5-11 17:07:20 | 只看该作者
建议设置参数 的长度, 另外把所有请求放在action()里。
不知道是什么样的结构,试试http协议吧
回复 支持 反对

使用道具 举报

本版积分规则

关闭

站长推荐上一条 /1 下一条

小黑屋|手机版|Archiver|51Testing软件测试网 ( 沪ICP备05003035号 关于我们

GMT+8, 2024-5-8 14:53 , Processed in 0.069364 second(s), 27 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

快速回复 返回顶部 返回列表