SOAP vs HTTP POST in WSDL

1.5k Views Asked by At

I have the following wsdl

<?xml version="1.0" encoding="UTF-8"?>
<definitions xmlns="http://schemas.xmlsoap.org/wsdl/"
         xmlns:xs="http://www.w3.org/2001/XMLSchema"
         xmlns:http="http://schemas.xmlsoap.org/wsdl/http/"
         xmlns:ota="http://www.opentravel.org/OTA/2003/05"
         targetNamespace="http://www.opentravel.org/OTA/2003/05"
         name="OCDistributorsService">

<types>
    <xs:schema>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelSearchRQ.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelSearchRS.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelDescriptiveInfoRQ.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelDescriptiveInfoRS.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelAvailRQ.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelAvailRS.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelResRQ.xsd"/>
        <xs:import namespace="http://www.opentravel.org/OTA/2003/05" schemaLocation="xsd/OTA_HotelResRS.xsd"/>
    </xs:schema>
</types>

<message name="ListPropertiesRequest">
    <part name="request" element="ota:OTA_HotelSearchRQ"/>
</message>
<message name="ListPropertiesResponse">
    <part name="response" element="ota:OTA_HotelSearchRS"/>
</message>

<message name="GetPropertyDetailsRequest">
    <part name="request" element="ota:OTA_HotelDescriptiveInfoRQ"/>
</message>
<message name="GetPropertyDetailsResponse">
    <part name="response" element="ota:OTA_HotelDescriptiveInfoRS"/>
</message>

<message name="GetMultiAvailabilityRequest">
    <part name="request" element="ota:OTA_HotelAvailRQ"/>
</message>
<message name="GetMultiAvailabilityResponse">
    <part name="response" element="ota:OTA_HotelAvailRS"/>
</message>

<message name="GetSingleAvailabilityRequest">
    <part name="request" element="ota:OTA_HotelAvailRQ"/>
</message>
<message name="GetSingleAvailabilityResponse">
    <part name="response" element="ota:OTA_HotelAvailRS"/>
</message>

<message name="CheckAvailabilityRequest">
    <part name="request" element="ota:OTA_HotelAvailRQ"/>
</message>
<message name="CheckAvailabilityResponse">
    <part name="response" element="ota:OTA_HotelAvailRS"/>
</message>

<message name="DoReservationRequest">
    <part name="request" element="ota:OTA_HotelResRQ"/>
</message>
<message name="DoReservationResponse">
    <part name="response" element="ota:OTA_HotelResRS"/>
</message>

<portType name="OCDistributorsV1Port">

    <operation name="ListProperties">
        <input message="ota:ListPropertiesRequest"/>
        <output message="ota:ListPropertiesResponse"/>
    </operation>

    <operation name="GetPropertyDetails">
        <input message="ota:GetPropertyDetailsRequest"/>
        <output message="ota:GetPropertyDetailsResponse"/>
    </operation>

    <operation name="GetMultiAvailability">
        <input message="ota:GetMultiAvailabilityRequest"/>
        <output message="ota:GetMultiAvailabilityResponse"/>
    </operation>

    <operation name="GetSingleAvailability">
        <input message="ota:GetSingleAvailabilityRequest"/>
        <output message="ota:GetSingleAvailabilityResponse"/>
    </operation>

    <operation name="CheckAvailability">
        <input message="ota:CheckAvailabilityRequest"/>
        <output message="ota:CheckAvailabilityResponse"/>
    </operation>

    <operation name="DoReservation">
        <input message="ota:DoReservationRequest"/>
        <output message="ota:DoReservationResponse"/>
    </operation>

</portType>

<binding name="OCDistributorsV1POST" type="ota:OCDistributorsV1Port">

    <http:binding verb="POST"/>

    <operation name="ListProperties">
        <http:operation location="ListProperties"/>
        <input/>
        <output/>
    </operation>

    <operation name="GetPropertyDetails">
        <http:operation location="GetPropertyDetails"/>
        <input/>
        <output/>
    </operation>

    <operation name="GetMultiAvailability">
        <http:operation location="GetMultiAvailability"/>
        <input/>
        <output/>
    </operation>

    <operation name="GetSingleAvailability">
        <http:operation location="GetSingleAvailability"/>
        <input/>
        <output/>
    </operation>

    <operation name="CheckAvailability">
        <http:operation location="CheckAvailability"/>
        <input/>
        <output/>
    </operation>

    <operation name="DoReservation">
        <http:operation location="DoReservation"/>
        <input/>
        <output/>
    </operation>

</binding>

<service name="OCDistributorsServiceV1">
    <port name="POST" binding="ota:OCDistributorsV1POST">
        <http:address location="http://sandbox-api-distributors.odigeoconnect.com/distributors/v1/"/>
    </port>
</service>

And I'm using jaxws-maven-plugin to auto generate my client classes. My maven plugin conf is as follows:

    <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>jaxws-maven-plugin</artifactId>
            <configuration>
                <sei/>
                <verbose>true</verbose>
                <extension>true</extension>
                <packageName>com.odigeo.accommodation.fare.provider.odigeoconnect.generated</packageName>
                <wsdlDirectory>${project.basedir}/src/main/conf/resources</wsdlDirectory>
                <sourceDestDir>${project.basedir}/src/main/gen-java</sourceDestDir>
                <wsdlFiles>
                    <wsdlFile>com/odigeo/accommodation/fare/provider/odigeoconnect/odigeoconnect.wsdl</wsdlFile>
                </wsdlFiles>
                <bindingDirectory>${project.basedir}/src/main/conf/resources/com/odigeo/accommodation/fare/provider/odigeoconnect</bindingDirectory>
                <bindingFiles>
                    <bindingFile>bindings.xjb</bindingFile>
                </bindingFiles>
            </configuration>
            <executions>
                <execution>
                    <phase>generate-sources</phase>
                    <goals>
                        <goal>wsimport</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>

The problem is, that when I try to call the WS, using a the generated ServiceClient that provides the port as follows:

final OTAHotelAvailRS response = port.getSingleAvailability(request);

I get the following error:

Cannot create SOAP envelope from: {http://www.opentravel.org/OTA/2003/05}OTA_HotelAvailRS

So, the wsdl clearly states that the request is HTTP POST, so why is my generated client trying to parse the response as SOAP? The response from the server is a valid XML.

0

There are 0 best solutions below