You're not in a good way here; the problem is that Java's enumerations and iterators are written to return generic Object references, which is why java2wsdl is generating xsd:any elements for the enumerator.
This is also thinking in very "object"-ish terms, which I would suggest is not the best way to go about building a web service. Start from WSDL and Schema, and work your way out from there. Doing so, for example, reveals that if you do this enumeration approach, you'll be making a LOT of trips back to the server for each element. Instead, prefer a more coarse-grained approach and return the complete collection across the wire all at once, or else in large "chunks" so that you're not making a network call for each element. Remember, Web services != CORBA or RMI all over again, despite what you're hearing from the vendors and hype channels. Ted Neward Author, Instructor, Presenter: Java and .NET http://www.neward.net/ted -----Original Message----- From: BLIS Webmaster (Patrick Houbaux) [mailto:[EMAIL PROTECTED] Sent: Wednesday, March 24, 2004 12:36 AM To: [EMAIL PROTECTED] Subject: Re: How to get Enumerations in WSDL? Hi all, Has anybody any hints on my question? Patrick. BLIS Webmaster (Patrick Houbaux) wrote: > Dear all, > > I have the following design for my object datatype model I want to > expose from my web service: > > ==== > public class MyClass { > MyClassTypeEnum myClassType; > > public MyClassTypeEnum getMyClassType(){ > return myClassType; > } > > public void setMyClassType(MyClassTypeEnum type_){ > this.myClassType = type_; > } > } > > ==== > > public class MyClassTypeEnum { > > private String typeName; > > private MyClassTypeEnum () { > } > private MyClassTypeEnum (String typeName_){ > this.typeName = typeName_; > } > public static final MyClassTypeEnum TESTENUM = new > MyClassTypeEnum("TESTENUM"); > public static final MyClassTypeEnum TESTENUM2 = new > MyClassTypeEnum("TESTENUM2"); > } > > ===== > > How can I get java2wsdl to generate an XML enumeration for my typesafe > enumeration (MyClassTypeEnum) in the generated WSDL? > > For now, I don't get anything for MyClassTypeEnum and for MyClass I get > the following: > > <complexType name="MyClass"> > <sequence> > <element name="myClassType" nillable="true" > type="xsd:anyType"/> > </sequence> > </complexContent> > > I would like the "xsd:anyType" to be replaced with a nice XSD > enumeration corresponding to MyClassTypeEnum. > Is it possible at all? > Any idea out there? if yes how should I do to get it right (design > modification, flag passed to java2wsdl, etc ...)? > Thanks. > Regards, > Patrick. > >