Author |
Message
|
ydsk |
Posted: Mon Oct 17, 2005 2:42 pm Post subject: Redefining namespace in a child tag - need help please |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Hi,
Here is my input message:
-----------------------------------------------------
<MYNS:Envelope xmlns:MYNS="http://www.xmlschema.com/addressing">
<...some elements ...>
<URNS:Header xmlns:URNS="http://www.xmlschema.com/addressing">
<URNS:Header1>
<tag1>1234</tag1>
</URNS:Header1>
</URNS:Header >
<Body>
<tag2>tag2value</tag2>
</Body>
</MYNS:Envelope>
-----------------------------------------------------
and here is my ESQL code ( just 1 compute node between MQInput and MQOutput nodes):
-------------------------------------------------------
CALL CopyMessageHeaders();
DECLARE soapenv NAMESPACE http://www.xmlschema.com/addressing';
DECLARE ref REFERENCE TO InputRoot.XMLNS.soapenv:Envelope;
MOVE ref FIRSTCHILD;
NMS:WHILE (FIELDNAME(ref) <> 'Header') DO
CREATE LASTCHILD OF OutputRoot.XMLNS.soapenv:Envelope FROM ref;
MOVE ref NEXTSIBLING;
END WHILE NMS;
CREATE LASTCHILD OF OutputRoot.XMLNS.soapenv:Envelope FROM ref;
SET OutputRoot.XMLNS.soapenv:Envelope.soapenv:Header.soapenv:NEWTAG = 'some value';
-------------------------------------------------------------
And here is the output I am getting:
-----------------------------------------------------
<MYNS:Envelope xmlns:MYNS="http://www.xmlschema.com/addressing">
<...some elements ...>
<MYNS:Header xmlns:URNS="http://www.xmlschema.com/addressing">
<MYNS:Header1>
<tag1>1234</tag1>
</MYNS:Header1>
<MYNS:NEWTAG>some value</MYNS:NEWTAG>
</MYNS:Header >
<Body>
<tag2>tag2value</tag2>
</Body>
</MYNS:Envelope>
-----------------------------------------------------
I want the prefix URNS to be preserved in the output but it's getting converted to MYNS in the output because the namespace URL that was defined in the Envelope tag as MYNS was redefined in the Header tag as URNS, in the input message. But the original definition of namespace seems to be over-riding the re-defined namespace.
Can anyone pls tell me how to get the redefined namespace prefix URNS in the output (for Header and its children ) ?
Thanks for your time. |
|
Back to top |
|
 |
ydsk |
Posted: Mon Oct 17, 2005 2:52 pm Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Sorry, pls ignore the <Body> tag entirely in the Output message. I am not copying it from InputRoot to OutputRoot and so, it wouldn't appear in Output message that I posted above. -- that's a small correction.
Thanks.
ydsk. |
|
Back to top |
|
 |
ydsk |
Posted: Mon Oct 17, 2005 5:31 pm Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Can somebody pls help me with my problem described above ?
Thanks. |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 18, 2005 3:50 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
ydsk,
I don't think this will be possible - although I'm very happy to be corrected on that point. I don't think the prefix assignment logic copes with your scenario.
Question: Strictly speaking, a namespace prefix is just an alias for the namespace. Why does it matter what the prefix is? |
|
Back to top |
|
 |
kimbert |
Posted: Tue Oct 18, 2005 6:13 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Hi ydsk,
The good news is that it works on v5 CSD4. I don't know what version you are using, but if you upgrade to the latest CSD, you will find that it works.
It also works on v6, which is an even better upgrade path  |
|
Back to top |
|
 |
ydsk |
Posted: Tue Oct 18, 2005 7:54 am Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
Hi Kimbert,
I am on version 5 CSD4 too.
Can you pls send me the ESQL code that worked ?
Appreciate your help.
Thank you very much.
ydsk. |
|
Back to top |
|
 |
ydsk |
Posted: Tue Oct 18, 2005 8:00 am Post subject: |
|
|
Chevalier
Joined: 23 May 2005 Posts: 410
|
I don't want to copy the entire message ( OutputRoot=InputRoot) and then make OutputRoot.Body = NULL. .... I can't do that because the <Body> tag can have data as big as an MB or more.
Pls give me the ESQL code that does what I need.
Thanks. |
|
Back to top |
|
 |
juddg |
Posted: Wed Oct 19, 2005 12:21 am Post subject: |
|
|
Apprentice
Joined: 22 Nov 2004 Posts: 33
|
Hi ydsk,
Kimbert is now on vacation. When he ran his test he used the ESQL that you posted. The only thing that needed to be changed was to put a single quote at the start of the URI in the declaration of soapenv. It was assumed that this was just a typo in the post. As input he used your posted input message with the '<...some elements ...>' line removed. The flow consisted of an MQInput, Compute and MQOutput node. The 'Message Domain' on the MQInput node was set to XMLNS.
Regards,
juddg. |
|
Back to top |
|
 |
|