Web Services类型请求中替换XML格式的节点值的方法

本文介绍了一种在LoadRunner中使用lr_save_string和lr_eval_string函数进行参数化的简便方法,替代了传统的字符串函数拼接方式,提高了WebServices请求XML格式串中参数的灵活性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

 

LoadRunner在Web Services请求的XML格式串中需要参数化某一个参数,以前的做法是使用string类函数拼出新的XML串,但经过深入的学习lr_save_string()和lr_eval_string()两个函数,发现有更简洁的方法,如下:

 

使用函数lr_save_string()与lr_eval_string()完成转换:

 

lr_save_string( lr_eval_string("{NewParam}"),"username");

 

 

其中{NewParam}为使用lr自带的参数化而成的参数。

然后,传入username:

 例如:

 

 

soap_request("StepName=Login",

                   "URL=http://10.0.16.221/i6P/i6Service/WinLoginService.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:soap=/"http:/"

                   "/schemas.xmlsoap.org/soap/envelope//"><soap:Body><Login xmlns=/"http:/"

                   "/tempuri.org//"><userConnectString>lers14t;5a8i2ix3b4g7=318p="

                   "j0t030c2jyio1r9i0nid3tt4xp89ocaNv8yt0ycahce0ol9nwen4ieh0cxoth5t8vylepx"

                   "lecp=jesI8qgel20cttlm3iaee=bn19tcn;yrsmheyorm0v9qe51rxs="

                   "ja1bw0eu.2e0b5.301;s6r3.bd2qp22s136;opdeDa9wt51aembxxarjsweelb="

                   "r6nttgrS0s50920541ih;equdIs5mer2r62 e=itodjl=.0s5kaw4;"

                   "rtp8Na0bs6wsgmwssoo6r5pd9i=kr1pq2gu3s24hj5ve6ykvxql6il="

                   "nandI62.ua7hc0kkvbeCnsmpv;lyy3ptgsseaxgryy18b8o8rt4v0e2y2wibrgoygleh9="

                   "dmehh9020t3u.i2jd2ixgtsu26a1yxxbpaa10000001000010010000001000000000000"

                   "000000100000000110000010000110000100000000000000</userConnectString>"

                   "<curAcc>0001</curAcc><logid>{username}</logid><passWord/></Login></soap"

                   ":Body></soap:Envelope>",

                   "Snapshot=t35.inf",

                   "ResponseParam=response",

                   LAST);

 

 

 

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值