加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 综合聚焦 > 服务器 > 安全 > 正文

【Loadrunner】通过soap_request手工编写webservice协议请求解决

发布时间:2020-12-16 23:34:37 所属栏目:安全 来源:网络整理
导读:问题背景: 我们都知道loadrunner在运用webservice协议中,可以直接访问和导入wsdl地址得到所需web_service_call请求,虽然请求得到了,但是loadrunner中一直报"Error:ExtractResultArg failure: 外部组件发生异常",对于工具上的问题,无非是在度娘中寻找资

问题背景:我们都知道loadrunner在运用webservice协议中,可以直接访问和导入wsdl地址得到所需web_service_call请求,虽然请求得到了,但是loadrunner中一直报"Error:ExtractResultArgfailure: 外部组件发生异常",对于工具上的问题,无非是在度娘中寻找资料,多次尝试,结果还是如此,于是换其他思路方法去解决,用LR中内置函数web_custom_request和soap_request手工编写,并模拟发送webservice的soap请求,如下:

注:web_custom_request和soap_request函数具体用法,请自行度娘或者参考LR帮助说明。。。

方法1:

web_set_max_html_param_len("999999");

web_add_header("SOAPAction","http://tempuri.org/IFileService/DownloadFile");

?web_add_header("Content-Type","text/xml;charset=UTF-8");

web_add_header("User-Agent","Apache-HttpClient/4.1.1 (java 1.5)");

web_custom_request("default.aspx",
"URL=http://{ip}/FileService.svc",?
"Method=POST",?
"Snapshot=t7.inf",?
"Body=<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"??
"xmlns:gta="http://schemas.datacontract.org/2004/07/GTA.EFM.ViewModel"><soapenv:Header/>"
"<soapenv:Body><tem:DownloadFile><!--Optional:--><tem:request><!--Optional:--><gta:CreateTime>0001-01-01T00:00:00</gta:CreateTime><!--Optional:--><gta:Data></gta:Data><!--Optional:-->"
"<gta:FileName>123.rar</gta:FileName><!--Optional:--<gta:Guid>88FA133CCF5449FEA24F7D6AEAFD5B90</gta:Guid><!--Optional:--><gta:Length>0</gta:Length><!--
Optional:-->"
"<gta:Name></gta:Name><!--Optional:--><gta:Offset>0</gta:Offset><!--Optional:--><gta:SavePath>Attach67a618f26eab494390aa06338e61753b</gta:SavePath>"
"</tem:request></tem:DownloadFile></soapenv:Body></soapenv:Envelope>",
LAST);?

备注:运用web_custom_request发送soap协议的http请求,包头会出现警告信息,且响应值是正确的,但个人建议用方法2比较好

方法2:

web_add_header("SOAPAction",""http://tempuri.org/IFileService/DownloadFile"");
web_add_header("User-Agent","Apache-HttpClient/4.1.1 (java 1.5)");
?soap_request("StepName=Welcome",
"URL=http://{ip}//FileService.svc",
"SOAPEnvelope=<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:tem="http://tempuri.org/"??

"xmlns:gta="http://schemas.datacontract.org/2004/07/GTA.EFM.ViewModel"><soapenv:Header/>"
"<soapenv:Body><tem:DownloadFile><tem:request><gta:CreateTime>0001-01-01T00:00:00</gta:CreateTime><gta:Data></gta:Data>"
"<gta:FileName>123.rar</gta:FileName><gta:Guid>88FA133CCF5449FEA24F7D6AEAFD5B90</gta:Guid><gta:Length>0</gta:Length>"
"<gta:Name></gta:Name><gta:Offset>0</gta:Offset><gta:SavePath>Attach67a618f26eab494390aa06338e61753b</gta:SavePath>"
"</tem:request></tem:DownloadFile></soapenv:Body></soapenv:Envelope>",
"Snapshot=t1.inf",
"ResponseParam=response",
LAST);


总结:做什么事,要学会怎么样去拓展思路,而不是仅限于工具使用或者工具中固定函数和方法,切记录制的脚本并非不能改变

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读