51Testing软件测试论坛

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

QQ登录

只需一步,快速开始

微信登录,快人一步

手机号码,快捷登录

查看: 2017|回复: 3
打印 上一主题 下一主题

手动关联-LR返回XML格式文件,返回值取不到问题

[复制链接]

该用户从未签到

跳转到指定楼层
1#
发表于 2015-9-7 14:18:41 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
录制脚本时选择的是多协议: Web (HTTP/HTML), Web Services  
现在是我要从返回文件中读取数据,然后参数化
返回文件是XML格式的,代码如下
  <?xml version="1.0" encoding="utf-8" ?>
- <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns="http://www.starlims.com/webservices/" xmlns:types="http://www.starlims.com/webservices/encodedTypes" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
- <soap:Body soap:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
- <tns:RunActionResponse>
  <RunActionResult xsi:type="xsd:int">29001100</RunActionResult>
  </tns:RunActionResponse>
  </soap:Body>
  </soap:Envelope>
我要取29001100这个值,使用注册函数web_reg_save_param_ex(),LR中相关代码如下


web_reg_save_param_ex(
                "ParamName=bai",
                "LB=<RunActionResult xsi:type=\"xsd:int\">",
                "RB=",
                "NotFound=error",
                SEARCH_FILTERS,
                "Scope=ALL",
                "ContentType=text/xml",
                LAST);

        soap_request("StepName=RunAction_24",
                "URL=http://192.168.0.56/STARLIMS10.da/services/generic.asmx",
                "SOAPEnvelope="
                        "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"no\"?>"
                        "<soap:Envelope xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:types=\"http://www.starlims.com/webservices/encodedTypes\" xmlns:tns=\"http://www.starlims.com/webservices/\" xmlns:soapenc=\"http://schemas.xmlsoap.org/soap/encoding/\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                                "<soap:Body soap:encodingStyle=\"http://schemas.xmlsoap.org/soap/encoding/\">"
                                        "<tns:RunAction>"
                                                "<actionID xsi:type=\"xsd:string\">SampleLogin.AddSample</actionID>"
                                                "<parameters href=\"#id1\"></parameters>"
                                        "</tns:RunAction>"
                                        "<soapenc:Array soapenc:arrayType=\"xsd:anyType[1]\" id=\"id1\">"
                                                "<Item xsi:type=\"xsd:string\">131410015</Item>"
                                        "</soapenc:Array>"
                                "</soap:Body>"
                        "</soap:Envelope>",
                "Snapshot=t182.inf",
                "ResponseParam=response",
                LAST);

soap_request("StepName=RunAction_24",.....这个是返回我要取值的所在函数,我把注册函数放在了请求函数之前
运行脚本,一直报错,未匹配到记录
Action.c(2062): Error -35061: No match found for the requested parameter "bai". 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          [MsgId: MERR-35061]
Action.c(2062): web_url("RUNTIME_SUPPORT.GetData.lims_4") highest severity level was "ERROR", 1375 body bytes, 219 header bytes          [MsgId: MMSG-26388]

各位高手帮我看看,这个问题困扰我好几天了,多谢啦!!☆⌒(*^-゜)
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏
回复

使用道具 举报

该用户从未签到

2#
 楼主| 发表于 2015-9-7 16:49:41 | 只看该作者
已经解决了,使用LR自带的函数可以获取到
切换到TREE模式,找到返回值的那一行,右键-选择save value in parameter
生成脚本如下        lr_xml_get_values("XML={response}",
                          "FastQuery=/Envelope/Body/RunActionResponse/RunActionResult",
                          "ValueParam=a",
                          LAST);

        lr_message( "_______%@@@@@@@@@%s",
                lr_eval_string("{a}") );
回复 支持 反对

使用道具 举报

该用户从未签到

4#
 楼主| 发表于 2015-9-7 16:52:12 | 只看该作者
已经解决了,使用LR自带的函数可以获取到
切换到TREE模式,找到返回值的那一行,右键-选择save value in parameter
生成脚本如下        lr_xml_get_values("XML={response}",
                          "FastQuery=/Envelope/Body/RunActionResponse/RunActionResult",
                          "ValueParam=a",
                          LAST);

        lr_message( "_______%@@@@@@@@@%s",
                lr_eval_string("{a}") );
回复 支持 反对

使用道具 举报

本版积分规则

关闭

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

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

GMT+8, 2024-8-14 08:27 , Processed in 0.069397 second(s), 23 queries .

Powered by Discuz! X3.2

© 2001-2024 Comsenz Inc.

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