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 "DE STEUR Véronique (NORSYS)" <Ve...@lamondiale.com> on 2002/03/20 17:42:20 UTC

abstract class and heritage

Hello,

is it possible to use abstract class or heritage with Soap ?
I have a abstract class Contrat and 2 subclasses Contrat1 and Contrat2
(extends Contrat)

i would like to call a method which return Contrat and a methode with a
Contrat in parameter.
is it possible ? and how ? the problem is when soap transform xml in java :
it seems to want instantiate the abstract class !

thanks,
Véronique.

Re: abstract class and heritage

Posted by Scott Nichol <sc...@yahoo.com>.
I seem to recall that you can use polymorphism for parameters to a method in
Apache SOAP (your client code must specify the actual type of the value being
sent), but you cannot for the return value from the method, as the return value
will always be instantiated as the declared type.  I believe this topic was
discussed on this list some time ago, and some users have modified the code to
return the actual type, not the declared type.

As I recall, part of the discussion was also whether polymorphism was supported
in WSDL, although I do not remember the final thoughts on that.  In any case,
since it appears that SOAP and WSDL will become inextricably intertwined in
common usage, I think that if WSDL does not support it, polymorphic SOAP calls
will be rare.

Scott

----- Original Message -----
From: "DE STEUR Véronique (NORSYS)" <Ve...@lamondiale.com>
To: "Soap Developers (E-mail)" <so...@xml.apache.org>
Sent: Wednesday, March 20, 2002 11:42 AM
Subject: abstract class and heritage


Hello,

is it possible to use abstract class or heritage with Soap ?
I have a abstract class Contrat and 2 subclasses Contrat1 and Contrat2
(extends Contrat)

i would like to call a method which return Contrat and a methode with a
Contrat in parameter.
is it possible ? and how ? the problem is when soap transform xml in java :
it seems to want instantiate the abstract class !

thanks,
Véronique.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: abstract class and heritage

Posted by Scott Nichol <sc...@yahoo.com>.
I seem to recall that you can use polymorphism for parameters to a method in
Apache SOAP (your client code must specify the actual type of the value being
sent), but you cannot for the return value from the method, as the return value
will always be instantiated as the declared type.  I believe this topic was
discussed on this list some time ago, and some users have modified the code to
return the actual type, not the declared type.

As I recall, part of the discussion was also whether polymorphism was supported
in WSDL, although I do not remember the final thoughts on that.  In any case,
since it appears that SOAP and WSDL will become inextricably intertwined in
common usage, I think that if WSDL does not support it, polymorphic SOAP calls
will be rare.

Scott

----- Original Message -----
From: "DE STEUR Véronique (NORSYS)" <Ve...@lamondiale.com>
To: "Soap Developers (E-mail)" <so...@xml.apache.org>
Sent: Wednesday, March 20, 2002 11:42 AM
Subject: abstract class and heritage


Hello,

is it possible to use abstract class or heritage with Soap ?
I have a abstract class Contrat and 2 subclasses Contrat1 and Contrat2
(extends Contrat)

i would like to call a method which return Contrat and a methode with a
Contrat in parameter.
is it possible ? and how ? the problem is when soap transform xml in java :
it seems to want instantiate the abstract class !

thanks,
Véronique.


_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


Re: abstract class and heritage

Posted by Mark Childerson <ma...@childersoft.com>.
You have to make a custom serializer/deserializer which sends, along with 
the data, the identity of the concrete class you want to instantiate.

M.


At 05:42 PM 3/20/02 +0100, you wrote:
>Hello,
>
>is it possible to use abstract class or heritage with Soap ?
>I have a abstract class Contrat and 2 subclasses Contrat1 and Contrat2
>(extends Contrat)
>
>i would like to call a method which return Contrat and a methode with a
>Contrat in parameter.
>is it possible ? and how ? the problem is when soap transform xml in java :
>it seems to want instantiate the abstract class !
>
>thanks,
>Véronique.



Re: abstract class and heritage

Posted by Mark Childerson <ma...@childersoft.com>.
You have to make a custom serializer/deserializer which sends, along with 
the data, the identity of the concrete class you want to instantiate.

M.


At 05:42 PM 3/20/02 +0100, you wrote:
>Hello,
>
>is it possible to use abstract class or heritage with Soap ?
>I have a abstract class Contrat and 2 subclasses Contrat1 and Contrat2
>(extends Contrat)
>
>i would like to call a method which return Contrat and a methode with a
>Contrat in parameter.
>is it possible ? and how ? the problem is when soap transform xml in java :
>it seems to want instantiate the abstract class !
>
>thanks,
>Véronique.