axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brent Johnson <>
Subject Re: Newbie: Sending/Receiving Beans with BeanSerializer
Date Mon, 02 Aug 2004 19:35:14 GMT
Ahh.. so just return the bean that I want.. and I'm guessing I should
use call.setReturnClass(MyBean.class) instead of setReturnType?

Also.. I'm changing my beans to not use collections and use arrays
instead.  Can I use arrays of beans in my bean though?  Example:

public class MyBean() {
    private Attribute[] attributes;

    public MyBean() {

    public Attribute[] getAttributes() { return(this.attributes); }
    public void setAttributes(Attribute[] param) { this.attributes = param; }

And the Attribute class is just a bean that has a String name, and String value.

When I try this I get the following error:
"org.xml.sax.SAXException: SimpleDeserializer encountered a child
element, which is NOT expected, in something it was trying to

I'm using Hibernate ( to link two tables in a
one-to-many relationship, and it requires that this be either a
collection, or an array of my custom bean.  If I have to I can modify
my parent bean to contain a String[] array instead.. holding all the
primary keys in the child database.. but this will require a little
more "finesse" to get working correctly.

Thanks for the help,

- Brent

----- Original Message -----
From: Callahan, Paul <>
Date: Mon, 2 Aug 2004 14:07:11 -0400 
Subject: RE: Newbie: Sending/Receiving Beans with BeanSerializer
To: "" <>


Just make the return type of your method the class of the bean you
want to return...  Axis will serialize it on return, unless you are
using collections or complex types.



-----Original Message----- 
From: Brent Johnson [] 
Sent: Monday, August 02, 2004 1:10 PM 
Subject: Newbie: Sending/Receiving Beans with BeanSerializer 

I want to be able to pass a bean (lets say "Item") to my WebService 
and have a bean returned (in this case another "Item" with different 

I've read through the Axis documentation and it looks like its pretty 
trivial to pass a bean into the service as input using the 
BeanSerializer.  This is of course assuming you aren't using any 
Collections.  I'd *like* to use Collections (i.e. a Set) in my bean.. 
but from searching the mailing list archive there doesnt seem to be a 
simple way to do this.  I can use arrays instead of collections for 
now though. 

How does one go about passing a bean back to the client?  The example 
in the user documentation takes a bean and just returns a String to 
the caller.  How about returning a serialized bean? 


View raw message