|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
Adding namespaces to existing message |
« View previous topic :: View next topic » |
Author |
Message
|
mqjeff |
Posted: Wed Sep 02, 2009 7:02 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Once more, with feeling.
Adding a namespace declaration to the message tree does NOTHING to add namespace values to nodes in the message tree.
It's as simple and straightforward and plain as
kimbert wrote: |
Sorry, there is no shortcut. Every individual node in the message tree must have the correct namespace assigned to it. |
So if you want to get "(0x01000000)http://www.amica.com/amica_messaging:KeyGroup", then you need to say "msg:KeyGroup", and likewise for EVERY NODE IN THE TREE. |
|
Back to top |
|
 |
Sandman |
Posted: Wed Sep 02, 2009 7:05 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2001 Posts: 134 Location: Lincoln, RI
|
Thanks for your patience folks.
But when I tried saying "msg:KeyGroup", etc., I ended up w/ a NEW element in my output message, IN ADDITION to the existing non-namespaced one that came in on the input message. Do I need to NOT CopyEntireMessage upfront, and instead, copy just the headers, then move each piece from input to output separately (so that I can include the msg: prefix and only end up w/ 1 copy of each element)? |
|
Back to top |
|
 |
kimbert |
Posted: Wed Sep 02, 2009 8:08 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Quote: |
Do I need to NOT CopyEntireMessage upfront, and instead, copy just the headers, then move each piece from input to output separately (so that I can include the msg: prefix and only end up w/ 1 copy of each element)? |
I know, but I'm not telling. It is obvious that you are not completely up to speed with message flow development. Finding the answer is as simple as attaching the debugger and stepping through your ESQL. By doing that, you will gain some useful experience in developing and debugging message flows. |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 02, 2009 8:23 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
I'm confused.
Are you asking how to SET the NAMESPACE on an Element? |
|
Back to top |
|
 |
Sandman |
Posted: Wed Sep 02, 2009 10:28 am Post subject: |
|
|
Centurion
Joined: 16 Oct 2001 Posts: 134 Location: Lincoln, RI
|
Yes, I was asking how to set the namespace. I've never had a need to do this to an existing XML message (most of ours have namespaces already). And in our MRM->XML transformations, I've always used a namespace constant (i.e. SET OutputRoot.XMLNS.msg:Message...) to setup the namespaces. But in the latter case, it was creating a whole new XML tree, not adding namespaces to an existing one.
That does NOT imply that I'm a total broker newb just because I'm a tad namespace-challenged. Last I checked, there's a whole lot of other concepts, many of which I'm far more comfortable w/ than namespaces. But thanks for the vote of confidence, NTL!
I ended up finding this syntax:
Code: |
SET FieldRefPtr NAMESPACE = ''; |
...in this thread: http://www.mqseries.net/phpBB2/viewtopic.php?t=25039
So to add the namespaces where I needed them, I did:
Code: |
DECLARE msg NAMESPACE 'http://www.amica.com/amica_messaging';
SET OutputRoot.XMLNS.Message NAMESPACE = msg;
SET OutputRoot.XMLNS.msg:Message.CrfActionGroup NAMESPACE = msg;
SET OutputRoot.XMLNS.msg:Message.msg:CrfActionGroup.CommandReference NAMESPACE = msg;
SET OutputRoot.XMLNS.msg:Message.msg:CrfActionGroup.KeyGroup NAMESPACE = msg;
SET OutputRoot.XMLNS.msg:Message.msg:CrfActionGroup.msg:KeyGroup.AlternateId NAMESPACE = msg;
SET OutputRoot.XMLNS.msg:Message.msg:CrfActionGroup.msg:KeyGroup.UUID NAMESPACE = msg; |
Then I sent this modified message through a subflow that required namespaces on the Message and CrfActionGroup. So upon return from that subflow, I needed to strip the namespaces (and just delete the CrfActionGroup):
Code: |
SET OutputRoot.XMLNS.msg:Message.msg:CrfActionGroup = NULL;
SET OutputRoot.XMLNS.msg:Message NAMESPACE = ''; |
It seems to be working fine now. Have I missed some key concept and planted some time bomb? |
|
Back to top |
|
 |
|
|
|
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
|
|
|
|