ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » producing a xml output in a Java Compute Node

Post new topic  Reply to topic
 producing a xml output in a Java Compute Node « View previous topic :: View next topic » 
Author Message
carlosgouveiareis
PostPosted: Wed Dec 19, 2012 4:40 pm    Post subject: producing a xml output in a Java Compute Node Reply with quote

Newbie

Joined: 06 Dec 2012
Posts: 5

Hi, I am doing a project where I need to implement a JavaCompute node to interface with an external system.
The input is a XML doc and the output is a XML doc too with the returned result set from the external system, with a list. As the list is around 700 elements I need to find a way to create the XML in a more performant way than calling the createElementAsFirstChild() 700 times as I see in the IBM manual, http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/index.jsp?topic=%2Fcom.ibm.etools.mft.doc%2Fac67180_.htm.

Can anyone help me on that.
Tanks and King Regards
Carlos

-----------example from IBM manual, for Java code and returning XMl -------------------------------------------
MbElement root = outMessage.getRootElement();
MbElement document = root.getLastChild().getFirstChild();
MbElement chapter2 = document.createElementAsLastChild(MbElement.TYPE_NAME,"Chapter",null);

// add title attribute
MbElement title2 = chapter2.createElementAsFirstChild(MbElement.TYPE_NAME_VALUE,
"title", "Message Flows");

This produces the following XML output:

<document>
<chapter title="Introduction">
Some text.
</chapter>
<chapter title="Message Flows"/>
</document>
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Dec 19, 2012 10:40 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

your link does not show any document in the right hand pane...
Any ways what is wrong with using the published API?
How can you tell it takes too much time? How big is the finished document?

And without setting the correct specific type your output will not produce an attribute....

Have fun
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Thu Dec 20, 2012 4:08 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You don't say where you are receiving the 700 elements from, or if you are receiving them as individual chunks of data or all as one bitstream.

If you are receiving them all as one bitstream, then what you should do is *parse* the bitstream into a message tree, rather than writing code that does it manually. (createElementAsLastChildFromBitstream)

If you are receiving them all as individual chunks, then how do you expect to do anything other than just treat them individually and do the same thing for all 700?
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Dec 20, 2012 5:17 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
the output is a XML doc too with the returned result set from the external system
Please describe this 'external system' Is it a database? What form does the 'result set' take? A Java collection of some kind?
Quote:
And without setting the correct specific type your output will not produce an attribute....
I agree - you will need to set the parser-specific type to XMLNSC.Attribute if you want an attribute in the output.
Back to top
View user's profile Send private message
carlosgouveiareis
PostPosted: Thu Dec 20, 2012 5:22 am    Post subject: clarification Reply with quote

Newbie

Joined: 06 Dec 2012
Posts: 5

Hi, thanks for the answers.

Clarifying, I will have the results in an array of elements of a Public Class like MyQueryResult {
private int ID;
private string Client;
private string Entity;
private string DOC_DATE;
private string DOC_FINAL_DATE;
Private float TotalValue;
...
}
I will receive all the data as all one not in chunks.
So I will have in average 700 elements in the array and I need to return the entries as XML doc like this one:
<root>
</element>
<ID/> <Client/> <Entity/>
</root>
My question is that there is a way of creating the corresponding XML doc without having too call createElementAsFirstChild for each element ?

Many thanks
Carlos
Back to top
View user's profile Send private message
kimbert
PostPosted: Thu Dec 20, 2012 5:27 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
My question is that there is a way of creating the corresponding XML doc without having too call createElementAsFirstChild for each element ?
Not if you want to use the XMLNSC parser to write the XML for you. The XMLNSC parser always and only works with message trees.

Are you sure that you have a performance problem? Or are you just concerned that a problem might appear?
Back to top
View user's profile Send private message
McueMart
PostPosted: Thu Dec 20, 2012 6:00 am    Post subject: Reply with quote

Chevalier

Joined: 29 Nov 2011
Posts: 490
Location: UK...somewhere

My guess is that broker can process 700 calls to createElementAsFirstChild() significantly quicker than:
- Connecting to the 'external system'
- Querying for the data you want
- Waiting for it to return the response.

Benchmark it and let us know!
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » producing a xml output in a Java Compute Node
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.