Jmeter中存储的SOAP调用请求在哪里 [英] Where is the request for a SOAP call stored in Jmeter
问题描述
我正在尝试使用BeanShell将SOAP请求打印到文件中,因为我必须进行一些验证.
I am trying to print the SOAP Request into a file using BeanShell as i had to do some verifications.
我可以使用String response = prev.getResponseDataAsString();
获得SOAP调用的响应,该响应可以打印到文件中.
I am able to get the response for the SOAP call using String response = prev.getResponseDataAsString();
which can be printed to the file.
类似地,可以使用什么方法来获取Jmeter中针对SOAP调用发送的请求?
Similarly what is the method that can be used to get the Request sent for SOAP call in Jmeter?
注意:我尝试使用SoapSampler.getxmldata()
.但这并没有给我结果.
Note: I tried to use SoapSampler.getxmldata()
. But it did not give me the result.
推荐答案
如果SOAP请求作为HTTP POST调用提交,而xml内容作为POST正文,则prev.getSamplerData()
将包含请求信息.
If the SOAP request is submitted as a HTTP POST call, with xml content as POST body, prev.getSamplerData()
will contain request information.
示例:
在beanshell后处理器中:vars.put("requestData", prev.getSamplerData());
Example:
In beanshell post processor: vars.put("requestData", prev.getSamplerData());
结果:
requestData=POST url
POST data:
<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
<soap:Body>
...
</soap:Body>
</soap:Envelope>
这篇关于Jmeter中存储的SOAP调用请求在哪里的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!