You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-user@ws.apache.org by Dan Polivy <da...@hotmail.com> on 2001/11/06 17:20:52 UTC
Polymorphism and Serialization
Hello,
I have a question about how Apache SOAP works in regards to polymorphic
parameters. Say I have two return objects: one, named Response, is the
return object of my original, non-SOAP application (used in RMI
communication). The other, I have subclassed Response to be ResponseBean,
such that it supports the JavaBean pattern for all of its data members. I
have a method I am exporting as a Web Service that declares a return value
of Response, but actually returns ResponseBean objects that can be
serialized with the BeanSerializer. I have registered the BeanSerializer as
the (de)serializer for the ResponseBean type.
Now, my preliminary testing has shown that, despite the fact that I am
actually returning a ResponseBean object, I will get an
InvalidArgumentException because the Response object cannot be serialized.
In a more general test, declaring a return value of Object from a method,
yet returning a perfectly valid and serializable object also throws this
Exception. Thus it seems that Apache SOAP only looks at the method
declarations, as opposed to the actual objects, to find the proper
serializer. I have not looked through the source to confirm this, but that
might be my next step.
I think my question is this: is it possible to have Apache SOAP do type
detection on the actual object that is being serialized, as opposed to the
stated type in the method definition?
Thanks!
Dan
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
RE: Polymorphism and Serialization
Posted by "Hung D. Viet" <di...@epiqus.com>.
Currently, the BeanSerializer de/serializes an object based on declaration
type.
If you want it to use value type, then you need to modify it a bit. I have
done that to de/serialize polymorphism object, let me know if you need the
codes.
cheers,
Hung
-----Original Message-----
From: Dan Polivy [mailto:danpolivy@hotmail.com]
Sent: Wednesday, November 07, 2001 12:21 AM
To: soap-user@xml.apache.org
Subject: Polymorphism and Serialization
Hello,
I have a question about how Apache SOAP works in regards to polymorphic
parameters. Say I have two return objects: one, named Response, is the
return object of my original, non-SOAP application (used in RMI
communication). The other, I have subclassed Response to be ResponseBean,
such that it supports the JavaBean pattern for all of its data members. I
have a method I am exporting as a Web Service that declares a return value
of Response, but actually returns ResponseBean objects that can be
serialized with the BeanSerializer. I have registered the BeanSerializer as
the (de)serializer for the ResponseBean type.
Now, my preliminary testing has shown that, despite the fact that I am
actually returning a ResponseBean object, I will get an
InvalidArgumentException because the Response object cannot be serialized.
In a more general test, declaring a return value of Object from a method,
yet returning a perfectly valid and serializable object also throws this
Exception. Thus it seems that Apache SOAP only looks at the method
declarations, as opposed to the actual objects, to find the proper
serializer. I have not looked through the source to confirm this, but that
might be my next step.
I think my question is this: is it possible to have Apache SOAP do type
detection on the actual object that is being serialized, as opposed to the
stated type in the method definition?
Thanks!
Dan
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp
RE: Polymorphism and Serialization
Posted by "Hung D. Viet" <di...@epiqus.com>.
Currently, the BeanSerializer de/serializes an object based on declaration
type.
If you want it to use value type, then you need to modify it a bit. I have
done that to de/serialize polymorphism object, let me know if you need the
codes.
cheers,
Hung
-----Original Message-----
From: Dan Polivy [mailto:danpolivy@hotmail.com]
Sent: Wednesday, November 07, 2001 12:21 AM
To: soap-user@xml.apache.org
Subject: Polymorphism and Serialization
Hello,
I have a question about how Apache SOAP works in regards to polymorphic
parameters. Say I have two return objects: one, named Response, is the
return object of my original, non-SOAP application (used in RMI
communication). The other, I have subclassed Response to be ResponseBean,
such that it supports the JavaBean pattern for all of its data members. I
have a method I am exporting as a Web Service that declares a return value
of Response, but actually returns ResponseBean objects that can be
serialized with the BeanSerializer. I have registered the BeanSerializer as
the (de)serializer for the ResponseBean type.
Now, my preliminary testing has shown that, despite the fact that I am
actually returning a ResponseBean object, I will get an
InvalidArgumentException because the Response object cannot be serialized.
In a more general test, declaring a return value of Object from a method,
yet returning a perfectly valid and serializable object also throws this
Exception. Thus it seems that Apache SOAP only looks at the method
declarations, as opposed to the actual objects, to find the proper
serializer. I have not looked through the source to confirm this, but that
might be my next step.
I think my question is this: is it possible to have Apache SOAP do type
detection on the actual object that is being serialized, as opposed to the
stated type in the method definition?
Thanks!
Dan
_________________________________________________________________
Get your FREE download of MSN Explorer at http://explorer.msn.com/intl.asp