Author |
Message
|
mqbrks |
Posted: Thu Feb 16, 2012 12:19 pm Post subject: toBitstream of Environment tree |
|
|
Voyager
Joined: 17 Jan 2012 Posts: 75
|
Hi All,
I didn't get a solution for this in this forum, so posting this question.
I knew that we can convert any incoming message tree to bitstream as it has all encoding,ccsid available.
I am using a JCN, and can we convert a environment tree to bitstream?? I have seen that in ESQL, we can do this by giving the options. But not sure whether we can do this in JCN for environment tree.
Your inputs please.
Thank You! |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Feb 16, 2012 12:28 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
adubya |
Posted: Thu Feb 16, 2012 12:47 pm Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
The documentation states that you can only use the MbElement .toBitstream() method on the message body (lastchild of root) so no good for the environment tree. |
|
Back to top |
|
 |
mqbrks |
Posted: Thu Feb 16, 2012 12:47 pm Post subject: |
|
|
Voyager
Joined: 17 Jan 2012 Posts: 75
|
Hi Lancelotlinc,
Thanks for your reply!
I am not asking about navigating in JCN. I knew about xpath and java coding,the message structure. My question is specific - can we convert a environment tree to bitstream in JCN ? If yes, how?
For example -
MbElement globalEnv = contact admin.getGlobalEnvironment().getRootElement();
MbElement context = globalEnv.getFirstElementByPath("Request");
context.toBitStream("","","",1208,0,0); throws parsing errors(XML writing error).
I hope my question is clear now.
Thank You! |
|
Back to top |
|
 |
lancelotlinc |
Posted: Thu Feb 16, 2012 12:57 pm Post subject: |
|
|
 Jedi Knight
Joined: 22 Mar 2010 Posts: 4941 Location: Bloomington, IL USA
|
|
Back to top |
|
 |
mqbrks |
Posted: Thu Feb 16, 2012 1:03 pm Post subject: |
|
|
Voyager
Joined: 17 Jan 2012 Posts: 75
|
I don't why inaassembly.getGlobalEnvironment() was printed like contact admin.getGlobalEnvironment() |
|
Back to top |
|
 |
adubya |
Posted: Thu Feb 16, 2012 1:04 pm Post subject: |
|
|
Partisan
Joined: 25 Aug 2011 Posts: 377 Location: GU12, UK
|
lancelotlinc wrote: |
You seem to be missing "detach" function. mqjeff or kimbert might add more value here. |
Not too sure how that will help ? |
|
Back to top |
|
 |
mqjeff |
Posted: Thu Feb 16, 2012 1:13 pm Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can only do ASBITSTREAM in ESQL on an Environment tree element if that element has a Parser associated with it.
Likewise, you would only be able to toBitstream in Java on an element that has a Parser associated with it. |
|
Back to top |
|
 |
mqbrks |
Posted: Thu Feb 16, 2012 1:50 pm Post subject: |
|
|
Voyager
Joined: 17 Jan 2012 Posts: 75
|
mqjeff wrote: |
You can only do ASBITSTREAM in ESQL on an Environment tree element if that element has a Parser associated with it.
Likewise, you would only be able to toBitstream in Java on an element that has a Parser associated with it. |
Thank you jeff, I just wanted a confirmation about this to be sure.
And just for info, "detach" is no way related, as I am not trying to eliminate any elements/tree.
Thank you all! |
|
Back to top |
|
 |
kimbert |
Posted: Thu Feb 16, 2012 1:56 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
You can write any tree, or any fragment of a tree to a bitstream using any of
- an output node
- ASBITSTREAM
- Java toBitstream
- PHP
- .Net
...IF, and ONLY IF the element at the root of the tree ( or fragment of tree ) has a parser associated with it.
Internally, all of the options listed above call the same code, using the same internal interfaces within message broker. So
- all of them will *inevitably* produce the same results
- MbElement.toBitstream() behaves as if it was a wrapper around ESQL ASBITSTREAM ( although it is not really ). Same applies to the equivalent functions in PHP and .Net
As lancelotincpointed out ( or at least implied ) you can also write a message tree by walking the tree using Java ( or ESQL, or PHP, or .Net ) and using custom code to construct a BLOB. But that is rarely the correct approach. |
|
Back to top |
|
 |
marko.pitkanen |
Posted: Thu Feb 16, 2012 10:08 pm Post subject: |
|
|
 Chevalier
Joined: 23 Jul 2008 Posts: 440 Location: Jamsa, Finland
|
Hi mqbrks,
I wonder did you find this thread while your were searching the forum?
http://www.mqseries.net/phpBB2/viewtopic.php?t=59391
I think there are some useful info for you how to serialize logical data tree to for example simple xml representation.
--
Marko |
|
Back to top |
|
 |
|