|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
namespace exception. |
« View previous topic :: View next topic » |
Author |
Message
|
chris boehnke |
Posted: Tue Sep 15, 2009 7:14 am Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
Kimbert,
V5 accepts even if we don't specify the namespace qualifier for every element while generating the XML message. My main concern is: let us say that the Input message does not have the namespace part and we jsut copy the entire message from InputRoot to OutRoot and when we put the message in a queue on the MQOutput node, it throws the same error as "BIP5014E: Element must have a namespace specified if there is a default namespace in scope". It refers the parent element here regarding the namespace part. Should I copy element by element from InputRoot to OutputRoot?[/quote] |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Sep 15, 2009 11:27 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20767 Location: LI,NY
|
If there is a global namespace in scope, each element on the tree needs to have the namespace that is in scope.
Happy coding  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Sep 15, 2009 12:26 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Quote: |
V5 accepts even if we don't specify the namespace qualifier for every element while generating the XML message. |
Which domain are you using? If MRM, have you switched on validation on the input node?
I could ask why you are still on v5, but that probably wouldn't help very much...  |
|
Back to top |
|
 |
chris boehnke |
Posted: Wed Sep 16, 2009 4:51 am Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
Kimbert,
I think, I am confusing you. Let me explain my flow and then the problem I am talking about.
I have a flow where the application puts a SOAP message in the queue configured on MQInput node. As the message has to be sent to the Mainframe, I take the SOAP envelope off and keep it in a queue and convert the message from XML to COBOL and once I get the reply back from mainframe, I convert it back to XML. The real problem which I am facing while migrating from V5 to V6 is the generation of XML message and reattaching the SOAP envelope to the message in another compute node.
In V5 the code looks something like this:
Code: |
SET OutputRoot.XMLNS.ParentElement.SubElment1 = InputBody.FirstElement;
SET OutputRoot.XMLNS.ParenElement.SubElement1.SubElement* = InputBody.SecondElement;
|
Like this the output message is generated. After the message comes out of the comput node, it will be sent to an RCD node where we parse it as a BLOB and in another compute node I set the namespace part as below:
Code: |
DECLARE FinalMsgOut CHAR;
SET FinalMsgOut = CAST(InputBody.BLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
SET FinalMsgOut = REPLACE(FinalMsgOut, '<ParentElement>', '<ParentElement xmlns="http://www.mynamespace.com"');
SET OutputRoot.BLOB.BLOB = CAST(FinalMsgOut AS BLOB CCSID InputRoot.Properties.CodedCharSetId);
|
After coming out of this compute node I get the SOAP envelope stored in the queue and add it to the message. When I am putting the message onto the destination queue (reply to queue), I don't get any exceptions, however, when I migrate the same flow to V6.1, I get the exception: "BIP5014E: Element must have a namespace specified if there is a default namespace in scope". It refers the parent element here regarding the namespace part.
Question 1: Why is it so? How could V5 accept it and why not V6.1/
In order to get rid of this error, in V6 I have coded something like this:
Code: |
DECLARE myNS NAMESPACE 'http://www.mynamespace.com';
SET OutputRoot.XMLNS.myNS:ParentElement.(XML.NamespaceDecl)xmlns = 'http://www.mynamespace.com';
SET OutputRoot.XMLNS.myNS:ParentElement.myNS:SubElment1 = InputBody.FirstElement;
SET OutputRoot.XMLNS.myNS:ParenElement.myNS:SubElement1.myNS:SubElement* = InputBody.SecondElement;
|
Like this I generated the XML message by prefixing each element with the namespace qualifier and I could get rid of this namespace error after ataching the SOAP envelope and putting in a queue. In V6.1, I have taken out the RCD node and the Compute node where I have added the namespace using REPLACE(...) [shown above].
Question2: Is the code I used to generate the XML message correct in V6.1 ?
Question3: Is it mandatory that I have to add the namespace qualifier for every element in the XML message to be generated?
Hope I explained my problem in a correct way....
Thanks in advance.... |
|
Back to top |
|
 |
mqjeff |
Posted: Wed Sep 16, 2009 5:21 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
You spelled "XMLNSC" wrong. |
|
Back to top |
|
 |
chris boehnke |
Posted: Wed Sep 16, 2009 5:30 am Post subject: |
|
|
 Partisan
Joined: 25 Jul 2006 Posts: 369
|
Quote: |
You spelled "XMLNSC" wrong. |
Sorry, didn't get you. I am just using XMLNS not XMLNSC...... |
|
Back to top |
|
 |
Vitor |
Posted: Wed Sep 16, 2009 5:40 am Post subject: |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
chris boehnke wrote: |
Sorry, didn't get you. I am just using XMLNS not XMLNSC...... |
Why? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Sep 16, 2009 6:37 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5543 Location: Southampton
|
Leaving aside the XMLNS / XMLNSC question for a moment...
This:
Code: |
DECLARE FinalMsgOut CHAR;
SET FinalMsgOut = CAST(InputBody.BLOB AS CHAR CCSID InputRoot.Properties.CodedCharSetId);
SET FinalMsgOut = REPLACE(FinalMsgOut, '<ParentElement>', '<ParentElement xmlns="http://www.mynamespace.com"');
SET OutputRoot.BLOB.BLOB = CAST(FinalMsgOut AS BLOB CCSID InputRoot.Properties.CodedCharSetId);
|
was always likely to cause migration problems. There are good ways and bad ways to add a namespace declaration to your output message. That way is not a good way.
I don't know why v5 did not complain about this. I'm fairly sure that v5 performs the same checks, and *can* issue that error. So I suspect that there's some detail about your message flow which is hiding the problem from the XMLNS parser when it writes the message. Having seen the above code snippet, you can't blame me for being suspicious
If you really want to investigate this, the next step is to put a Trace node before the output node, and compare v5 and v6 output. |
|
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
|
|
|
|