SOAPUI - 缺少名称的消息部分 - 架构合规性错误

时间:2015-06-18 18:44:07

标签: xsd wsdl schema soapui xsd-validation

这是带有内联架构的wsdl文件。我有本地调用的实际wsdl文件,也就是localhost / wsdl /.

<wsdl:definitions xmlns="http://soap.company.com/fetch_n_pay"
                  xmlns:tns="http://soap.company.com/fetch_n_pay"
                  xmlns:s="http://www.w3.org/2001/XMLSchema"
                  xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
                  xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
                  xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
                  targetNamespace="http://soap.company.com/fetch_n_pay">
  <wsdl:types>
    <s:schema elementFormDefault="qualified" targetNamespace="http://soap.company.com/fetch_n_pay">
      <s:complexType name="fetchBookingDetailsRequType">
        <s:all>
          <s:element name="version" type="s:string"/>
          <s:element name="timestamp" type="s:dateTime"/>
          <s:element name="siteUrl" type="s:string"/>
          <s:element name="confirmationCode" type="s:string"/>
          <s:element name="vendorCode" type="s:string"/>
        </s:all>
      </s:complexType>
      <s:complexType name="fetchBookingDetailsRespType">
        <s:all>
          <s:element name="version" type="s:string"/>
          <s:element name="timestamp" type="s:dateTime"/>
          <s:element name="isSuccess" type="s:boolean"/>
          <s:element name="responseCode" type="s:int"/>
          <s:element name="errorMessage" type="s:string"/>
          <s:element name="sailingDate" type="s:date"/>
          <s:element name="sailingName" type="s:string"/>
          <s:element name="cruiselineName" type="s:string"/>
          <s:element name="cruiselineId" type="s:string"/>
          <s:element name="cabinNumber" type="s:string"/>
          <s:element name="roomType" type="s:string"/>
          <s:element name="shipName" type="s:string"/>
          <s:element name="departingFrom" type="s:string"/>
          <s:element name="returnDate" type="s:date"/>
          <s:element name="numberOfAdults" type="s:int"/>
          <s:element name="numberOfChildren" type="s:int"/>
          <s:element name="numberOfSeniors" type="s:int"/>
          <s:element name="numberOfInfants" type="s:int"/>
          <s:element name="confirmationNumber" type="s:string"/>
          <s:element name="balanceDueDate" type="s:dateTime"/>
          <s:element name="depositDueDate" type="s:dateTime"/>
          <s:element name="depositCollectedByCruiseline" type="s:boolean"/>
          <s:element name="wasBookedSuccess" type="s:boolean"/>
          <s:element name="shipImageUrl" type="s:string"/>
          <s:element name="isCancelled" type="s:boolean"/>
          <s:element name="insuranceAmount" type="s:double"/>
          <s:element name="customerTitle" type="s:string"/>
          <s:element name="customerFirstName" type="s:string"/>
          <s:element name="customerLastName" type="s:string"/>
          <s:element name="customerPhone" type="s:string"/>
          <s:element name="customerEmail" type="s:string"/>
        </s:all>
      </s:complexType>
      <s:element name="fetchBookingDetailsRequElement" type="tns:fetchBookingDetailsRequType" />
      <s:element name="fetchBookingDetailsRespElement" type="tns:fetchBookingDetailsRespType" />
    </s:schema>
  </wsdl:types>

  <wsdl:message name="fetchBookingDetailsSoapIn">
    <wsdl:part name="banana1" element="tns:fetchBookingDetailsRequElement"/>
  </wsdl:message>
  <wsdl:message name="fetchBookingDetailsSoapOut">
    <wsdl:part name="banana2" element="tns:fetchBookingDetailsRespElement"/>
  </wsdl:message>


  <wsdl:portType name="FetchAndPaySoap">
    <wsdl:operation name="fetchBookingDetails">
      <wsdl:documentation xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/">
        Gets Information for booking.
      </wsdl:documentation>
      <wsdl:input message="tns:fetchBookingDetailsSoapIn"/>
      <wsdl:output message="tns:fetchBookingDetailsSoapOut"/>
    </wsdl:operation>
  </wsdl:portType>

  <wsdl:binding name="FetchAndPaySoap" type="tns:FetchAndPaySoap">
    <soap:binding transport="http://schemas.xmlsoap.org/soap/http"/>
    <wsdl:operation name="fetchBookingDetails">
      <soap:operation soapAction="http://soap.company.com/fetchBookingDetails" style="document"/>
      <wsdl:input>
        <soap:body use="literal"/>
      </wsdl:input>
      <wsdl:output>
        <soap:body use="literal"/>
      </wsdl:output>
    </wsdl:operation>
  </wsdl:binding>

  <wsdl:service name="FetchAndPay">
    <wsdl:port name="FetchAndPaySoap" binding="tns:FetchAndPaySoap">
      <soap:address location="localhost/wsdl/"/>
    </wsdl:port>
  </wsdl:service>
</wsdl:definitions>

1)由于某种原因,请求soap正在添加“fet:”命名空间

<soapenv:Envelope 
xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:fet="http://soap.company.com/fetch_n_pay">
<soapenv:Header/>
<soapenv:Body>
  <fet:fetchBookingDetailsRequElement>
     <!--You may enter the following 5 items in any order-->
     <fet:version>?</fet:version>
     <fet:timestamp>?</fet:timestamp>
     <fet:siteUrl>?</fet:siteUrl>
     <fet:confirmationCode>?</fet:confirmationCode>
     <fet:vendorCode>?</fet:vendorCode>
  </fet:fetchBookingDetailsRequElement>
</soapenv:Body>
</soapenv:Envelope>

2)SOAP响应有效,但架构合规性失败。这是错误:

以下是回复:

<SOAP-ENV:Envelope 
SOAP-ENV:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" 
xmlns:xsd="http://www.w3.org/2001/XMLSchema" 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:SOAP-ENC="http://schemas.xmlsoap.org/soap/encoding/">
<SOAP-ENV:Body>
  <fetchBookingDetailsResponse
  xmlns="http://soap.company.com/fetch_n_pay">
     <version>0.1.0</version>
     <timestamp>2015-06-18T13:37:08-04:00</timestamp>
     <isSuccess>false</isSuccess>
     <responseCode>47</responseCode>
     <errorMessage>No results were found.</errorMessage>
  </fetchBookingDetailsResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>

我试图成为Schema Compliant,以便解析它。

任何事情都会非常感激。谢谢!

1 个答案:

答案 0 :(得分:0)

您的验证引擎已经为您提供了答案,它不是fetchBookingDetailsResponse,而是fetchBookingDetailsRespElement