JAXB generated class - JAXB unmarshalling exception

Viewed 67

I'm generating all my models for my soap calls using maven-jaxb2-plugin plugin version 0.14.0. It works fine but if I have an empty request/response it doesn't generate the java class, for example:

<wsdl:message name="exampleResponse"/>

For this tag from my wsdl the jaxb2 plugin doesn't generate any class.

I am using Spring Boot 2 with WebServiceTemplate, the request is successfully sent, but I'm getting an exception when the trying to unmarshal the response:

JAXB unmarshalling exception; nested exception is javax.xml.bind.UnmarshalException: unexpected element (uri:"myUri", local:"exampleResponse"

And the actual result is:

<?xml version='1.0' encoding='UTF-8'?>
<soapenv:Envelope xmlns:soapenv=http://schemas.xmlsoap.org/soap/envelope/>
    <soapenv:Body>
        <ns:exampleResponse xmlns:ns=myuri?wsdl>
            <ns:return xmlns:xsi=http://www.w3.org/2001/XMLSchema-instance xsi:nil="true" />
        </ns:exampleResponse >
    </soapenv:Body>
</soapenv:Envelope>

Here are my configurations:

<configuration>
    <args>
        <arg>-XautoNameResolution</arg>
    </args>
    <schemaLanguage>WSDL</schemaLanguage>
    <generatePackage>my.package</generatePackage>
    <generateDirectory>src/main/java</generateDirectory>
    <schemas>
        <schema>
            <url>my-url?wsdl</url>
        </schema>
    </schemas>
</configuration>

Is there a way to force maven-jaxb2-plugin to generate the java classes for empty tags from wsdl?

PS: I cannot change in any way the wsdl.

Thanks

0 Answers
Related