You are viewing a plain text version of this content. The canonical link for it is here.
Posted to soap-dev@ws.apache.org by "David C. Hicks" <dh...@machturtle.com> on 2000/12/08 22:16:09 UTC
Marshalling polymorphic objects.
Hi folks,
I have a need to marshall and unmarshall polymorphic objects. Upon
inspecting the classes in org.apache.soap.encoding.soapenc it seems
clear that I'll need to create my own serializer class to handle this
situation. I have an interface from which many different kinds of
objects may be implemented and I'd like to pass any of these over the
wire without having to write a new serializer for each. I have two
questions regarding this...
1) Just curious here...why are the Serializer/Deserializer interfaces
spec'd to return a Bean instead of an Object? (I understand that
BeanSerialier works with Beans, but ArraySerializer returns a Bean for
unmarshall?)
2) Has anyone else attempted to create a serializer for polymorphic
classes? If so, can you give me some hints about how you proceeded...in
fact, if you have working code that I could start from that would be
fabulous!
Thanks!
Dave
--
David C. Hicks
Mach Turtle Technologies, Inc. (www.machturtle.com)
dhicks@machturtle.com
770-753-8810
Re: Marshalling polymorphic objects.
Posted by Steven Pham <st...@luckyfind.com>.
Hi all,
Can someone clear up my confusion please ?
If I want to pass some complex Java objects via SOAP and if both sides are
Java:
Why don't we use the standard Java Object Serialization to encode/decode all
Java objects ?
Why does Java SOAP provide its own serialization special Vector and Array
serialization classes ?
Unless you use a mixed SOAP environments, for example Microsoft
SOAP Client talking to Apache SOAP server or vice versa.
If this is the case then all data must be pure XML representation.
I must be missing something here, please help...
Thanks,
Steven
"David C. Hicks" wrote:
> Hi folks,
>
> I have a need to marshall and unmarshall polymorphic objects. Upon
> inspecting the classes in org.apache.soap.encoding.soapenc it seems
> clear that I'll need to create my own serializer class to handle this
> situation. I have an interface from which many different kinds of
> objects may be implemented and I'd like to pass any of these over the
> wire without having to write a new serializer for each. I have two
> questions regarding this...
>
> 1) Just curious here...why are the Serializer/Deserializer interfaces
> spec'd to return a Bean instead of an Object? (I understand that
> BeanSerialier works with Beans, but ArraySerializer returns a Bean for
> unmarshall?)
>
> 2) Has anyone else attempted to create a serializer for polymorphic
> classes? If so, can you give me some hints about how you proceeded...in
> fact, if you have working code that I could start from that would be
> fabulous!
>
> Thanks!
> Dave
>
> --
> David C. Hicks
> Mach Turtle Technologies, Inc. (www.machturtle.com)
> dhicks@machturtle.com
> 770-753-8810
Re: Marshalling polymorphic objects.
Posted by Steven Pham <st...@luckyfind.com>.
Hi all,
Can someone clear up my confusion please ?
If I want to pass some complex Java objects via SOAP and if both sides are
Java:
Why don't we use the standard Java Object Serialization to encode/decode all
Java objects ?
Why does Java SOAP provide its own serialization special Vector and Array
serialization classes ?
Unless you use a mixed SOAP environments, for example Microsoft
SOAP Client talking to Apache SOAP server or vice versa.
If this is the case then all data must be pure XML representation.
I must be missing something here, please help...
Thanks,
Steven
"David C. Hicks" wrote:
> Hi folks,
>
> I have a need to marshall and unmarshall polymorphic objects. Upon
> inspecting the classes in org.apache.soap.encoding.soapenc it seems
> clear that I'll need to create my own serializer class to handle this
> situation. I have an interface from which many different kinds of
> objects may be implemented and I'd like to pass any of these over the
> wire without having to write a new serializer for each. I have two
> questions regarding this...
>
> 1) Just curious here...why are the Serializer/Deserializer interfaces
> spec'd to return a Bean instead of an Object? (I understand that
> BeanSerialier works with Beans, but ArraySerializer returns a Bean for
> unmarshall?)
>
> 2) Has anyone else attempted to create a serializer for polymorphic
> classes? If so, can you give me some hints about how you proceeded...in
> fact, if you have working code that I could start from that would be
> fabulous!
>
> Thanks!
> Dave
>
> --
> David C. Hicks
> Mach Turtle Technologies, Inc. (www.machturtle.com)
> dhicks@machturtle.com
> 770-753-8810
RE: Marshalling polymorphic objects.
Posted by Bernhard Dorninger <be...@scch.at>.
Hi
Reply inline..
> 1) Just curious here...why are the Serializer/Deserializer interfaces
> spec'd to return a Bean instead of an Object? (I understand that
> BeanSerialier works with Beans, but ArraySerializer returns a Bean for
> unmarshall?)
I suppose, this is because of supporting Null Values. you cant invoke
getClass() on null, so they have explicitly typed the return value of the
deserialiser.
> 2) Has anyone else attempted to create a serializer for polymorphic
> classes? If so, can you give me some hints about how you proceeded...in
> fact, if you have working code that I could start from that would be
> fabulous!
AFAIK ApacheSOAP demands a 1 to 1 mapping, i.e. each XML-Type represented by
a QName maps to a native Java Type.
If you transmit a certain data struct with its runtime type, ApacheSOAP can
find method signatures which contain supertypes of these.
regards
Bernhard
------------------
Bernhard Dorninger
Software Competence Center Hagenberg GmbH
Softwarepark Hagenberg, Hauptstraße 99
A-4232 Hagenberg, Austria
Tel.: +43 7236 3343 891
Fax: +43 7236 3343 888
mailto:bernhard.dorninger@scch.at
http://www.scch.at
RE: Marshalling polymorphic objects.
Posted by Bernhard Dorninger <be...@scch.at>.
Hi
Reply inline..
> 1) Just curious here...why are the Serializer/Deserializer interfaces
> spec'd to return a Bean instead of an Object? (I understand that
> BeanSerialier works with Beans, but ArraySerializer returns a Bean for
> unmarshall?)
I suppose, this is because of supporting Null Values. you cant invoke
getClass() on null, so they have explicitly typed the return value of the
deserialiser.
> 2) Has anyone else attempted to create a serializer for polymorphic
> classes? If so, can you give me some hints about how you proceeded...in
> fact, if you have working code that I could start from that would be
> fabulous!
AFAIK ApacheSOAP demands a 1 to 1 mapping, i.e. each XML-Type represented by
a QName maps to a native Java Type.
If you transmit a certain data struct with its runtime type, ApacheSOAP can
find method signatures which contain supertypes of these.
regards
Bernhard
------------------
Bernhard Dorninger
Software Competence Center Hagenberg GmbH
Softwarepark Hagenberg, Hauptstraße 99
A-4232 Hagenberg, Austria
Tel.: +43 7236 3343 891
Fax: +43 7236 3343 888
mailto:bernhard.dorninger@scch.at
http://www.scch.at