If you generate your client from a wsdl (with wsdl2java) make sure that your
derived types are declared in.
<complexType abstract="true" name="Shape">
<sequence>
<element name="size" type="xsd:int"/>
....
</sequence>
</complexType>
<complexType name="Square">
<complexContent>
<extension base="tns1:Shape">
<sequence>
....
</sequence>
</extension>
</complexContent>
</complexType>
Christophe
> -----Original Message-----
> From: Zhou Jian Han [mailto:[EMAIL PROTECTED]
> Sent: Thursday, October 21, 2004 1:02 PM
> To: [EMAIL PROTECTED]
> Subject: Does Axis support polymorphism (dynamic send back the derived
> class)
>
> Hi,
> I have a based class named Shape, and a derived class named Square( Square
> extends Shape).
> Is that possible I declare a method in service:
> public Shape getShape(int type) throws RemoteException
> and send back the Square Object?
>
> By the way, I use gSoap(c/c++ soap) on server side, and apache Axis on
> client side, it looks like server send out the Square object, but client
> is not recognize the derived object, it is complain about "Invalid element
> in Shape- Square.size" (and 'size' is the field in Square, not in Shape).
>
> Does any one have sample that polymorphism is working in Java Axis?
>
> Thanks in Advance!
> Georgia