You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@xml.apache.org by Anver Sotnikov <AS...@intralinks.com> on 2001/05/17 19:59:19 UTC

Polymorphism

I've read some messages about polymorphism in this distribution list and 
the issue were - SOAP does not allow to return subclass of class defined 
in return clause. So if I return Child from the method Parent getObject() 
then on client side Parent object will be created and it can not be casted 
to Child object because SOAP will pass only Parent attributes.

But at the same time if I return array of Children from method returning 
array of Parents ( Parent[] getObjects())then it will work fine and I will 
be able to cast these objects to Children.

So there is a discrepancy between returning Parent and Parent[]. And I 
believe it should be solved to allow to return Child from method returning 
Parent and to be able to cast it to Child on client-side.

Code: RPCRouter.java

        Method m = MethodUtils.getMethod (targetObject, call.getMethodName 
(),
                                          argTypes);
        result = new Bean (m.getReturnType (), m.invoke (targetObject, 
args));
//      it pass return type instead of actual type of returned object.