If you're using the "typesafe Enum" idiom I'm not sure why you want a default public constructor. Really you only want a private (or protected) constructor which accepts whatever arguments you need for your enum instances, e.g. a description. A default public constructor is needed for BeanSerializerFactory I think, but here you should be using EnumSerializerFactory.
I start off with Rose-generated Java source and Java2WSDL it, then WSDL2Java it. After that I find I can continue doing Java2WSDL etc without harm - my Enums operate fine (I use them as service return values) and the operations do seem to "mirror image". In case it helps, below is some stuff related to one of my enums - the generated Java source, extract from generated WSDL and WSDD files. Steve Java source: /** * RequestStatusEnum.java * * This file was auto-generated from WSDL * by the Apache Axis WSDL2Java emitter. */ package com.erggroup.mass.fulfilmgr.requestservice; public class RequestStatusEnum implements java.io.Serializable { private java.lang.String _value_; private static java.util.HashMap _table_ = new java.util.HashMap(); // Constructor protected RequestStatusEnum(java.lang.String value) { _value_ = value; _table_.put(_value_,this); }; public static final java.lang.String _Unknown = "Unknown"; public static final java.lang.String _WaitingRequests = "WaitingRequests"; public static final java.lang.String _WaitingToSend = "WaitingToSend"; public static final java.lang.String _InProgress = "InProgress"; public static final java.lang.String _Completed = "Completed"; public static final java.lang.String _SystemError = "SystemError"; public static final RequestStatusEnum Unknown = new RequestStatusEnum(_Unknown); public static final RequestStatusEnum WaitingRequests = new RequestStatusEnum(_WaitingRequests); public static final RequestStatusEnum WaitingToSend = new RequestStatusEnum(_WaitingToSend); public static final RequestStatusEnum InProgress = new RequestStatusEnum(_InProgress); public static final RequestStatusEnum Completed = new RequestStatusEnum(_Completed); public static final RequestStatusEnum SystemError = new RequestStatusEnum(_SystemError); public java.lang.String getValue() { return _value_;} public static RequestStatusEnum fromValue(java.lang.String value) throws java.lang.IllegalStateException { RequestStatusEnum enum = (RequestStatusEnum) _table_.get(value); if (enum==null) throw new java.lang.IllegalStateException(); return enum; } public static RequestStatusEnum fromString(java.lang.String value) throws java.lang.IllegalStateException { return fromValue(value); } public boolean equals(java.lang.Object obj) {return (obj == this);} public int hashCode() { return toString().hashCode();} public java.lang.String toString() { return _value_;} } WSDL bits: <simpleType name="RequestStatusEnum"> <restriction base="xsd:string"> <enumeration value="Unknown"/> <enumeration value="WaitingRequests"/> <enumeration value="WaitingToSend"/> <enumeration value="InProgress"/> <enumeration value="Completed"/> <enumeration value="SystemError"/> </restriction> </simpleType> <element name="RequestStatusEnum" nillable="true" type ="impl:RequestStatusEnum"/> WSDD bits: <typeMapping xmlns:ns="http://requestservice.fulfilmgr.mass.erggroup.com" qname="ns:RequestStatusEnum" type ="java:com.erggroup.mass.fulfilmgr.requestservice.RequestStatusEnum" serializer="org.apache.axis.encoding.ser.EnumSerializerFactory" deserializer ="org.apache.axis.encoding.ser.EnumDeserializerFactory" encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" /> "Rajal Shah" <rashah@cisco To: <[EMAIL PROTECTED]> .com> cc: Subject: RE: Java2WSDL Enum handling question 20/12/2002 02:22 Please respond to axis-user Exactly.. I used the WSDL2Java tool to convert a Enum declaration to a Java class and I saw these 3 methods in it.. And you need to have one method at least which return "YourEnumClass" to get the schema in the WSDL, I think.. The thing is that, the outputted Java class from WSDL2Java did not have any default public constructor.. When I do a Java2WSDL conversion to if with my service it complains about it.. So clearly all it is not well with these 2 tools who are suppose to mirror image their behavior. (ps: standalone conversion back to Java works, but not when I add it as a parameter to my method in the service). As a service provider for my division, when someone gives me an interface to publish as a service, I am detailing out a process where the recommended step is to generate WSDL manually (through WSDL Editors or hand-written) instead of using the Java2WSDL tool and then use the WSDL2Java tool for the client stubs. This way the WSDL is accurate to what we want and the client stubs actually generate the client interface that we want them to use.. (The fidelity of Java2WSDL and then back to Java is not accurate at times, as per my observation). The side benefit of this approach is that at Cisco we have a lot of Perl applications who would be talking to the service. And Perl's SOAP::Lite package works directly off the WSDL. Thus accurately defining the WSDL - as opposed to auto generating it - may be the right way to go. Thanks for all the help. -- Rajal -----Original Message----- From: Steve Kinsman [mailto:[EMAIL PROTECTED]] Sent: Thursday, December 19, 2002 12:35 AM To: [EMAIL PROTECTED] Subject: RE: Java2WSDL Enum handling question Hi, I missed previous posts on this, and I'm not sure what your exact problem is but maybe the following will help. I develop using Java2WSDL then WSDL2Java, and found that for this to work with enums correctly the original java source needed to have: - a getValue() method - String getValue() - a fromValue() method - YourEnumClass fromValue(String) - a fromString() method - YourEnumClass fromString(String) Try defining these in your enum class and see how you go! Steve <Eirik.Wahl@b ravida.no> To: <[EMAIL PROTECTED]> cc: 19/12/2002 Subject: RE: Java2WSDL Enum handling question 16:16 Please respond to axis-user Hi Rajal! I'm aiming at doing the same, but have had no time yet to look into this. Since nobody else has answered, I wanted to give you this hint (although no solution ... yet): Maybe a way to go is to try this text in your WSDL file, and use WSDL2Java to see what kind of Java code it generates? The output is hopefully something java2wsdl expects as input. On 2002-09-23, 16:35 "Harish Prabandham" wrote: >Hi, > >I defined a simpleType in wsdl that looks something like this: > > > <xsd:simpleType name="PlanType"> > <xsd:restriction base="xsd:int"> > <xsd:enumeration name="Gold" value="0"/> > <xsd:enumeration name="Silver" value="1"/> > <xsd:enumeration name="Bronze" value="2"/> > </xsd:restriction> > </xsd:simpleType> > >The resulting wsdl2java generated code does not make use of the "Gold", >"Silver", "Bronze". Is there a way I can associate user defined identifiers >within the generated code instead of value0, value1 etc. that get generated >by default. > > >Thx. > > >Harish Not much to go on, but could be a way out. Would have tried this myself, if it wasn't for that I have too little time nowadays. Please let me know if you find something usefull out from this. By the way: The question from Harish is till unanswered (as far as I know). Regards, Eirik > -----Original Message----- > From: Rajal Shah [mailto:[EMAIL PROTECTED]] > Sent: 17. desember 2002 20:02 > To: Axis User Mailing List > Subject: Java2WSDL Enum handling question > > > I've read the discussion thread on enums on this list.. It > still doesn't > solve my problem. > > I am using the type-safe enumeration in my java class (code > included below) > and am hoping to get an enumeration mapping in the WSDL using > the java2wsdl > tool. But I am unable to produce it.. Any help in figuring > out what I'm > doing wrong would be helpful. > > public final class SearchType { > > //this is the dummy constructor requirement for Java2WSDL to work. > public SearchType() { > this.name = "COMPANY_SEARCH"; > } > > private SearchType(String name) { > this.name = name; > } > > private final String name; > > public static final SearchType COMPANY_SEARCH = > new SearchType ("COMPANY_SEARCH"); > public static final SearchType SITE_SEARCH = > new SearchType("SITE_SEARCH"); > public static final SearchType XYZ_SEARCH = new > SearchType("XYZ_SEARCH"); > > public final String toString() { > return name; > } > } > -- > Rajal > > >