Question

I 'm trying to generate a Java SOAP client using 'wsimport', for this WebService:

https://mutalyzer.nl/services/?wsdl

I'm getting an error because there are two nodes named 'transcriptInfo' and 'TranscriptInfo':

[ERROR] A class/interface with the same name "nl.mutalyzer._2_0.services.TranscriptInfo" is already in use. Use a class customization to resolve this conflict. line 2 of https://mutalyzer.nl/services/?wsdl

I used the wsimport parameter -B-XautoNameResolution and didn't work:

[ERROR] Two declarations cause a collision in the ObjectFactory class. line 2 of ...

I'm trying to do a Class customizacion. I' m using a bindings file named 'nameCorrections.xml' containing:

<jaxws:bindings
    wsdlLocation="https://mutalyzer.nl/services/?wsdl"
    xmlns:xs="http://www.w3.org/2001/XMLSchema" 
    xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
    xmlns:jaxws="http://java.sun.com/xml/ns/jaxws">
    <jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema/xs:complexType[@name='transcriptInfo']">
        <jaxws:class name="TranscriptInfoByNM"/>
    </jaxws:bindings>
</jaxws:bindings>

It's not working, when i run:

wsimport -b nameCorrections.xml http... (WDSL URL, I cannot post more than two links)

I got this error:

[WARNING] s4s-elt-invalid-content.1: The content of 'transcriptInfo' is invalid. Element 'bindings' is invalid, misplaced, or occurs too often. line ? of htt.... What am I doing wrong?

Was it helpful?

Solution

It seeems that I should have used 'jaxb' Bindings instead of 'jaxws' ones. Finally, I got wsimport working fine with this bindings file:

<jaxws:bindings
wsdlLocation="https://mutalyzer.nl/services/?wsdl"
xmlns:xs="http://www.w3.org/2001/XMLSchema" 
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" 
xmlns:jaxws="http://java.sun.com/xml/ns/jaxws"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb">
<jaxws:bindings node="wsdl:definitions/wsdl:types/xs:schema">
    <jaxb:bindings node="//xs:complexType[@name='transcriptInfo']">
        <jaxb:class name="TranscriptInfoByNM"/>
    </jaxb:bindings>
    <jaxb:bindings node="//xs:element[@name='transcriptInfo']">
        <jaxb:class name="ElementTranscriptInfoByNM"/>
    </jaxb:bindings>
</jaxws:bindings>

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top