Well watch out for the premature optimization trap. Measure, don't guess.

If you have a schema and pre-existing objects, I myself would be
looking into sending the objects over the wire as is. JIBX in
particular is pretty good at pre-existing objects and Collections.

Anyways, what Axiom / Stax does that's special is that you don't have
to build the tree. Its been a while since I worked with it, but if you
are determined to go with Axiom and are concerned about performance,
one thing to try might be creating a custom DataSource that implements
OMDataSource that streams the output. To go that way, I'd grep thru
the unit tests from the latest source for OMDataSource for examples
and pay attention to not building the tree in particular if possible.

HTH,
Robert

On Tue, May 6, 2008 at 10:14 PM, Parham, Clinton <[EMAIL PROTECTED]> wrote:
> Robert: thanks for your input and I will keep your suggestions about data 
> binding in mind. That aside, how would I do this the more manual way using 
> OMElement? I have a specific schema to adhere to and already have a Java 
> object model in place that I have to work with.
>
>  To keep things simple, assume each object in the Collection becomes an XML 
> element in the response payload. I want to be sure that I leverage the 
> strengths of AXIOM/StAX and minimize memory usage.
>
>
>
>  -----Original Message-----
>  From: robert lazarski [mailto:[EMAIL PROTECTED]
>  Sent: Tuesday, May 06, 2008 6:59 PM
>  To: [email protected]
>  Subject: Re: Basic Axis/Axiom usage question
>
>  Axiom is a good starting way to get to know Axis2, and in fact is
>  involved in many of the low level parts parts of Axis2. However, if
>  its Java Collections you want, you may consider using one of the
>  higher level databinding API's like adb, xmlbeans, jibx, jaxb etc.
>  Those type of API's can give you Java Collections, and when used in
>  Axis2 code generation, hook into Axiom anyways though at a level you
>  generally don't need to worry about unless there's a bug. When using
>  those with Axis2 you need an xml schema and WSDL, hand generated or
>  via reverse engineering existing code.
>
>  One way of looking at things is the xml payload sent over the wire is
>  in Arrays suitable for any language, and not just for Java
>  Collections. With databinding, the xml payload is obstenably the same
>  while the code level implemetation varies widely.
>
>  HTH,
>  Robert
>
>  On Tue, May 6, 2008 at 5:59 PM, Parham, Clinton <[EMAIL PROTECTED]> wrote:
>  >
>  >
>  >
>  >
>  > Hello.
>  >
>  >
>  >
>  > I'm getting my feet wet with Axis & Axiom and something is just not 
> clicking
>  > for me. Let's say I have a web service method that accepts and returns
>  > OMElements. The web service receives some data and builds a
>  > java.util.Collection of results objects that I need to send back as an XML
>  > payload in the response.
>  >
>  >
>  >
>  > What is the correct (most efficient memory-wise) way to do this? Do I 
> merely
>  > use factory.createOMElement / element.addAttribute to recreate the
>  > Collection objects in XML? Or, do I use something more elaborate like
>  > somehow wrapping the Collection with OMSourcedElementImpl and using
>  > OMDataSource?
>  >
>  >
>  >
>  > Some guidance and pointers to a similar example would be appreciated.
>  >
>  >
>  >
>  > Thank you,
>  >
>  > Clinton
>  >
>  >
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: [EMAIL PROTECTED]
>  For additional commands, e-mail: [EMAIL PROTECTED]
>
>

---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to