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 » Adding namespaces to existing message

Post new topic  Reply to topic Goto page 1, 2  Next
 Adding namespaces to existing message « View previous topic :: View next topic » 
Author Message
Sandman
PostPosted: Tue Sep 01, 2009 6:34 am    Post subject: Adding namespaces to existing message Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

I've searched and read every thread I could find here about this, but I'm still confused.

I want to add namespace prefixes and namespace declarations to the Message and CrfActionGroup (and the CrfActionGroup's children) elements.
Code:
<Message>
 <CrfActionGroup>
  <CommandReference refid="Command1"/>
  <KeyGroup id="ID2004" keyGroupType="ServiceProvider">
   <AlternateId state="exists" value="ab:234962" sourceLogicalId="AB"/>
   <UUID/>
  </KeyGroup>
 </CrfActionGroup>
 <COMMAND>
  <CPRequest id="Command1" cmdType="request" cmdMode="alwaysRespond" echoBack="false" defaultState="referenced">
...
  </CPRequest>
 </COMMAND>
</Message>

Please let me know what other details I should provide.

Thank you.
Back to top
View user's profile Send private message Send e-mail
Gaya3
PostPosted: Tue Sep 01, 2009 6:39 am    Post subject: Re: Adding namespaces to existing message Reply with quote

Jedi

Joined: 12 Sep 2006
Posts: 2493
Location: Boston, US

Sandman wrote:
I've searched and read every thread I could find here about this, but I'm still confused.


We are also getting confused,

in Which Language you required it
Java or ESQL

Both have been discussed a lot over here in this forum
_________________
Regards
Gayathri
-----------------------------------------------
Do Something Before you Die
Back to top
View user's profile Send private message
Sandman
PostPosted: Tue Sep 01, 2009 8:21 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

Sorry. ESQL.
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Sep 01, 2009 8:39 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Sandman wrote:
Sorry. ESQL.


What ESQL have you tried? What happened when you tried it? There's no point us suggesting things which have already failed to help you.

What about the docs & threads do you find confusing? What specific points are you hung up on?
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sandman
PostPosted: Tue Sep 01, 2009 9:26 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

I've already spent a ton of time reading namespace threads, just trying to see if any of them were trying to do the same thing I'm trying. THAT's my confusion, "Hmm... is this really the same thing?".

I've read where kimbert suggested to someone to walk the tree and add a namespace decl to each element. But before I do that, I wanted to try hard-coding just setting the ns decls on a couple elements.

Input message:
Code:
<Message>
 <CrfActionGroup>
  <CommandReference refid="Command1"/>
  <KeyGroup id="ID2004" keyGroupType="ServiceProvider">
   <AlternateId state="exists" value="ab:234962" sourceLogicalId="AB"/>
   <UUID/>
  </KeyGroup>
 </CrfActionGroup>
 <COMMAND>
  <CPRequest>
   <Command desc="AddPayment">02</Command>
  </CPRequest>
 </COMMAND>
</Message>

Code:
Code:
DECLARE msg NAMESPACE 'http://www.amica.com/amica_messaging';
SET OutputRoot.XMLNSC.Message.(XMLNSC.NamespaceDecl)xmlns:msg = msg;
SET OutputRoot.XMLNSC.Message.CrfActionGroup.(XMLNSC.NamespaceDecl)xmlns:msg = msg;

... which resulted in this message:
Code:
<Message xmlns:msg="http://www.amica.com/amica_messaging">
 <CrfActionGroup xmlns:msg="http://www.amica.com/amica_messaging">
  <CommandReference refid="Command1"/>
  <KeyGroup id="ID2004" keyGroupType="ServiceProvider">
   <AlternateId state="exists" value="ab:234962" sourceLogicalId="AB"/>
   <UUID/>
  </KeyGroup>
 </CrfActionGroup>
 <COMMAND>
  <CPRequest>
   <Command desc="AddPayment">02</Command>
  </CPRequest>
 </COMMAND>
</Message>

But I'm confused by the trace (or just not reading it right?):
Code:
  (0x01000000):XMLNSC     = ( ['xmlnsc' : 0xb2efd58]
    (0x01000000):Message = (
      (0x01000000):CrfActionGroup = (
        (0x01000000):CommandReference = (
          (0x03000100):refid = 'Command1' (CHARACTER)
        )
        (0x01000000):KeyGroup         = (
          (0x03000100):id           = 'ID2004' (CHARACTER)
          (0x03000100):keyGroupType = 'ServiceProvider' (CHARACTER)
          (0x01000000):AlternateId  = (
            (0x03000100):state           = 'exists' (CHARACTER)
            (0x03000100):value           = 'ab:234962' (CHARACTER)
            (0x03000100):sourceLogicalId = 'AB' (CHARACTER)
          )
          (0x01000000):UUID         =
        )
        (0x03000102)xmlns:msg         = 'http://www.amica.com/amica_messaging' (CHARACTER)
      )
      (0x01000000):COMMAND        = (
        (0x01000000):CPRequest = (
          (0x03000000):Command = '02' (CHARACTER)
          (
            (0x03000100):desc = 'AddPayment' (CHARACTER)
          )
        )
      )
      (0x03000102)xmlns:msg       = 'http://www.amica.com/amica_messaging' (CHARACTER)
    )
  )
)

Am I on the right track? What am I missing? Did these 2 decl statements I coded actually put the namespace on these elements?

Thanks for your patience.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Tue Sep 01, 2009 9:41 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
I've read where kimbert suggested to someone to walk the tree and add a namespace decl to each element. But before I do that, I wanted to try hard-coding just setting the ns decls on a couple elements.
Sorry, there is no shortcut. Every individual node in the message tree must have the correct namespace assigned to it.
Back to top
View user's profile Send private message
Vitor
PostPosted: Tue Sep 01, 2009 9:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

Or the document must have a default namespace, if that fits your needs.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Sep 01, 2009 10:31 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Vitor said:
Quote:
Or the document must have a default namespace, if that fits your needs
Nope, that won't work. Unless you mean that the namespace of every node must be "" ( the empty string ).
Even if you use a default namespace ( xmlns="myNamespace" ) you still need to set the namespace of each and every child element to "myNamespace".
Back to top
View user's profile Send private message
Sandman
PostPosted: Tue Sep 01, 2009 10:31 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

I wasn't implying a shortcut; I just want to make sure I'm setting the ns properly on a couple elements before writing a recursive loop.

Is what I've done so far correct?

I'm used to seeing traces that look more like this:
Code:
  (0x01000010):XMLNS      = ( ['xmlns' : 0x24b78be0]
    (0x01000000)http://www.amica.com/amica_messaging:Message = (
      (0x07000012)xmlns:msg                                           = 'http://www.amica.com/amica_messaging' (CHARACTER)
      (0x07000012)xmlns:loc                                           = 'http://www.amica.com/Location' (CHARACTER)
      (0x07000012)xmlns:impl                                          = 'http://www.amica.com/Implementation' (CHARACTER)
      (0x07000012)xmlns:pty                                           = 'http://www.amica.com/Party' (CHARACTER)
      (0x07000012)xmlns:ptyImpl                                       = 'http://www.amica.com/PartyImpl' (CHARACTER)
      (0x07000012)xmlns:adrImpl                                       = 'http://www.amica.com/AddressImpl' (CHARACTER)
      (0x07000012)xmlns:xsi                                           = 'http://www.w3.org/2001/XMLSchema-instance' (CHARACTER)
      (0x03000000):bodyType                                           = 'Amica-XML' (CHARACTER)
      (0x03000000):id                                                 = '2009-09-01-06.29.23.414211' (CHARACTER)
      (0x03000000):authenticationId                                   = 'A14122' (CHARACTER)
      (0x03000000):timeStampCreated                                   = '2009-09-01-06.29.22.' (CHARACTER)
      (0x03000000):sourceLogicalId                                    = 'HUB' (CHARACTER)
      (0x03000000):destinationLogicalId                               = 'CMA' (CHARACTER)
      (0x01000000)http://www.amica.com/amica_messaging:CrfActionGroup = (
        (0x03000000):crfCmdMode                                           = 'neverRespond' (CHARACTER)
        (0x03000000):destinationLogicalId                                 = 'CMA' (CHARACTER)
        (0x01000000)http://www.amica.com/amica_messaging:CommandReference = (
          (0x03000000):refid = 'ID1' (CHARACTER)
        )
        (0x01000000)http://www.amica.com/amica_messaging:KeyGroup         = (
          (0x03000000):id                                              = 'ID4' (CHARACTER)
          (0x03000000):keyGroupType                                    = 'Household' (CHARACTER)
          (0x01000000)http://www.amica.com/amica_messaging:UUID        = (
            (0x02000000): = '0017886331' (CHARACTER)
          )
          (0x01000000)http://www.amica.com/amica_messaging:AlternateId = (
            (0x03000000):state           = 'exists' (CHARACTER)
            (0x03000000):value           = '0004989869' (CHARACTER)
            (0x03000000):sourceLogicalId = 'CMA' (CHARACTER)
          )
        )
      )
Back to top
View user's profile Send private message Send e-mail
Vitor
PostPosted: Tue Sep 01, 2009 10:48 am    Post subject: Reply with quote

Grand High Poobah

Joined: 11 Nov 2005
Posts: 26093
Location: Texas, USA

kimbert wrote:
Vitor said:
Quote:
Or the document must have a default namespace, if that fits your needs
Nope, that won't work. Unless you mean that the namespace of every node must be "" ( the empty string ).
Even if you use a default namespace ( xmlns="myNamespace" ) you still need to set the namespace of each and every child element to "myNamespace".


Things you learn.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
Sandman
PostPosted: Wed Sep 02, 2009 5:11 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

Ok, so I was told to provide more info on what I had tried/read so far. I did. Can someone please answer me now?
Back to top
View user's profile Send private message Send e-mail
mqjeff
PostPosted: Wed Sep 02, 2009 6:38 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

Compare and contrast these two pieces of your trace:

Quote:
(0x01000000)http://www.amica.com/amica_messaging:AlternateId = (
Quote:
(0x03000000):state = 'exists' (CHARACTER)


Notice the difference in how the elements are named. The first one has a NAMESPACE on it, the second one doesn't.
Back to top
View user's profile Send private message
Sandman
PostPosted: Wed Sep 02, 2009 6:39 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

The second one is an attribute, not an element.
Back to top
View user's profile Send private message Send e-mail
kimbert
PostPosted: Wed Sep 02, 2009 6:40 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
Did these 2 decl statements I coded actually put the namespace on these elements?
No. You need to re-read the examples in the docs.
Quote:
I'm used to seeing traces that look more like this:
Please tell us what you are puzzled about. We're not mind-readers!

You are not thinking about the problem correctly. First, get the message tree right. Make sure that your trace node output shows the correct namespace for each element. That is nothing to do with XMLNSC, by the way - it's basic message broker usage.

When you have a correct message tree, you can add one or more XMLNSC.NamespaceDecl attributes to create xmlns attributes in the output XML and control the namespace prefixes.
Back to top
View user's profile Send private message
Sandman
PostPosted: Wed Sep 02, 2009 6:57 am    Post subject: Reply with quote

Centurion

Joined: 16 Oct 2001
Posts: 134
Location: Lincoln, RI

Quote:
First, get the message tree right. Make sure that your trace node output shows the correct namespace for each element.
I'm sure trying to do that kimbert.

The code that produced the proper namespaced tree that I posted from a trace was:
Code:
DECLARE msg NAMESPACE 'http://www.amica.com/amica_messaging';
CREATE FIELD OutputRoot.XMLNS.msg:"Message";
DECLARE OutMsg REFERENCE TO OutputRoot.XMLNS.msg:"Message";
SET OutMsg.(XML.NamespaceDecl)xmlns:msg = 'http://www.amica.com/amica_messaging';

But the difference between that and what I'm trying to do is that it was transforming from MRM to XML and therefore creating the XML tree. In my current case, I just want to attach namespaces to the existing XML tree.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Goto page 1, 2  Next Page 1 of 2

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Adding namespaces to existing message
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.