Hi, I tried to follow Paul's advice, but the results weren't as expected: I had no entries of my EnumTest class in the WSDL and WSDD files. My class looked as follows:
public class EnumTest implements Serializable { private String value = null; // Constructor protected EnumTest(String value) { this.value = value; } public static final EnumTest TEST_1 = new EnumTest("test1"); public String getValue() { return this.value; } public static EnumTest fromValue(String value) { return null; } public static EnumTest fromString(String value){ return null; } public String toString() { return this.value; } public boolean equals(Object obj) { if (obj == null) { return false; } return this.value.equals(obj.toString()); } public int hashCode() { return this.value.hashCode(); } } It seems that I am still missing the idea :-/ Regards, Ulrich axis-user@ws.apache.org schrieb am 28.02.05 18:41:21: Or you can read in the jax-rpc spec 1.1 on how to write the java 1.4 enums in such a way that the axis engine will generate an enum that anne gave an example for... mainly the following: //Java public class <enumeration_name> { // ... // Constructor protected <enumeration_name>(<base_type> value) { ... } // One for each label in the enumeration public static final <base_type> _<label> = <value>; public static final <enumeration_name> <label> = new <enumeration_name>(_<label>); // Gets the value for a enumerated value public <base_type> getValue() {...} // Gets enumeration with a specific value // Required to throw java.lang.IllegalArgumentException if // any invalid value is specified public static <enumeration_name> fromValue(<base_type> value) { ... } // Gets enumeration from a String // Required to throw java.lang.IllegalArgumentException if // any invalid value is specified public static <enumeration_name> fromString(String value){ ... } // Returns String representation of the enumerated value public String toString() { ... } public boolean equals(Object obj) { ... } public int hashCode() { ... } } > -----Original Message----- > From: Anne Thomas Manes [mailto:[EMAIL PROTECTED] > Sent: Montag, 28. Februar 2005 16:41 > To: axis-user@ws.apache.org > Subject: Re: Using axis ant task with typed enums > > > Ulrich, > > First of all, WSDL does not contain any "class" descriptions. WSDL > contains element and type descriptions -- specified using XML Schema. > If you read through the archives, you will see frequent > recommendations to take a "WSDL first" or "Schema first" approach to > web services rather than a "Java first" approach. > > Here is an example of a definition of simple type that is an > enumeration of string values: > > <xs:simpleType name="MyEnum"> > <xs:restriction base="xs:string"> > <xs:enumeration value="value1"/> > <xs:enumeration value="value2"/> > </xs:restriction> > </xs:simpleType> > > Anne > > > On Sun, 27 Feb 2005 23:20:30 +0100, Ulrich Ackermann > <[EMAIL PROTECTED]> wrote: > > Hi, > > > > in the meantime I came to the conclusion, that my question > has no solution that could satisfy me. I fear that there is > no way to create a WSDL file containing a class description, > where the class contains just public static members (or does > the WSDL spec offer a way to express such things?). > > > > Could anyone confirm my assumption? Is there an alternative > way to restrict the value of a method parameter to a set of > predefined String values? > > > > Regards, > > Ulrich > > > > axis-user@ws.apache.org schrieb am 27.02.05 00:08:00: > > > > Hi, > > > > I have a problem using something like typed enums in the > signature of my webservice methods (don't know if 'typed > enums' is the right term). > > > > E.g.: > > public class MyEnum { > > private String attribute = null; > > > > public static MyEnum VALUE_1 = new MyEnum("value1"); > > // other static values go here > > > > private MyEnum(String attribute) { > > this.attribute = attribute; > > } > > > > // other methods like toString() go here > > } > > > > Now, if I have a method like this in my interface... > > public void myMethod(String someParam, MyEnum otherParam); > > > > ... and run the axis-java2wsdl ant task, the MyEnum class > looks quit different than before: axis-java2wsdl added some > attributes and implemented the equals and hashcode methods > (which is quite ok I guesss...) and removed everything I > typed in before in the MyEnum class (which is not ok - at > least for me). > > But maybe this has a reason, and as I'm quite new to > webservices this is a feature and not a flaw. > > Is there a way to keep the intention of the MyEnum class > and let the axis ant task generate what I intended? > > > > I use the ant task in this way: > > <axis-java2wsdl > > > output="${project.webservice.wsdl.dir}/${project.webservice.ws > dl.filename}" > > > location="http://${project.webservice.host}:${project.webservi > ce.port}/axis/services/${project.webservice.service.namespace}" > > namespace="${project.webservice.service.name}" > > > classname="${project.webservice.endpoint.package.structure}"> > > <classpath> > > <path refid="axis.lib.path" ></path> > > </classpath> > > <mapping namespace="service" package="service"/> > > </axis-java2wsdl> > > > > Regards, > > Ulrich > > > > ______________________________________________________________ > > Verschicken Sie romantische, coole und witzige Bilder per SMS! > > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 > > > > ______________________________________________________________ > > Verschicken Sie romantische, coole und witzige Bilder per SMS! > > Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193 > > > > > > . > . ______________________________________________________________ Verschicken Sie romantische, coole und witzige Bilder per SMS! Jetzt bei WEB.DE FreeMail: http://f.web.de/?mc=021193