Enumeration Prevention in Java XML Web Services

I love Enumtype safety and also makes the code more readable. I always use Enumwhenever I get a chance.

The problem started when I needed to expose these codes as web services. For example, if I have an enumeration like this:

public enum Language {
    ENGLISH(1),
    BAHASA_MALAYSIA(2);
}

It will be shown in wsdl as follows:

<xs:simpleType name="language">
<xs:restriction base="xs:string">
  <xs:enumeration value="ENGLISH"/>
  <xs:enumeration value="BAHASA_MALAYSIA"/>
  </xs:restriction>
</xs:simpleType>

If in the future, if I want to add a new language, I will have problems, the wsdl file will be different and it will break old clients.

My question is, how can I prevent enum from being enumerated as enum in wsdl? I want it to display as a simple data type: Stringor int.

I use JBoss WS if that matters.

+3
1

, , , wsdl .

, ( ) . . , , XML- XML-.

, , JBoss-WS WSDL XSD. . , ( WSDL XSD ). , WSDL XSD JBossWS .

, JBoss-WS - , , JAX-B. JAX-B - , XSD.

+6

All Articles