Author |
Message
|
saikiran_88 |
Posted: Tue Apr 26, 2011 5:08 am Post subject: modifying Mbmessage |
|
|
Newbie
Joined: 25 Apr 2011 Posts: 7
|
Hi,
i have a good understanding that the message input is in readonly mode and hence cant be changed in anyway when Java compute node is used. But , with esql - one can make changes to the entire input tree. Is there anyway to modify the message input using java compute node? |
|
Back to top |
|
 |
Vitor |
Posted: Tue Apr 26, 2011 5:11 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
Why would you need to change the input message using either ESQL or Java? What's the requirement here?
Surely it's the output message that's the changed one.....?  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Tue Apr 26, 2011 5:44 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You can only change the input tree in ESQL if you take steps to do the wrong thing. |
|
Back to top |
|
 |
smdavies99 |
Posted: Tue Apr 26, 2011 5:49 am Post subject: |
|
|
 Jedi Council
Joined: 10 Feb 2003 Posts: 6076 Location: Somewhere over the Rainbow this side of Never-never land.
|
mqjeff wrote: |
You can only change the input tree in ESQL if you take steps to do the wrong thing. |
But...
Some people (who shall remain nameless) I know use InputLocalEnvironment as a 'scratchpad' in the full understanding that it gets destroyed upon the exit from the Compute Node.
Being Serious,
mqjeff is right. IT is usually better (and helps with keeping you sane) if you treat anything & everything on the Input side as ReadOnly and Inviolate. _________________ WMQ User since 1999
MQSI/WBI/WMB/'Thingy' User since 2002
Linux user since 1995
Every time you reinvent the wheel the more square it gets (anon). If in doubt think and investigate before you ask silly questions. |
|
Back to top |
|
 |
saikiran_88 |
Posted: Tue Apr 26, 2011 9:44 pm Post subject: |
|
|
Newbie
Joined: 25 Apr 2011 Posts: 7
|
i wanted to copyelemts from a temporary tree present in local enivironment to the message input.. but obv it wud throw an MBreadonlymessagexception...i was more curious as to why and how the same can be achieved in esql , where as it is restricted in JAva compute node....
Yes i get that the output message is the one changing  |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 27, 2011 4:52 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
saikiran_88 wrote: |
i wanted to copyelemts from a temporary tree present in local enivironment to the message input. |
My question stands. Why copy these elements to the input? Granted you've got a temporary tree for good & sufficient reason in your design, but why does this influence the input not the output? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
saikiran_88 |
Posted: Wed Apr 27, 2011 6:02 am Post subject: |
|
|
Newbie
Joined: 25 Apr 2011 Posts: 7
|
sorry for the misunderstanding .. act i want to copy it to the output message.. not input .. a lil confused with terms and stuff
well let me give a small hint at the message model.
Root
-properties
-MQMD
-XMLNSC
under xmlnsc i have the input data .
XMLNSC
-->Envelope
-->BODY
-->DATA
what i want to do is ... i want to change the structure to the one below
XMLNSC
-->DATA
i dont want to have envelope and body child's under it .
i have to do this using java compute node.
but the problem is .. i cant make any changes to the tree .. since it is in readonly mode.
i tried to create a new assembly and build an entirely new message to it . but it still doesnt allow to make any changes.. the same with esql is one line of code. i hope i have made it clear. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 27, 2011 7:34 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
saikiran_88 wrote: |
i dont want to have envelope and body child's under it .
i have to do this using java compute node.
|
Ok, accepting I'm entirely the wrong person to be answering Java questions I still don't understand your problem. You've what sounds like a SOAP message in the input XMLNSC and you just want the body data in the output XMLNSC. Given that you have to use Java, what's wrong with putting the input data in the output tree in the accepted way?
I don't understand the problem you're facing. _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Apr 27, 2011 7:36 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Vitor wrote: |
Given that you have to use Java, what's wrong with putting the input data in the output tree in the accepted way?
I don't understand the problem you're facing. |
saikiran_88 is facing the problem of constructing a writable message assembly.
Which is straightforward and given for you if you ask the Toolkit to construct a new Java class that "modifies the message tree" rather than filtering or etc. |
|
Back to top |
|
 |
Vitor |
Posted: Wed Apr 27, 2011 7:44 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
mqjeff wrote: |
Which is straightforward and given for you if you ask the Toolkit to construct a new Java class that "modifies the message tree" rather than filtering or etc. |
Well I was thinking that. My Java is weak to the point of laying in a bed with an IV drip in it's arm, but I did think you got both trees.  _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
jlaisbett |
Posted: Wed Apr 27, 2011 3:54 pm Post subject: |
|
|
Apprentice
Joined: 27 Nov 2009 Posts: 39
|
If you've created a Java Compute node using the wrong template then as mqjeff suggested I'd recommend recreating it or creating a new one using the create or modify templates. The default (i.e. if you just clicked next a lot when creating it) is Filter and in that template you will not be able to edit the message.
Alternatively look at the examples located here that explain the java code involved in creating an output message:
http://publib.boulder.ibm.com/infocenter/wmbhelp/v7r0m0/topic/com.ibm.etools.mft.doc/ac30270_.htm |
|
Back to top |
|
 |
Gerd-in-ZA |
Posted: Thu Apr 28, 2011 11:05 am Post subject: |
|
|
Novice
Joined: 13 Sep 2006 Posts: 14 Location: Johannesburg, South Africa
|
Aside from the fact that your example looks a lot like a use case for the SOAPExtract node, which would work without a single line of code, there still is no reason to mess with the input tree for this:
Assuming that you learn how to work with a Java Compute node with a writable assembly (the equivalent of a Compute node for ESQL, which has InputRoot and OutputRoot rather than just Root, like the filter and database nodes) ...
... you just copy everything from the input message assembly to the (writeable) output message assembly. If you want you can copy the lot as is and then modify the output tree exactly the way you wanted to modify the input tree. If you still want to copy stuff to a work area of sorts, you could use the local environment, or better still, the environment, which the Java folks call the global environment (for unfathomable reasons).
How's that? _________________ -- Gerd -- |
|
Back to top |
|
 |
|