|
RSS Feed - WebSphere MQ Support
|
RSS Feed - Message Broker Support
|
 |
|
'Virtual' Namespace declaration |
« View previous topic :: View next topic » |
Author |
Message
|
p.cradwick |
Posted: Mon Apr 06, 2009 9:56 pm Post subject: 'Virtual' Namespace declaration |
|
|
Acolyte
Joined: 16 May 2001 Posts: 56
|
Hi,
I have a flow that takes in simple XML (sans namespace) as below:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x6ae5ee0]
(0x01000000:Folder):B2BErrorData = (
(0x03000000:PCDataField):ErrMsgPayloadID = '123456782007-05-21KSS/123450210' (CHARACTER)
(0x03000000:PCDataField):ErrorDate = '2009-04-07' (CHARACTER)
(0x03000000:PCDataField):MethodName = 'KS.B2BError' (CHARACTER)
(0x03000000:PCDataField):SchemeNumber = 'KSS/10054' (CHARACTER)
(0x03000000:PCDataField):ProcessDate = '07-04-2009' (CHARACTER)
(0x03000000:PCDataField):FreeText = 'A schema validation error has occurred while validating the message tree cvc-complex-type.2.4.a: Expecting element with local name "MemberIRDNumber" but saw "Scheme".' (CHARACTER)
(0x03000000:PCDataField):B2BPayloadID = 'KSS/10054013ACa4204408-232a-11de-982d-a32562925b2d' (CHARACTER)
(0x03000000:PCDataField):ErrorIndicator = '0110' (CHARACTER)
(0x03000000:PCDataField):ErrorCategory = '1' (CHARACTER)
It passes this through a mapping node that creates the o/p msg and puts in namespaces:
(0x01000000:Folder):XMLNSC = ( ['xmlnsc' : 0x6ae5868]
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodCall = (
(0x03000000:PCDataField)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:methodName = 'KS.B2BError' (CHARACTER)
(0x01000000:Folder )ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:params = (
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:header = (
(0x03000100:Attribute ):version = '1.0' (CHARACTER)
(0x03000000:PCDataField)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:SchemeID = 'KSS/10054' (CHARACTER)
(0x03000000:PCDataField)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:PayloadID = 'KSS/10054013ACa4204408-232a-11de-982d-a32562925b2d' (CHARACTER)
)
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0:payload = (
(0x01000000:Folder)ABC:xyz:IRD:KS:B2BInterfaces:Error:v4.0:Error = (
(0x03000100:Attribute ):ErrorIndicator = '0110' (CHARACTER)
(0x03000100:Attribute ):ProcessDate = '07-04-2009' (CHARACTER)
(0x03000100:Attribute ):ErrorCategory = '1' (CHARACTER)
(0x03000100:Attribute ):ErrorDate = '2009-04-07' (CHARACTER)
(0x03000100:Attribute ):SchemeNumber = 'KSS/10054' (CHARACTER)
(0x03000100:Attribute ):MessagePayloadID = '123456782007-05-21KSS/123450210' (CHARACTER)
(0x03000000:PCDataField)ABC:xyz:IRD:KS:B2BInterfaces:Error:v4.0:FreeText = 'A schema validation error has occurred while validating the message tree cvc-complex-type.2.4.a: Expecting element with local name "MemberIRDNumber" but saw "Scheme".' (CHARACTER)
It then writes the message to a queue and this comes out absolutely fine with an attribute namespace declaration:
<NS1:methodCall xmlns:NS1="ABC:xyz:IRD:KS:B2BInterfaces:XML-RPC_Envelope:v1.0"...etc
The MQOutput node passes the message to a compute node which looks for the namespace declaration using:
DECLARE methodCallRef REFERENCE TO refXML.*:methodCall;
DECLARE nsRef REFERENCE TO methodCallRef.(XMLNSC.Attribute)*:tns;
IF NOT LASTMOVE(nsRef) THEN
MOVE nsRef TO methodCallRef.(XMLNSC.Attribute)*:NS1;
..and doesn't find it!
Also it doesn't appear in the trace above (the output from the mapping node)...??
It first looks for xmlns:tns namespace alias decl as some other messages use that, and these work fine.
Is there something wrong with the message set used to generate the mapping node o/p? Is there a better way of getting the namespace to use?
Peter |
|
Back to top |
|
 |
kimbert |
Posted: Tue Apr 07, 2009 12:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Why are you trying to navigate to a namespace declaration? Your application should never depend on the prefixes used in the document.
When the output message is generated, if the parser encounters a namespace for which it has no corresponding namespace declaration, a prefix is automatically generated using prefixes of the form NSn where n is a positive integer. If you don't like 'NS1' then create a namespace declaration on the root node. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Apr 07, 2009 3:16 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
If you need to inspect the namespace at runtime you can always use the fieldnamespace function. Have fun  _________________ MQ & Broker admin |
|
Back to top |
|
 |
p.cradwick |
Posted: Tue Apr 07, 2009 10:22 am Post subject: |
|
|
Acolyte
Joined: 16 May 2001 Posts: 56
|
"Why are you trying to navigate to a namespace declaration? Your application should never depend on the prefixes used in the document."
Yes, I admit it didn't feel right, but better than hard coding.
I had this idea that the namespace declaration was the best source of the namespace and with this 'blinkered'
approach lost sight of FIELDNAMESPACE.
Thanks fjb, that sorted it.
Peter |
|
Back to top |
|
 |
|
|
 |
|
Page 1 of 1 |
|
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
|
|
|
|