Domanda

I got a webservice description from an external source and have to build an interface with it.
This is not the problem, got it all working. Webservice Client is automatically generated using Eclipse and Axis.

But in that description I have something like this:

<xs:complexType name="Type">
    <xs:sequence>
        <xs:element minOccurs="0" name="Übersicht">
            ...
        </xs:element>
    </xs:sequence>  
</xs:complexType>

As you can see there is an Ü Umlaut in the element name.

When I'm generating the Webservice client in Eclipse, this will generate a Java class named Type_Übersicht.java. While this is not a problem for the compiler, it violates our code style rules. It is the only class in the whole workspace with a special char in it.

So, question:
Can I tell the Eclipse Webservice Generator to map given names or single characters into something else? Unfortunately changing the description is not an option...

È stato utile?

Soluzione

You can modify generated classes either by using hints in the XSD or by using a binding file although I'm not familiar with getting binding files working with the eclipse generator (I usually use the maven plugin). Try editing the XSD/WSDL like this

<xs:complexType name="Type">
 <xs:sequence>
    <xs:element minOccurs="0" name="Übersicht">
        <xs:annotation>
            <xs:appinfo>
                <jaxb:class name="Ubersicht"/>
            </xs:appinfo>
        </xs:annotation>
    </xs:element>
 </xs:sequence>  
</xs:complexType>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top