gpt4 book ai didi

testing - WebServiceSampler : error in Jmeter

转载 作者:行者123 更新时间:2023-11-28 21:32:32 28 4
gpt4 key购买 nike

我使用 jmeter 2.8。
我已经使用 HTTP Request Sampler 发送了请求。我已经发送了 10 个 http 请求。我已经使用 XPath Extractor 解析了响应并将值存储在变量中。

我已经使用 Beanshell 预处理器在下一个 http 请求中替换了该值。
我使用了以下代码:

import org.apache.jmeter.protocol.http.sampler.WebServiceSampler;
WebServiceSampler wsSampler = (WebServiceSampler) sampler;
String requestWithCertif = wsSampler.getXmlData().replaceFirst("#variable to replace#", vars.get("${replacevalue}"));
wsSampler.setXmlData(requestWithCertif);

但是出现了如下错误。
我已经关注了这个link如何解析响应:

ERROR - jmeter.util.BeanShellInterpreter: Error invoking bsh method: eval Sourced file: inline evaluation of: ``import org.apache.jmeter.protocol.http.sampler.WebServiceSampler; WebServiceSamp . . . '' : Typed variable declaration

我希望错误似乎是关于这一行的变量声明

String requestWithCertif = wsSampler.getXmlData().replaceFirst("#要替换的变量#", vars.get("${replacevalue}"));

有人可以解释一下如何在这个 beanshell 脚本中使用变量声明吗?

![在此处输入图片描述][2]

最佳答案

不要那样做。

将 HTTP Sampler 与 Raw Post Body 结合使用,并将带有变量的 XML 放入正文的 ${} 内。

WebserviceSampler 将在即将到来的 2.9 版本中被弃用。

关于testing - WebServiceSampler : error in Jmeter,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/14157674/

28 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com