JMeter - 删除 SOAP 请求中的空元素
JMeter - Remove empty elements in SOAP request
我正在使用 CSV 数据集配置来填充 SOAP/XML 个变量以在 JMeter
中请求。我的问题是,当某些变量为空时,我会收到由此导致的验证错误,因此我需要摆脱这些变量。
有一个非常相似的主题,描述得很好 (Jmeter remove empty strings at a SOAP/xml reqeust),不幸的是这个解决方案对我不起作用,我得到:
meter.util.BeanShellInterpreter: Error invoking bsh method:
eval Sourced file: inline evaluation of: ``String data =
sampler.getXmlData(); data = data.replaceAll("",""); . . .
'' : Typed variable declaration : Error in method invocation: Method
getXmlData() not found in
class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
Method getXmlData() not found in class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
因为这个方法存在于SoapSampler中,不存在于"HTTPSamplerProxy"中
https://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/SoapSampler.html
引用的答案假定为 SOAP/XML-RPC Request, you're using HTTP Request,因此需要对请求数据进行一些不同的操作。
换行:
String data = sampler.getXmlData();
至:
String data = sampler.getArguments().getArgument(0).getValue();
我再次鼓励您熟悉 How to Use BeanShell: JMeter's Favorite Built-in Component 指南。
我正在使用 CSV 数据集配置来填充 SOAP/XML 个变量以在 JMeter
中请求。我的问题是,当某些变量为空时,我会收到由此导致的验证错误,因此我需要摆脱这些变量。
有一个非常相似的主题,描述得很好 (Jmeter remove empty strings at a SOAP/xml reqeust),不幸的是这个解决方案对我不起作用,我得到:
meter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``String data = sampler.getXmlData(); data = data.replaceAll("",""); . . . '' : Typed variable declaration : Error in method invocation: Method getXmlData() not found in class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
Method getXmlData() not found in class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'
因为这个方法存在于SoapSampler中,不存在于"HTTPSamplerProxy"中 https://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/SoapSampler.html
引用的答案假定为 SOAP/XML-RPC Request, you're using HTTP Request,因此需要对请求数据进行一些不同的操作。
换行:
String data = sampler.getXmlData();
至:
String data = sampler.getArguments().getArgument(0).getValue();
我再次鼓励您熟悉 How to Use BeanShell: JMeter's Favorite Built-in Component 指南。