Hi Alex, hammm....... u are trying to have "Animal " class as the return type ,then according to your internal logic return a instance of it's subclass like Dog or Cat . AFAIK we can retrieve subclass of a any given class but I'm not sure is it possible to retrieve sub classes when you specify super class , So i don't think such feature available with Java2WSDL tool .
The simplest solution is to change your method signature to return a "Dog" instance , it will generate correct schema as i mention in my previous post . for a example , public Dog getDog () or public Dog getAnimal() will result in to a correct schema generation . Alternatively you may use JAX-WS services with Axis2 because JAXB define @XmlSeeAlso annotation [1] to archive your requirement. please refer link [2] also . Hope you can find any pointer from this . [1] -http://java.sun.com/javase/6/docs/api/javax/xml/bind/annotation/XmlSeeAlso.html [2]- http://weblogs.java.net/blog/kohlert/archive/2006/10/jaxws_and_type.html Thanks , On Tue, Mar 10, 2009 at 11:02 PM, Alexander Rosemann <[email protected]> wrote: > Hi Sagara, > > Sagara Gunathunga wrote: >> >> Hi Alex, >> AFAIK there is no special parameter required for this , according >> to method signatures of your service class, Java2WSDL generate correct >> schema for in/out messages . in your case it should generates types as >> follow. >> >> <xs:complexType name="Animal"> >> <xs:sequence> >> >> ........................................................ >> >> ........................................................ >> </xs:sequence> >> </xs:complexType> >> >> <xs:complexType name="Dog"> >> <xs:complexContent> >> <xs:extension base="ax21:Animal"> >> <xs:sequence> >> >> --------------------------------------------------------- >> >> --------------------------------------------------------- >> </xs:sequence> >> </xs:extension> >> </xs:complexContent> >> </xs:complexType> >> >> >> >> Anyway can you post method signatures of your service class...? >> >> >> Thanks , >> > > That's what I get from running Java2WSDL: > > <xs:schema xmlns:ax22="http://.../xsd" targetNamespace="http://..." > attributeFormDefault="qualified" elementFormDefault="qualified"> > <xs:import namespace="http://..."/> > <xs:element name="getAnimalResponse"> > <xs:complexType> > <xs:sequence> > <xs:element name="return" minOccurs="0" > type="ax22:Animal" nillable="true"/> > </xs:sequence> > </xs:complexType> > </xs:element> > </xs:schema> > <xs:schema targetNamespace="http://.../xsd" > attributeFormDefault="qualified" elementFormDefault="qualified"> > <xs:complexType name="Animal"> > <xs:sequence/> > </xs:complexType> > </xs:schema> > > The animal type is there. That's my service class: > > public class AnimalService { > > public Animal getAnimal() { > return new Dog(); > } > > } > > Thanks four help Sagara! > > -Alex > > -- Sagara Gunathunga Blog - http://ssagara.blogspot.com Web - http://sagaras.awardspace.com/
