使用jMeter 3.3未访问WCF端点

时间:2018-01-24 08:41:45

标签: wcf soap jmeter

我正在使用jMeter 3.3并试图ping我的wcfservice。

地址:http://localhost:88/MyService.svc 端点:MyEndpoint

我创建了Jmeter http请求

enter image description here

服务器name:localhost 端口:88 方法:Post 路径:/MyService.svc

并根据教程填写http标头: enter image description here

内容类型:text/xml SOAPAction:http://localhost:88/MyService/MyEndpoint

问题是我的ednpoint没有到达。 soapUi或WcfTestClient中的相同数据运行良好。我在JMeter配置中遗漏了什么吗?

提前致谢。

2 个答案:

答案 0 :(得分:2)

我认为你错过了几件事

  1. 您的内容类型应指定字符集,因此正确的值为:text / xml;字符集= UTF-8
  2. 您的屏幕截图上没有正文,所以我不确定它是否已填充。它没有填充,您应该从WCF测试客户端获取请求正文,提取正文部分并将其放入正文数据选项卡。
  3. 例如,WCF测试客户端的原始信封是这样的:

        <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
          <s:Header>
             <Action s:mustUnderstand="1" xmlns="http://schemas.microsoft.com/ws/2005/05/addressing/none">http://tempuri.org/IService1/DoWork</Action>
          </s:Header>
          <s:Body>
            <DoWork xmlns="http://tempuri.org/" />
          </s:Body>
        </s:Envelope>
    

    JMeter的Body不应该有Header部分:

        <s:Envelope xmlns:s="http://schemas.xmlsoap.org/soap/envelope/">
          <s:Body>
            <DoWork xmlns="http://tempuri.org/" />
          </s:Body>
        </s:Envelope>
    

    一般情况下,Jmeter配置如下:

    enter image description here enter image description here

    这应该解决问题。

    P.S。查看结果树非常适合调试

答案 1 :(得分:1)

鉴于您能够通过SoapUI运行请求,您应该能够使用JMeter的HTTP(S) Test Script Recorder

捕获它
  1. Configure JMeter for recording

    • 从JMeter主菜单中选择File -> Templates -> Recording,然后点击“创建” JMeter Recording Template
    • 打开Workbench -> HTTP(S) Test Script Recorder,然后点击“开始”
  2. 配置SoapUI进行录制

    • 从SoapUI主菜单中选择File -> Preferences -> Proxy Settings,然后点击“手动”
    • localhost用作“主机”,将8888用作端口

      SoapUI recording

  3. 在SoapUI中运行您的请求
  4. JMeter将拦截请求并以Test Plan -> Thread Group -> Recording Controller采样器的形式存储在"aggs": { "types": { "terms": { "field": "type", "include": [ 1, 2 ] }, "aggs": { "my_sum": { "sum": { "field": "price" } } } }, "total_sum": { "sum_bucket": { "buckets_path": "types.my_sum" } } } 下。您应该能够在JMeter中成功重播请求。
  5. 另一个选项是HTTP Request