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 Ray Weng <RW...@ariba.com> on 2001/05/18 17:36:30 UTC

RE: Using SOAP libs to encode/decode java objects into/from XML f iles - but I want this to be automatic

Hi Scott,

If so, what happened if the client side does not like to use bean? The
client's object graph are so different from the server's responding 
object thus I guess I'd need to write a deserializer to directly 
decode the receiving SOAP message to client's objects. 
Can you give me some hints?

thanks,
Ray



-----Original Message-----
From: Scott Nichol [mailto:snichol@computer.org]
Sent: Friday, May 18, 2001 7:17 AM
To: soap-dev@xml.apache.org
Subject: Re: Using SOAP libs to encode/decode java objects into/from XML
files - but I want this to be automatic


Oscar,

The BeanSerializer is close to what you are looking for.  It uses
introspection to determine the "properties" of a class, which it uses to
serialize and de-serialize instances thereof.  However, as discussed
previously on this list, it handles polymorphism in a manner that may be
undesirable for your purposes.  Specifically, it serializes properties based
on the type information from introspection, not the type of an instance.

Of course, being introspection-based, the BeanSerializer requires that the
classes you are working with are beans, specifically that they have accessor
and mutator methods that define the "properties" of instances of that class.
Since you apparently do not want to be limited to using beans, the
BeanSerializer does not address your needs.

Scott

----- Original Message -----
From: "Marquez, Oscar" <os...@sapmarkets.com>
To: <so...@xml.apache.org>
Sent: Thursday, May 17, 2001 7:10 PM
Subject: RE: Using SOAP libs to encode/decode java objects into/from XML
files - but I want this to be automatic


> Hi Thanks
>
> But I was looking for something more dynamic, I would using like
> something to convert a java Object into a XML by using the reflection API.
I
> wouldn't like to all this work by hand.
>
> I was thinking that for the SOAP Protocol, you were converting the
> java objects into XML using some automatic mechanic based on the
reflection
> API. It this right?
>
> Regards,
> Oscar.
>
> -----Original Message-----
> From: Naggi Rao [mailto:naggi@softhome.net]
> Sent: Thursday, May 17, 2001 3:29 PM
> To: soap-dev@xml.apache.org
> Subject: Re: Using SOAP libs to encode/decode java objects into/from XML
> files
>
>
> Hi ,
> Have a look at the getAddressFromName() method in the addressBook example.
>
> Cheers,
> Naggi
>
>
> ----- Original Message -----
> From: "Marquez, Oscar" <os...@sapmarkets.com>
> To: <so...@xml.apache.org>
> Sent: Thursday, May 17, 2001 1:32 PM
> Subject: Using SOAP libs to encode/decode java objects into/from XML files
>
>
> > Hi SOAP Group
> >
> > I would like to know something that I guess you have already solved.
> > How to convert a java object into a XML and how to read the object back.
> >
> > I don't know much about SOAP, but I have been using jBoss.org, and
> > it works pretty well. But now I need to create a XML file to store some
> > objects.
> >
> > I have tried to use XMLEncoder and XMLDecoder from the java.bean
> > package under the jsr-000057 spec but it doesn't seem to work right,
also
> > you have to do a lot of work, you need the objects to be javabeans. I
> tried
> > JSX from http://freshmeat.net/projects/jsx, it works much better, but I
> > can't read the objects back.
> >
> > Doesn't SOAP comes with some encoder/decoder. I guess so, but I need
> > to get them, how can I get them? how to use them to accomplish this?
> >
> > Regards,
> > Oscar
> >
> >



Re: Using SOAP libs to encode/decode java objects into/from XML f iles - but I want this to be automatic

Posted by Scott Nichol <sn...@computer.org>.
Ray,

I am not *exactly* certain what your question is.  Are you asking about the
effect of BeanSerializer using introspection types rather than actual
instance types?  If that is the case, here is my advice.  If you have a bean
for which you use polymorphism for one or more properties, write a custom
serializer and deserializer.

If you are asking a different question, please excuse my inability to
understand it and try asking again.

Scott

----- Original Message -----
From: "Ray Weng" <RW...@ariba.com>
To: <so...@xml.apache.org>
Sent: Friday, May 18, 2001 11:36 AM
Subject: RE: Using SOAP libs to encode/decode java objects into/from XML f
iles - but I want this to be automatic


> Hi Scott,
>
> If so, what happened if the client side does not like to use bean? The
> client's object graph are so different from the server's responding
> object thus I guess I'd need to write a deserializer to directly
> decode the receiving SOAP message to client's objects.
> Can you give me some hints?
>
> thanks,
> Ray
>
>
>
> -----Original Message-----
> From: Scott Nichol [mailto:snichol@computer.org]
> Sent: Friday, May 18, 2001 7:17 AM
> To: soap-dev@xml.apache.org
> Subject: Re: Using SOAP libs to encode/decode java objects into/from XML
> files - but I want this to be automatic
>
>
> Oscar,
>
> The BeanSerializer is close to what you are looking for.  It uses
> introspection to determine the "properties" of a class, which it uses to
> serialize and de-serialize instances thereof.  However, as discussed
> previously on this list, it handles polymorphism in a manner that may be
> undesirable for your purposes.  Specifically, it serializes properties
based
> on the type information from introspection, not the type of an instance.
>
> Of course, being introspection-based, the BeanSerializer requires that the
> classes you are working with are beans, specifically that they have
accessor
> and mutator methods that define the "properties" of instances of that
class.
> Since you apparently do not want to be limited to using beans, the
> BeanSerializer does not address your needs.
>
> Scott
>
> ----- Original Message -----
> From: "Marquez, Oscar" <os...@sapmarkets.com>
> To: <so...@xml.apache.org>
> Sent: Thursday, May 17, 2001 7:10 PM
> Subject: RE: Using SOAP libs to encode/decode java objects into/from XML
> files - but I want this to be automatic
>
>
> > Hi Thanks
> >
> > But I was looking for something more dynamic, I would using like
> > something to convert a java Object into a XML by using the reflection
API.
> I
> > wouldn't like to all this work by hand.
> >
> > I was thinking that for the SOAP Protocol, you were converting the
> > java objects into XML using some automatic mechanic based on the
> reflection
> > API. It this right?
> >
> > Regards,
> > Oscar.
> >
> > -----Original Message-----
> > From: Naggi Rao [mailto:naggi@softhome.net]
> > Sent: Thursday, May 17, 2001 3:29 PM
> > To: soap-dev@xml.apache.org
> > Subject: Re: Using SOAP libs to encode/decode java objects into/from XML
> > files
> >
> >
> > Hi ,
> > Have a look at the getAddressFromName() method in the addressBook
example.
> >
> > Cheers,
> > Naggi
> >
> >
> > ----- Original Message -----
> > From: "Marquez, Oscar" <os...@sapmarkets.com>
> > To: <so...@xml.apache.org>
> > Sent: Thursday, May 17, 2001 1:32 PM
> > Subject: Using SOAP libs to encode/decode java objects into/from XML
files
> >
> >
> > > Hi SOAP Group
> > >
> > > I would like to know something that I guess you have already solved.
> > > How to convert a java object into a XML and how to read the object
back.
> > >
> > > I don't know much about SOAP, but I have been using jBoss.org, and
> > > it works pretty well. But now I need to create a XML file to store
some
> > > objects.
> > >
> > > I have tried to use XMLEncoder and XMLDecoder from the java.bean
> > > package under the jsr-000057 spec but it doesn't seem to work right,
> also
> > > you have to do a lot of work, you need the objects to be javabeans. I
> > tried
> > > JSX from http://freshmeat.net/projects/jsx, it works much better, but
I
> > > can't read the objects back.
> > >
> > > Doesn't SOAP comes with some encoder/decoder. I guess so, but I need
> > > to get them, how can I get them? how to use them to accomplish this?
> > >
> > > Regards,
> > > Oscar
> > >
> > >
>
>
>