I'm trying to run wsimport against a WSDL file that I cannot modify. A portion of the WSDL looks like this:
<xsd:complexType name="Bapiitemex">
<xsd:sequence>
<xsd:element name="ItmNumber" type="n0:numeric6"/>
<xsd:element name="PoItmNo" type="n0:char6"/>
<xsd:element name="Material" type="n0:char18"/>
<xsd:element name="MatEntrd" type="n0:char18"/>
<xsd:element name="ShortText" type="n0:char40"/>
<xsd:element name="NetValue" type="n0:numeric15"/>
<xsd:element name="Currency" type="n0:cuky5"/>
<xsd:element name="Subtotal1" type="n0:numeric15"/>
<xsd:element name="Subtotal2" type="n0:numeric15"/>
<xsd:element name="Subtotal3" type="n0:numeric15"/>
<xsd:element name="Subtotal4" type="n0:numeric15"/>
<xsd:element name="Subtotal5" type="n0:numeric15"/>
<xsd:element name="Subtotal6" type="n0:numeric15"/>
<xsd:element name="SUBTOTAL1" type="n0:decimal23.4"/>
<xsd:element name="SUBTOTAL2" type="n0:decimal23.4"/>
<xsd:element name="SUBTOTAL3" type="n0:decimal23.4"/>
<xsd:element name="SUBTOTAL4" type="n0:decimal23.4"/>
<xsd:element name="SUBTOTAL5" type="n0:decimal23.4"/>
<xsd:element name="SUBTOTAL6" type="n0:decimal23.4"/>
</xsd:sequence>
</xsd:complexType>
wsimport is unhappy due to the inclusion of multiple elements which differ only in case ('Subtotal1' versus 'SUBTOTAL1', etc.). The specific error is
java.lang.IllegalArgumentException: trying to create the same field twice: subtotal1
In researching a solution to this problem, I tried running wsimport with the '-B-XautoNameResolution' option, but that had no effect. It seems the only other possible solution is to use an external binding file to explicitly tell wsimport how to name the variables. However, I'm having difficulty making that work as well. Here is the binding file I'm attempting to use just for one of the duplicate variables:
<jxb:bindings version="1.0"
xmlns:jaxb="http://java.sun.com/xml/ns/jaxb"
xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
xmlns:xsd="http://www.w3.org/2001/XMLSchema">
<jxb:bindings node="//xsd:complexType[@name='Bapiitemex']//xsd:element[@name='Subtotal1']">
<jxb:property name="testSubtotal1"/>
</jxb:bindings>
Try as I might, wsimport doesn't seem to understand what I'm asking it to do. It's unhappy with the XPath syntax I'm using for the 'node' attribute, returning the error:
XPath evaluation of "//xsd:complexType[@name='Bapiitemex']//xsd:element[@name='Subtotal1']" results in empty target node
Suggestions as to how I can persuade wsimport to generate my Java classes for me?