来自Jmeter的SOAP / XML-RPC请求的问题

时间:2016-08-03 19:23:10

标签: soap jmeter

我对这个Jmeter事情有点新意,我试图在Jmeter上做一个简单的SOAP / XML-RPC请求。我使用的是我在互联网上找到的示例代码,这似乎工作得很好(至少在Chrome中使用Wizlet似乎没有问题),但是当我使用生成插件的soap请求时-in在Jmeter中的元素......那是一个不同的故事。如果有人能告诉我这个问题会很棒。

这是WSDL的代码:

 <wsdl:definitions xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://jee.javapapers.com" xmlns:intf="http://jee.javapapers.com" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" targetNamespace="http://jee.javapapers.com">
<!--
WSDL created by Apache Axis version: 1.4
Built on Apr 22, 2006 (06:55:48 PDT)
-->
<wsdl:types>
    <schema xmlns="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified" targetNamespace="http://jee.javapapers.com">
        <element name="animalType">
            <complexType>
                <sequence>
                    <element name="animal" type="xsd:string"/>
                </sequence>
            </complexType>
        </element>
        <element name="animalTypeResponse">
            <complexType>
                <sequence>
                    <element name="animalTypeReturn" type="xsd:string"/>
                </sequence>
            </complexType>
        </element>
    </schema>
</wsdl:types>
<wsdl:message name="animalTypeResponse">
    <wsdl:part element="impl:animalTypeResponse" name="parameters"/>
</wsdl:message>
<wsdl:message name="animalTypeRequest">
    <wsdl:part element="impl:animalType" name="parameters"/>
</wsdl:message>
<wsdl:portType name="AnimalTypeService">
    <wsdl:operation name="animalType">
        <wsdl:input message="impl:animalTypeRequest" name="animalTypeRequest"/>
        <wsdl:output message="impl:animalTypeResponse" name="animalTypeResponse"/>
    </wsdl:operation>
</wsdl:portType>
<wsdl:binding name="AnimalTypeServiceSoapBinding" type="impl:AnimalTypeService">
    <wsdlsoap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="animalType">
        <wsdlsoap:operation soapAction=""/>
        <wsdl:input name="animalTypeRequest">
            <wsdlsoap:body use="literal"/>
        </wsdl:input>
        <wsdl:output name="animalTypeResponse">
            <wsdlsoap:body use="literal"/>
        </wsdl:output>
    </wsdl:operation>
</wsdl:binding>
<wsdl:service name="AnimalTypeServiceService">
    <wsdl:port binding="impl:AnimalTypeServiceSoapBinding" name="AnimalTypeService">
        <wsdlsoap:address location="http://localhost:8082/WebServicesAnimals/services/AnimalTypeService"/>
    </wsdl:port>
</wsdl:service>
</wsdl:definitions>

这是我发送的请求和响应错误。

网址:http://localhost:8082/WebServicesAnimals/services/AnimalTypeService?WSDL

BODY:

<?xml version="1.0" encoding="UTF-8"?>
<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
    <soapenv:Body>
        <animalType xmlns="http://jee.javapapers.com">
            <animal>Lion</animal>
        </animalType>
    </soapenv:Body>
</soapenv:Envelope>

响应:

<?xml version="1.0" encoding="UTF-8"?>
 <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <soapenv:Body>
  <soapenv:Fault>
   <faultcode xmlns:ns1="http://xml.apache.org/axis/">ns1:Client.NoSOAPAction</faultcode>
   <faultstring>no SOAPAction header!</faultstring>
   <detail>
    <ns2:hostname xmlns:ns2="http://xml.apache.org/axis/">WBFINF05</ns2:hostname>
   </detail>
  </soapenv:Fault>
 </soapenv:Body>
</soapenv:Envelope>

1 个答案:

答案 0 :(得分:0)

我发现至少有两个问题:

  • 为什么要将您的请求发送到以?WSDL结尾的URL,您应该使用:
  

http://localhost:8082/WebServicesAnimals/services/AnimalTypeService

  • 错误表示您没有SOAPAction。如果您确认未设置它,请添加标题管理器并将soapAction设置为“”

最后,根据本教程,您应该使用常规HTTP REquest而不是SOAP / XML-RPC Request: