Jmeter 中存储的 SOAP 调用请求在哪里
Where is the request for a SOAP call stored in Jmeter
我正在尝试使用 BeanShell 将 SOAP 请求打印到文件中,因为我必须进行一些验证。
我可以使用 String response = prev.getResponseDataAsString();
获得 SOAP 调用的响应,可以打印到文件中。
同样,在 Jmeter 中可以使用什么方法来获取 SOAP 调用发送的请求?
注意:我尝试使用 SoapSampler.getxmldata()
。但是没有给我结果
如果 SOAP 请求作为 HTTP POST 调用提交,xml 内容作为 POST 正文,prev.getSamplerData()
将包含请求信息。
示例:
在 beanshell post 处理器中: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>
如果您将 SOAP/XML-RPC Request you can access it's XML body from Beanshell PostProcessor 用作:
String body = ctx.getCurrentSampler().getXmlData();
其中 ctx
是 shorthand 到 JmeterContext class
我正在尝试使用 BeanShell 将 SOAP 请求打印到文件中,因为我必须进行一些验证。
我可以使用 String response = prev.getResponseDataAsString();
获得 SOAP 调用的响应,可以打印到文件中。
同样,在 Jmeter 中可以使用什么方法来获取 SOAP 调用发送的请求?
注意:我尝试使用 SoapSampler.getxmldata()
。但是没有给我结果
如果 SOAP 请求作为 HTTP POST 调用提交,xml 内容作为 POST 正文,prev.getSamplerData()
将包含请求信息。
示例:
在 beanshell post 处理器中: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>
如果您将 SOAP/XML-RPC Request you can access it's XML body from Beanshell PostProcessor 用作:
String body = ctx.getCurrentSampler().getXmlData();
其中 ctx
是 shorthand 到 JmeterContext class