Axis2 AFAIK does not support enum. For one thing Axis2 at minimum needs to compile with java 1.4 . What you may consider is using Enum's per XML Schema. I myself just pass in an Integer defined in WSDL. So for example with this Enum:
public enum TipoMib implements Serializable{ MIB2, MIB_GERENCIA, MIB_ESPECIFICA; } I do the conversion as: private static TipoMib getTipoMib(Integer ordinal) { if (TipoMib.MIB2.ordinal() == ordinal) { return TipoMib.MIB2; } else if (TipoMib.MIB_ESPECIFICA.ordinal() == ordinal) { return TipoMib.MIB_ESPECIFICA; } else if (TipoMib.MIB_GERENCIA.ordinal() == ordinal) { return TipoMib.MIB_GERENCIA; } else return null; } To convert the other way I do tipoMib.ordinal() - see the javadoc of Enum about ordinal() . HTH, Robert On 12/7/06, Johnson, Larry D (LJOHNSON) <[EMAIL PROTECTED]> wrote:
Can anyone give me guidance on this question? Does Axis2 support the Java 1.5 'enum' keyword? If not, what is the recommended Axis2 "best practices" for enumerated types? Is it the use of the "type safe enum" pattern, or something else? Any help would be appreciated. Again, thanks for any response. ________________________________ From: Johnson, Larry D (LJOHNSON) [mailto:[EMAIL PROTECTED] Sent: Wednesday, December 06, 2006 9:40 AM To: axis-user@ws.apache.org Subject: Java 5 Enum Support I am new to Axis2 and am trying to develop a web service using Axis 2 v1.1, Java 1.5 and the POJO approach. The service POJO that I developed uses the keyword "enum" for many different attribute "types". I am able to successfully generate WSDL from the POJO; however, when I try to create the client, via "wsdl2java" I receive the following errors: Exception in thread "main" org.apache.axis2.wsdl.codegen.CodeGenerationException: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException [snip] Caused by: java.lang.RuntimeException: org.apache.xmlbeans.XmlException: error: Invalid QName value: Localname not a valid NCName in 'ax241:CLFService$CLFCommandType' [snip] I have tried several tricks to make the enum more visible to the service; however, in all cases I continue to receive the above error (only the name of the invalid NCName changes). My question is; does Axis2 v1.1 support the Java 1.5 "enum" keyword? If so, how do I make the WSDL generator recognize it? I have seen several posts in the mailing-list archives about Axis v1.3; however, none since Axis2 was released. Most of the Axis1 posts were requesting this feature. Has this been introduced? Also, if "enum" is not supported, do you recommend using the "type safe enum pattern" to solve this problem? I have also seen posts where people were having problems with that pattern as well. What is the recommended Axis2 "best practices" approach to solve this? Many thanks for the response.
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]