Author |
Message
|
dmx0t1 |
Posted: Sun Nov 23, 2008 8:29 pm Post subject: Map Target to Ouputput xsi:nil="true" |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
Hi there,
I am having hard time making my mapped message to output target element in XMLNSC message domain with xsi:nil="true". Suppose I have the following mapping rule of "Request/RequestHeader/FromKey = $source/SOAP-ENV:Envelope/SOAP-ENV:Body/StartKeyValue":
[Source]
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Header/>
<SOAP-ENV:Body>
<StartKeyValue xsi:nil="true"/>
<CustomerID>JSmith</CustomerID>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
|
[Target]
Code: |
<?xml version="1.0" encoding="UTF-8"?>
<Request xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Request.xsd">
<RequestHeader/>
<FromKey xsi:nil="true"/>
</RequestHeader>
<RequestData>
<AMSB1010RequestData>
<CustID>JSmith</CustID>
</AMSB1010RequestData>
</RequestData>
</Request>
|
How can I make my mapped target to output <FromKey xsi:nil="true"/> whenever <StartKeyValue> from source is not passed at all or have the value of <StartKeyValue xsi:nil="true"/>? I've only been able to get <FromKey></FromKey> in my output so far. Should I write ESQL to custom this output for the map expression editor to call?
Kindly appreciate everyone's help in advance
p.s. My taget message set is set to XMLNSC message domain with "Encoding Numeric Null" and "Encoding Non-Numeric Null" both set to "NULLSchema". |
|
Back to top |
|
 |
kimbert |
Posted: Mon Nov 24, 2008 1:57 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
My taget message set is set to XMLNSC message domain with "Encoding Numeric Null" and "Encoding Non-Numeric Null" both set to "NULLSchema". |
Important point: XMLNSC can validate against the xsds in the message set but it does not use any of the message set properties when parsing or writing messages. So changing null handling settings will not help you. |
|
Back to top |
|
 |
dmx0t1 |
Posted: Mon Nov 24, 2008 9:48 pm Post subject: |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
Thank you kimbert for the tip The thing is I am running out of solutions, so I am doing wild trial and error for everything that I can find. The problem remains after my source xml from requesting app goes thru the mapping node, the mapped target xml becomes empty tags (e.g. <StartKeyValue xsi:nil="true"/> -> <FromKey></FromKey>), of which my receiving app does not accept.
My receiving app is insisting on the xsi:nil="true" attribute. I know I can manually add a post process compute node to force the xsi:nil="true", but that would imply I have to scan thru every element in the message tree and hardcoding every element to do so. Is there a way to config this or am I doomed to this alternative? |
|
Back to top |
|
 |
kimbert |
Posted: Tue Nov 25, 2008 3:59 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Your receiving app is badly behaved. It is not obeying the XML standard.
re: a solution, see my reply on your other thread. Do not write that ESQL except as a last resort. It would be better to use XMLNS instead. |
|
Back to top |
|
 |
dmx0t1 |
Posted: Tue Nov 25, 2008 7:19 pm Post subject: |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
u mean switch the message set to XMLNS message domain and retest? |
|
Back to top |
|
 |
kimbert |
Posted: Wed Nov 26, 2008 1:56 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
It would be pointless to change the message set. XMLNS never uses message sets at runtime.
Go ahead and upgrade to 6.1.0.2, as you mentioned on the other thread.
Please reply only on this thread in future - it's getting confusing. |
|
Back to top |
|
 |
dmx0t1 |
Posted: Wed Nov 26, 2008 2:21 am Post subject: |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
ok sure, i will find a test machine and let u know...thanx |
|
Back to top |
|
 |
dmx0t1 |
Posted: Thu Nov 27, 2008 11:23 pm Post subject: |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
|
Back to top |
|
 |
sankritya |
Posted: Fri Nov 28, 2008 2:44 am Post subject: |
|
|
Centurion
Joined: 14 Feb 2008 Posts: 100
|
DECLARE xsi NAMESPACE 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNSC.ns:RootElementOfXML.(XMLNSC.NamespaceDecl)xmlns:xsi = 'http://www.w3.org/2001/XMLSchema-instance' ;
And Then set the elements for which you want to set the value xsi:nil="true" ..
SET OutputRoot.XMLNSC.ns:RootElementOfXML.ns:Element.XMLNSC.Attribute)xsi:nil = 'true' ;
It works for me...hope so will work for you too... |
|
Back to top |
|
 |
kimbert |
Posted: Fri Nov 28, 2008 4:41 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Very strange. Please can you try this ESQL, and tell me whether it makes a difference. Please make sure you copy it accurately - I have removed some .'s.
Code: |
DECLARE XMLNSCAttribute INTEGER 0x03000100;
DECLARE xsi Namespace 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNSC.Request.RequestHeader.FromKey.(XMLNSCAttribute)xsi:nil = 'true';
SET OutputRoot.XMLNSC.testXMLNSCAttributeValue = XMLNSC.Attribute |
It should not make any difference...but if it does, it will help to diagnose the problem.
If the output is still incorrect, please insert a Trace node in your message flow and post the output. |
|
Back to top |
|
 |
dmx0t1 |
Posted: Thu Dec 04, 2008 1:05 am Post subject: |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
kimbert wrote: |
Code: |
DECLARE XMLNSCAttribute INTEGER 0x03000100;
DECLARE xsi Namespace 'http://www.w3.org/2001/XMLSchema-instance';
SET OutputRoot.XMLNSC.Request.RequestHeader.FromKey.(XMLNSCAttribute)xsi:nil = 'true';
SET OutputRoot.XMLNSC.testXMLNSCAttributeValue = XMLNSC.Attribute |
|
sorry for the late reply, I've tried out the above code...the
Code: |
SET OutputRoot.XMLNSC.testXMLNSCAttributeValue = XMLNSC.Attribute; |
will generate the following exception trace:
Code: |
[2008-12-04 11:15:35.942266] - Exception: ( ['MQROOT' : 0x64fd4d8]
(0x01000000):RecoverableException = (
(0x03000000):File = 'F:\build\S610_P\src\DataFlowEngine\ImbMqOutputNode.cpp' (CHARACTER)
(0x03000000):Line = 895 (INTEGER)
(0x03000000):Function = 'ImbMqOutputNode::evaluate' (CHARACTER)
(0x03000000):Type = 'ComIbmMQOutputNode' (CHARACTER)
(0x03000000):Name = 'com/ibm/tw/tcb/test/NilTest#FCMComposite_1_2' (CHARACTER)
(0x03000000):Label = 'com.ibm.tw.tcb.test.NilTest.MQOutput' (CHARACTER)
(0x03000000):Catalog = 'BIPv610' (CHARACTER)
(0x03000000):Severity = 3 (INTEGER)
(0x03000000):Number = 2230 (INTEGER)
(0x03000000):Text = 'Caught exception and rethrowing' (CHARACTER)
(0x01000000):ParserException = (
(0x03000000):File = 'F:\build\S610_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCParser.cpp' (CHARACTER)
(0x03000000):Line = 674 (INTEGER)
(0x03000000):Function = 'ImbXMLNSCParser::refreshBitStreamFromElementsCommon' (CHARACTER)
(0x03000000):Type = 'ComIbmMQInputNode' (CHARACTER)
(0x03000000):Name = 'com/ibm/tw/tcb/test/NilTest#FCMComposite_1_1' (CHARACTER)
(0x03000000):Label = 'com.ibm.tw.tcb.test.NilTest.MQInput' (CHARACTER)
(0x03000000):Catalog = 'BIPv610' (CHARACTER)
(0x03000000):Severity = 3 (INTEGER)
(0x03000000):Number = 5010 (INTEGER)
(0x03000000):Text = 'XML Writing Errors have occurred' (CHARACTER)
(0x01000000):ParserException = (
(0x03000000):File = 'F:\build\S610_P\src\MTI\MTIforBroker\GenXmlParser4\ImbXMLNSCWriter.cpp' (CHARACTER)
(0x03000000):Line = 880 (INTEGER)
(0x03000000):Function = 'ImbXMLNSCWriter::writeMisc' (CHARACTER)
(0x03000000):Type = '' (CHARACTER)
(0x03000000):Name = '' (CHARACTER)
(0x03000000):Label = '' (CHARACTER)
(0x03000000):Catalog = 'BIPv610' (CHARACTER)
(0x03000000):Severity = 3 (INTEGER)
(0x03000000):Number = 5016 (INTEGER)
(0x03000000):Text = 'Unexpected XML type at this point in document.' (CHARACTER)
(0x01000000):Insert = (
(0x03000000):Type = 5 (INTEGER)
(0x03000000):Text = 'testXMLNSCAttributeValue[1095266992384]' (CHARACTER)
)
(0x01000000):Insert = (
(0x03000000):Type = 5 (INTEGER)
(0x03000000):Text = 'fieldType' (CHARACTER)
)
)
)
)
)
|
|
|
Back to top |
|
 |
dmx0t1 |
Posted: Thu Dec 04, 2008 2:48 am Post subject: |
|
|
 Apprentice
Joined: 23 Nov 2008 Posts: 27
|
I've finally got the <FromKey xsi:nil="true"/> after feeding the map node a variety of input messages:
w/ empty tag: <StartKeyValue></StartKeyValue> --> <FromKey xsi:nil="true"></FromKey>
w/ empty tag xsi:nil="true": <StartKeyValue xsi:nil="true"></StartKeyValue> --> <FromKey xsi:nil="true"></FromKey>
w/ <StartKeyValue> not passed at all: --> <FromKey xsi:nil="true"/>
Thanx to all of your help (especially kimbert)
...though it looks like this I will have to scan thru every possible nillable element and manually add this in some kind of hard coded fashion  |
|
Back to top |
|
 |
|