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 » Change name space in a message

Post new topic  Reply to topic
 Change name space in a message « View previous topic :: View next topic » 
Author Message
dk27
PostPosted: Mon Mar 23, 2009 9:25 am    Post subject: Change name space in a message Reply with quote

Acolyte

Joined: 28 Apr 2008
Posts: 51

I have following message in xmlnsc domain

(0x01000000):XMLNSC = (
(0x01000400):XmlDeclaration = (
(0x03000100):Version = '1.0'
(0x03000100):Encoding = 'UTF-8'
)
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:StudyMilestonesMessage = (
(0x03000102):xmlns = 'http://www.pqrst.com/SMDS/RD/ProjectManagement'
(0x03000102)http://www.w3.org/2000/xmlns/:xsi = 'http://www.w3.org/2001/XMLSchema-instance'
(0x03000100)http://www.w3.org/2001/XMLSchema-instance:schemaLocation = 'http://www.pqrst.com/SMDS/RD/ProjectManagement StudyMilestonesMessage.xsd'
(0x03000100):MessageId = 'pqrst_RD_StudyMilestones'
(0x03000100):messageIntent = 'MilestoneUpdate'
(0x03000102)http://www.w3.org/2000/xmlns/:sms = 'http://www.pqrst.com/SMDS/RD/ProjectManagement'
(0x03000102)http://www.w3.org/2000/xmlns/:smds = 'http://www.pqrst.com/SMDS'
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:Header = (
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cEnvironment = 'TEST'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cTransactionType = 'pqrst_RD_StudyMilestones'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cSourceScheme = 'EANCM'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cSourceApplicationId = '5051150007680'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cDestScheme = 'EANCM'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cDestinationRouting = '5051150007703'
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cParentBusTID =
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cBusinessTransactionId = '05160898-4649-3710-8586-348603948208'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cMessageRecordCount = '1'
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cOriginalRouting =
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cf_TargetServiceName =
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cf_TargetOperationName =
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cf_FailureCode =
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:pqrst2cf_FailureReason =
)
(0x01000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:Study = (
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:StudyID = '112233'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:FundingSource = 'EuPharmaLocal'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:BusinessArea = 'ADP'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:StudyType = 'Methodology'
(0x03000000)http://www.pqrst.com/SMDS/RD/ProjectManagement:Status = 'Active'
)
)
)


With the help of following code, I am trying to change namespace for Header element, but it is not getting changed and I am getting error as "No valid body of the document could be found"

-- DECLARE myDefaultNS NAMESPACE 'http://www.pqrst.com/middleware/BPM';
-- SET OutputRoot.XMLNSC.Header.(XML.NamespaceDecl)xmlns = myDefaultNS;
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Mar 23, 2009 9:33 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You have to use the namespace on the Header in order to address it, you did not do this in your SET statement.

You have to change the namespace on every element individually, you won't be able to just change the namespace on the Header and have every child element receive the new namespace.
Back to top
View user's profile Send private message
dk27
PostPosted: Mon Mar 23, 2009 9:54 am    Post subject: Reply with quote

Acolyte

Joined: 28 Apr 2008
Posts: 51

So I have written following procedure and passing OutputRoot.XMLNSC.Header referance to this procedure.
But not sure how to give correct referance to this procedure

CREATE PROCEDURE addNamespaces(IN StartRefPtr REFERENCE)
BEGIN
DECLARE FieldRefPtr REFERENCE TO StartRefPtr;

MOVE FieldRefPtr FIRSTCHILD;
IF LASTMOVE(FieldRefPtr) THEN
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)xmlns = 'http://www.pqrst.com/middleware/BPM';
END IF;
END IF;

WHILE LASTMOVE(FieldRefPtr) DO
CALL addNamespaces(FieldRefPtr);
IF FIELDTYPE(FieldRefPtr) IN (0x01000000, 0x03000000) THEN
SET FieldRefPtr.(XML.NamespaceDecl)xmlns = 'http://www.pqrst.com/middleware/BPM';
END IF;
MOVE FieldRefPtr NEXTSIBLING;
END WHILE;
Back to top
View user's profile Send private message
mqjeff
PostPosted: Mon Mar 23, 2009 10:14 am    Post subject: Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 17447

You know how to write a procedure, but you don't know how to call a procedure?

Your procedure will not do what you want it to do. It will do what you have told it to do, however.
Back to top
View user's profile Send private message
dk27
PostPosted: Tue Mar 24, 2009 1:34 am    Post subject: Reply with quote

Acolyte

Joined: 28 Apr 2008
Posts: 51

mqjeff wrote:
You know how to write a procedure, but you don't know how to call a procedure?


Yes I am not able to put the name space qualifier while calling the procedure

mqjeff wrote:
Your procedure will not do what you want it to do. It will do what you have told it to do, however.


This is second problem it is adding subfield xmlns to each field. I am puzzeled with this.
Back to top
View user's profile Send private message
kimbert
PostPosted: Tue Mar 24, 2009 3:08 am    Post subject: Reply with quote

Jedi Council

Joined: 29 Jul 2003
Posts: 5542
Location: Southampton

Quote:
This is second problem it is adding subfield xmlns to each field. I am puzzeled with this
Why are you surprised? Your ESQL *is* adding an xmlns attribute to every node. That is not the same as setting the namespace on every node.
If you don't understand the difference then I suggest that you consider this question:
- In an XML document, what does an xmlns attribute do?

This is an XML question, not a message broker question, so Google will have the answer.

Hint: "it sets the namespace" is the wrong answer.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » Change name space in a 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.