SOAPUI - missing message part with name - schema compliance error

15k views Asked by At

Here is the wsdl file with the schema inline. I have the actual wsdl file being called locally aka 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) For some reason the request soap is adding in "fet:" namespace

<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) The SOAP Response is valid but the schema Compliance failed. This is the error:

Here is the response:

<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>

Im trying to be Schema Compliant so that this can be parsed.

Anything would be greatly appreciated. Thank you!

1

There are 1 answers

0
Florent Georges On

Your validation engine already gave you the answer, it's not fetchBookingDetailsResponse, it's fetchBookingDetailsRespElement.