这个WSDL有什么问题?为什么SOAPUI从此WSDL生成错误的请求?

时间:2017-04-24 12:12:29

标签: web-services wsdl soapui

我对我的WSDL之一有一个奇怪的问题

当我在SOAPUI中创建一个新的SOAP项目并导入WSDL时,SOAPUI会生成一个示例请求,但是此请求缺少该操作的命名空间和元素。

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/">
   <soapenv:Header/>
   <soapenv:Body>
      <customers>
         <!--Zero or more repetitions:-->
         <customerId>?</customerId>
      </customers>
   </soapenv:Body>
</soapenv:Envelope>

根据我的WSDL和XSD,我将在最后包含以供参考,我希望请求看起来更像这样:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:look="http://noa.otto.de/onlinecustomer/webservice/lookupadditionaldata">
   <soapenv:Header/>
   <soapenv:Body>
    <look:requestAdditionalCustomerData>
          <look:customers>
             <!--Zero or more repetitions:-->
             <look:customerId>?</look:customerId>
          </look:customers>
      </look:requestAdditionalCustomerData>
   </soapenv:Body>
</soapenv:Envelope>

但是,即使我正确地#34;像这样的请求手动它不会工作,仍然在服务器端产生SOAPFault异常,说明它无法从WS上下文中检索操作名称&#34;

这告诉我问题可能不是SOAPUI从WSDL生成正确请求的能力,而是我能够定义正确的WSDL: - )

问题是,我没有更多的想法,我可以尝试,我已经在这两天了。所以我想也许别人有个主意。

任何想法都是有意义的,并提前感谢您的时间!

问候 马里奥

哦,如果重要,网络服务部署在glassfish / payara 4.1.1

这是我的WSDL:

<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:webservice="http://noa.otto.de/onlinecustomer/webservice/lookupadditionaldata" xmlns:lookupadditionaldata="http://noa.otto.de/onlinecustomer/schema/lookupadditionaldata" name="LookupAdditionalUniservData" targetNamespace="http://noa.otto.de/onlinecustomer/webservice/lookupadditionaldata">
<types>
  <xsd:schema>
    <xsd:import namespace="http://noa.otto.de/onlinecustomer/schema/lookupadditionaldata" schemaLocation="http://blade228.puc.ov.otto.de:52301/onlinecustomer/LookupAdditionalUniservData?xsd=1"/>
  </xsd:schema>
</types>

<message name="requestAdditionalCustomerDataRequest">
    <part name="customers" type="lookupadditionaldata:intArray"/>
</message>

<message name="requestAdditionalCustomerDataResponse">
    <part name="customerData" type="lookupadditionaldata:customerDataArray"/>
</message>

<portType name="LookupAdditionalUniservDataPort">
    <operation name="requestAdditionalCustomerData">
        <input message="webservice:requestAdditionalCustomerDataRequest"/>
        <output message="webservice:requestAdditionalCustomerDataResponse"/>
    </operation>
</portType>

<binding name="LookupAdditionalUniservDataPortBinding" type="webservice:LookupAdditionalUniservDataPort">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http" style="document"/>
    <operation name="requestAdditionalCustomerData">
        <documentation>collects customer account information for a given list of idCustomers</documentation>
        <soap:operation soapAction="requestAdditionalCustomerData" style="document"/>
        <input>
            <soap:body use="literal"/>
        </input>
        <output>
            <soap:body use="literal"/>
        </output>
    </operation>
</binding>

<service name="LookupAdditionalUniservDataService">
    <documentation>this service provides a means for the CASS/ENS/Uniserv system to collect additional customer account data</documentation>
    <port name="LookupAdditionalUniservDataPort" binding="webservice:LookupAdditionalUniservDataPortBinding">
        <soap:address location="http://blade228.puc.ov.otto.de:52301/onlinecustomer/LookupAdditionalUniservData"/>
    </port>
</service>

</definitions>

这是XSD:

<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns="http://www.w3.org/2001/XMLSchema" xmlns:tns="http://noa.otto.de/onlinecustomer/schema/lookupadditionaldata" targetNamespace="http://noa.otto.de/onlinecustomer/schema/lookupadditionaldata" version="1.0">

    <xs:complexType name="customerData">
        <xs:sequence>
            <xs:element name="accountBalance" type="xs:long" minOccurs="0"/>
            <xs:element name="birthday" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="blockedOrderValue" type="xs:int" minOccurs="0"/>
            <xs:element name="city" type="xs:string" minOccurs="0"/>
            <xs:element name="combinedCreditWorthinessClass" type="xs:short" minOccurs="0"/>
            <xs:element name="companyId" type="xs:short" minOccurs="0"/>
            <xs:element name="creationDate" type="xs:dateTime" minOccurs="0"/>
            <xs:element name="custNo" type="xs:string" minOccurs="0"/>
            <xs:element name="blockades" minOccurs="0">
                <xs:complexType>
                    <xs:sequence>
                        <xs:element name="blockade" type="tns:customerBlockade" minOccurs="0" maxOccurs="unbounded"/>
                    </xs:sequence>
                </xs:complexType>
            </xs:element>
            <xs:element name="dunningLevel" type="xs:string" minOccurs="0"/>
            <xs:element name="email" type="xs:string" minOccurs="0"/>
            <xs:element name="errorMessage" type="xs:string" minOccurs="0"/>
            <xs:element name="externalAccountBlockingSign" type="xs:byte" minOccurs="0"/>
            <xs:element name="externalBlockingSign" type="xs:byte" minOccurs="0"/>
            <xs:element name="externalCustomerType" type="xs:short" minOccurs="0"/>
            <xs:element name="firstName" type="xs:string" minOccurs="0"/>
            <xs:element name="houseNo" type="xs:string" minOccurs="0"/>
            <xs:element name="id" type="xs:int" minOccurs="0"/>
            <xs:element name="lastName" type="xs:string" minOccurs="0"/>
            <xs:element name="openBackorder" type="xs:int" minOccurs="0"/>
            <xs:element name="phone" type="xs:string" minOccurs="0"/>
            <xs:element name="salutation" type="xs:string" minOccurs="0"/>
            <xs:element name="street" type="xs:string" minOccurs="0"/>
            <xs:element name="weeklyCredit" type="xs:long" minOccurs="0"/>
            <xs:element name="zip" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

    <xs:complexType name="customerBlockade">
        <xs:sequence>
            <xs:element name="blockadeAge" type="xs:long" minOccurs="0"/>
            <xs:element name="blockadeName" type="xs:string" minOccurs="0"/>
            <xs:element name="blockadeNumber" type="xs:short" minOccurs="0"/>
            <xs:element name="blockadeState" type="tns:blockadeState" minOccurs="0"/>
            <xs:element name="dominantBlockadeSign" type="xs:boolean" minOccurs="0"/>
            <xs:element name="paymentKey" type="xs:byte" minOccurs="0"/>
            <xs:element name="paymentKeyName" type="xs:string" minOccurs="0"/>
        </xs:sequence>
    </xs:complexType>

    <xs:simpleType name="blockadeState">
        <xs:restriction base="xs:string">
            <xs:enumeration value="ACTIVE"/>
            <xs:enumeration value="SUSPENDED"/>
        </xs:restriction>
    </xs:simpleType>

    <xs:complexType name="customerDataArray" final="#all">
        <xs:sequence>
            <xs:element name="item" type="tns:customerData" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
        </xs:sequence>
    </xs:complexType>
    <element name="customerDataArray" type="tns:customerDataArray"/>

    <xs:complexType name="intArray" final="#all">
        <xs:sequence>
            <xs:element name="customerId" type="xs:int" minOccurs="0" maxOccurs="unbounded" nillable="true"/>
        </xs:sequence>
    </xs:complexType>
    <element name="intArray" type="tns:intArray"/>

</xs:schema>

1 个答案:

答案 0 :(得分:0)

我发现了导致这个问题的原因。这是WSDL中的错误。在<message>两个定义中,我在type=""元素中使用了属性<part>。应该是element=""而不是type="",然后才有效。