【问题标题】:Jmeter - How to send XML request to a server?Jmeter - 如何将 XML 请求发送到服务器?
【发布时间】:2015-05-13 05:11:54
【问题描述】:

我的测试计划中有一个 HTTP 请求采样器。我已经给出了我的服务器名称或 IP、端口和 url。我选择了 Body Data 选项卡并以这种方式发出了 XML 请求:

<Request>
    <Header><Log><Level>None</Level></Log></Header>
    <Body>
        <Action>
            <GetService>
                <Code>ABC</Code>
                <CodeValue>XYZ</CodeValue>
            </GetService>
        </Action>
    </Body> </Request>

但是,这就是我得到的采样器结果:

响应代码:非 HTTP 响应代码:java.net.ConnectException 响应消息:非 HTTP 响应消息:连接被拒绝

响应标头:

HTTPSampleResult 字段: 内容类型:
数据编码:空

我已确保我可以 ping 我的服务器。它启动并运行。

这里还有什么我遗漏的吗?

提前致谢!

【问题讨论】:

    标签: xml web-services jmeter httprequest


    【解决方案1】:

    我发现对这类东西使用 SOAP/XML-RPC 请求是最简单的。只需输入您要发送的 XML 和 URL,如果您不使用它,请确保未选中 Send SOAPAction。

    不过,您遇到的问题似乎无关紧要。看起来 JMeter 无法连接到服务器。您应该通过使用浏览器并转到要将 XML 发送到的 URL 来手动尝试。你至少应该得到一个 400 错误。 “连接被拒绝”看起来更像是服务器没有运行。

    【讨论】:

      【解决方案2】:
      1. 您的浏览器使用代理连接到 Internet,而 JMeter 没有。尝试使用单个 JMeter GET 请求访问 http://example.com 域,如果失败 - 通过以下命令行参数访问 configure JMeter to use the same proxy as browser does

        -H, --proxyHost <argument>
               Set a proxy server for JMeter to use
        -P, --proxyPort <argument>
               Set proxy server port for JMeter to use
        -N, --nonProxyHosts <argument>
               Set nonproxy host list (e.g. *.apache.org|localhost)
        -u, --username <argument>
               Set username for proxy server that JMeter is to use
        -a, --password <argument>
               Set password for proxy server that JMeter is to use 
        
      2. 仔细检查您的Server NamePort 值并通过即telnet 命令验证它们。如果 telnet 能够连接 - JMeter 将能够以及无法建立连接的错误状态。
      3. 确保使用正确的 HTTP 方法。
      4. 您可能还需要传递相关的Content-Type 标头值,例如text/xmlapplication/soap+xml 通过 HTTP Header Manager

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        相关资源
        最近更新 更多