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 » How to Remove/Add Namespace Declarations from XML

Post new topic  Reply to topic
 How to Remove/Add Namespace Declarations from XML « View previous topic :: View next topic » 
Author Message
jfrankman
PostPosted: Thu Oct 22, 2009 2:09 pm    Post subject: How to Remove/Add Namespace Declarations from XML Reply with quote

Apprentice

Joined: 18 Jun 2009
Posts: 36

We are working with a persnickity webservice that cannot handle xml with a namespace as follows:


Code:
<ns2:SendClaimPayload xmlns:ns2="http://qcsdirect.com">



The we need to send the following instead:
Code:
<SendClaimPayload xmlns="http://qcsdirect.com">


The problem is that the ESQL currently being sent to the broker contains the namespace . Before the xml is forwarded to the webservice we are calling, we need to remove the "ns2:" namespce information. We can remove the "ns2:" at the beginning of the element, but I cannot figure out how to replace ns2: namespace within the element. So we end up with xml like this:

Code:
<SendClaimPayload xmlns:ns2="http://qcsdirect.com">


How can xmlns:ns2="http://qcsdirect.com" be changed to xmlns="http://qcsdirect.com"using ESQL?

I have tried the following but, a runtime exception is thrown inside the broker:
Code:
SET OutputRoot.XMLNSC.SendClaimPayload.(XMLNSC.Attribute)xmlns = 'http://qcsdirect.com';
Back to top
View user's profile Send private message
Vitor
PostPosted: Thu Oct 22, 2009 2:38 pm    Post subject: Re: How to Remove/Add Namespace Declarations from XML Reply with quote

Grand High Poobah

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

jfrankman wrote:
How can xmlns:ns2="http://qcsdirect.com" be changed to xmlns="http://qcsdirect.com"using ESQL?


Have you looked up DECLARE NAMESPACE?

jfrankman wrote:
I have tried the following but, a runtime exception is thrown inside the broker:
Code:
SET OutputRoot.XMLNSC.SendClaimPayload.(XMLNSC.Attribute)xmlns = 'http://qcsdirect.com';


Look up XMLNSC.NamespaceDecl at the same time.
_________________
Honesty is the best policy.
Insanity is the best defence.
Back to top
View user's profile Send private message
jfrankman
PostPosted: Thu Oct 22, 2009 4:03 pm    Post subject: Reply with quote

Apprentice

Joined: 18 Jun 2009
Posts: 36

Thank for the help, we were able to get it to work with:

Code:
DECLARE ns NAMESPACE 'http://qcsdirect.com';
SET OutputRoot.XMLNSC.ns:SendClaimPayload.(XMLNSC.NamespaceDecl)xmlns = ns;


Unfortunately, the input message coming into the node as a prefix of "ns2:":

Code:
<ns2:SendClaimPayload xmlns:ns2="http://qcsdirect.com">


so when we set the output=input as follows:

Code:
SET OutputRoot.XMLNSC.ns:SendClaimPayload=InputRoot.XMLNSC.ns:SendClaimPayload;


Then the ns: gets copied over to the output root. so now it outputs:

Code:
<ns2:SendClaimPayload xmlns="http://qcsdirect.com">


I think I could set each field in the output root = to each field in the input root to work around this, but I would prefer not to. Is there a way I can delete ns:2 from InputRoot structure or cause that it does not get copied over?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Thu Oct 22, 2009 4:45 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

So have you tried

Code:
declare ns2 Namespace ' http://qcsdirect.com';
SET OutputRoot.XMLNSC.ns2:SendClaimPayload.(XMLNSC.NamespaceDecl)xmlns = ns2;



_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » WebSphere Message Broker (ACE) Support » How to Remove/Add Namespace Declarations from XML
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.