Search code examples
javasoapwsdlwsimport

wsimport uses SOAP 1.2 for SOAP 1.1 wsdl


I've got this wsdl supplied for a SOAP 1.1, once I try to generate my java code using wsimport, it handles the wsdl as being 1.2. Which subsiquentially throws an error: com.sun.tools.ws.wsdl.framework.ParseException: invalid extension element: "soap:body" (in namespace "http://schemas.xmlsoap.org/wsdl/soap/")

If I change the soap name change from: xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap12/ to xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/ It generates my code, but I'm not sure what other consequences this has (I can't yet connect to the endpoint at this time). Plus I don't want to hack the wsdl.

Is there any known error in wsimport that let's it incorrectly handle a 1.1 wsdl as being 1.2? (well, known... I can't find anything about this after hours of searching) Is there a work around where for example I can force wsimport to use soap 1.1? Any other solution without editting the wsdl?

wsdl code here:

<?xml version="1.0" encoding="UTF-8"?>
<wsdl:definitions xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:rpa="urn:ns:cdm:reisinformatie:data:vi:1" xmlns:tns="urn:ns:cdm:reisinformatie:message:actuelelandelijkeberichten:1" xmlns:ns="urn:ns:cdm:reisinformatie:message:actuelelandelijkeberichten:1" targetNamespace="urn:ns:cdm:reisinformatie:message:actuelelandelijkeberichten:1">
    <wsdl:types>
        <xsd:schema xmlns:rpa="urn:ns:cdm:reisinformatie:data:vi:1" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:tns="urn:ns:cdm:reisinformatie:message:actuelelandelijkeberichten:1" targetNamespace="urn:ns:cdm:reisinformatie:message:actuelelandelijkeberichten:1" elementFormDefault="qualified" attributeFormDefault="unqualified" version="1.0">
            <xsd:import schemaLocation="ri-cdm-vi-lab.xsd" namespace="urn:ns:cdm:reisinformatie:data:vi:1"/>
            <xsd:element name="GeefActueleLandelijkeBerichtenRequestMessage" type="rpa:GeefActueleLandelijkeBerichtenRequestMessageType"/>
            <xsd:element name="GeefActueleLandelijkeBerichtenResponseMessage" type="rpa:GeefActueleLandelijkeBerichtenResponseMessageType"/>
            <xsd:element name="GeefActueleLandelijkeBerichtenFaultMessage" type="rpa:GeefActueleLandelijkeBerichtenFaultMessageType"/>
        </xsd:schema>
    </wsdl:types>
    <wsdl:message name="GeefActueleLandelijkeBerichtenRequest">
        <wsdl:part name="parameter" element="tns:GeefActueleLandelijkeBerichtenRequestMessage"/>
    </wsdl:message>
    <wsdl:message name="GeefActueleLandelijkeBerichtenResponse">
        <wsdl:part name="parameter" element="tns:GeefActueleLandelijkeBerichtenResponseMessage"/>
    </wsdl:message>
    <wsdl:message name="GeefActueleLandelijkeBerichtenFault">
        <wsdl:part name="Fout" element="tns:GeefActueleLandelijkeBerichtenFaultMessage"/>
    </wsdl:message>
    <wsdl:portType name="ActueleLandelijkeBerichtenSoap">
        <wsdl:documentation>Actuele LandelijkeBerichten Soap Port</wsdl:documentation>
        <wsdl:operation name="GeefActueleLandelijkeBerichten">
            <wsdl:input message="tns:GeefActueleLandelijkeBerichtenRequest"/>
            <wsdl:output message="tns:GeefActueleLandelijkeBerichtenResponse"/>
            <wsdl:fault name="Fout" message="tns:GeefActueleLandelijkeBerichtenFault"/>
        </wsdl:operation>
    </wsdl:portType>
    <wsdl:binding name="ActueleLandelijkeBerichtenSoap" type="tns:ActueleLandelijkeBerichtenSoap">
        <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
        <wsdl:documentation>Actuele LandelijkeBerichten Soap Binding</wsdl:documentation>
        <wsdl:operation name="GeefActueleLandelijkeBerichten">
            <soap:operation soapAction="urn:GeefActueleLandelijkeBerichten"/>
            <wsdl:input>
                <soap:body use="literal"/>
            </wsdl:input>
            <wsdl:output>
                <soap:body use="literal"/>
            </wsdl:output>
            <wsdl:fault name="Fout">
                <soap:body use="literal"/>
            </wsdl:fault>
        </wsdl:operation>
    </wsdl:binding>
    <wsdl:service name="ActueleLandelijkeBerichten">
        <wsdl:documentation>Actuele LandelijkeBerichten Service</wsdl:documentation>
        <wsdl:port name="RPAActueleLandelijkeBerichtenSoap" binding="tns:ActueleLandelijkeBerichtenSoap">
            <soap:address location="NotDefined"/>
            <wsdl:documentation>Reisinformatie Pull Applicatie Actuele LandelijkeBerichten Soap Service</wsdl:documentation>
        </wsdl:port>
    </wsdl:service>
</wsdl:definitions>

note: two .xsd's not included


Solution

  • Right, we've decided to generate the code with CXF (which works) and then add that to the delivery file.

    Also, another team at our company ran into same problem and couldn't find a solution for this as well.

    So, the answer seems to be: use CXF.