繁体   English   中英

通过Jmeter发送宁静的请求

[英]send restful request by Jmeter

我有一个烦躁的请求,需要使用Jmeter将其发送到Web服务。 这是我的要求:

{"type":"CustomerProfileReqModel","messageCode":"GetCustRq","messageVersion":"V1.0","language":"en-gb","recieverCode":"newone","customerModel":{"userName":"load24","password":"P@ssw0rd","categoryCode":"NORM"},"uiCacheVersion":"3e096b72-ed40-4f8a-aad3-9ed52a4aa8ba"}

这是我在JMeter中创建的:

线程组SOAP / XML-RPC请求URL: http:// localhost:9000 / MyFawryWeb / rest / MFServlet / service

当我运行时,出现以下错误:

org.apache.commons.httpclient.NoHttpResponseException:服务器11.92.0.91无法通过org.apache.commons.httpclient.HttpMethodBase.readResponse( org.apache.commons.httpclient上的HttpMethodBase.java:1735)org.apache.commons.httpclient.HttpMethodDirector.executeWithRetry(HttpMethodDirector.java:398)上的org.apache.commons.httpclient.HttpMethodBase.execute(HttpMethodBase.java:1098) org.apache.commons上的.httpclient.HttpMethodDirector.executeMethod(HttpMethodDirector.java:171).org.apache.commons.httpclient.Httpclient.HttpClient.executeMethod(HttpClient.java:323 )的org.apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1088)的org.apache.jmeter.protocol.http.sampler.SoapSampler.sample(SoapSampler.java:271) org.apache.jmeter.threa上的apache.jmeter.protocol.http.sampler.HTTPSamplerBase.sample(HTTPSamplerBase.java:1077) org.apache.jmeter.threads.JMeterThread.run(JMeterThread.java:256)处的ds.JMeterThread.process_sampler(JMeterThread.java:428)(java.lang.Thread.run(未知源)

  1. 您需要使用HTTP Request Sampler发送REST请求,JSON有效负载需要进入“ Body Data”标签,例如:

    JMeter REST请求

  2. 我相信您还应该添加一个HTTP Header Manager并将其配置为发送带有application/json值的Content-Type标头
  3. 添加“ 查看结果树”侦听器以检查请求和响应详细信息并运行您的请求(在运行带有大量用户的负载测试时,请不要忘记删除它)

有关更多信息和详细说明,请参阅REST API测试-如何正确进行。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM