JMeter - Remove empty elements in SOAP request

荒凉一梦 提交于 2019-12-12 02:44:17

问题


I am using CSV Data Set Config to fill SOAP/XML variables to request in JMeter. My problem is, when some variables are empty, then i get error on validation caused by this so I need to get rid of those.

There is very similar topic, well described (Jmeter remove empty strings at a SOAP/xml reqeust), unfortunately the solution is not working for me, iam getting:

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'


回答1:


The referenced answer assumed SOAP/XML-RPC Request, you're using HTTP Request so request data needs to be manipulated a little bit differently.

Change the line:

String data = sampler.getXmlData();

to:

String data = sampler.getArguments().getArgument(0).getValue();

Again I encourage you to get yourself familiarised with How to Use BeanShell: JMeter's Favorite Built-in Component guide.




回答2:


Method getXmlData() not found in class'org.apache.jmeter.protocol.http.sampler.HTTPSamplerProxy'

Because this method exists in SoapSampler, not in "HTTPSamplerProxy" https://jmeter.apache.org/api/org/apache/jmeter/protocol/http/sampler/SoapSampler.html



来源:https://stackoverflow.com/questions/34143259/jmeter-remove-empty-elements-in-soap-request

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!