Author |
Message
|
imnd |
Posted: Mon Jul 01, 2013 10:49 am Post subject: Propagate DFDL message in ESQL : Root element does not exist |
|
|
Newbie
Joined: 01 Jul 2013 Posts: 6
|
I am working with a DFDL schema whose structure is something like this
Code: |
BPSGenex //root element
body // once per file
BatchHeader // once per file
RecordDetail // multiple per file
BillHeader //once per RecordDetail
Provider //once per RecordDetail
LineItem // multiple per RecordDetail
|
I want to read each RecordDetail one by one and send it to the next node, preferably an MQOutput. I am using a Compute node for retrieving each RecordDetail. Then I am using PROPAGATE statement to send it to next node. Here is the relevant ESQL code:
Code: |
DECLARE refInput REFERENCE TO InputBody.*:BPSGenex.*:"body".*:BatchHeader;
WHILE index <= totalCount DO
MOVE refInput NEXTSIBLING NAME 'RecordDetail';
IF LASTMOVE(refInput) THEN
-- capture the data in one RecordDetail
CREATE LASTCHILD OF OutputRoot Domain('DFDL') NAME 'RecordDetail';
SET OutputRoot.*[<] = refInput;
PROPAGATE TO TERMINAL 'out' MESSAGE OutputRoot;
END IF;
SET index = index+1;
END WHILE;
|
While debugging, i can see that the value of OutputRoot is what I expect:
Code: |
OutputRoot
Properties
RecordDetail
BillHeader
Provider
LineItem
LineItem
LineItem
LineItem
|
However, at Propagate statement, I am getting the following exception:
Code: |
ParserException
File:CHARACTER:F:\build\slot1\S800_P\src\MTI\MTIforBroker\DfdlParser\ImbDFDLErrorHandler.cpp
Line:INTEGER:314
Function:CHARACTER:ImbDFDLErrorHandler::handleSerializerErrors
Type:CHARACTER:ComIbmFileInputNode
Name:CHARACTER:com/company/module/MQFacade#FCMComposite_1_1
Label:CHARACTER:com.company.module.MQFacade.Feed File
Catalog:CHARACTER:BIPmsgs
Severity:INTEGER:3
Number:INTEGER:5831
Text:CHARACTER:An error occurred whilst serializing with DFDL
Insert
Type:INTEGER:5
Text:CHARACTER:CTDU4001E: Root element does not exist.
Insert
Type:INTEGER:5
Text:CHARACTER:/RecordDetail/BillHeader
|
I do not understand what Root element it is unable to find? I have tried all the possible ways the PROPAGATE statement can be written in this case, but no one works. I also tried keeping a Trace node (instead of MQOutput) next to this Compute, but it didn't work either. Can someone please help?
Thanks in advance |
|
Back to top |
|
 |
mqjeff |
Posted: Mon Jul 01, 2013 10:52 am Post subject: |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 17447
|
Change the RETURN TRUE; at the end of your Compute module to RETURN FALSE; |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Jul 01, 2013 1:26 pm Post subject: Re: Propagate DFDL message in ESQL : Root element does not e |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
imnd wrote: |
Code: |
CREATE LASTCHILD OF OutputRoot Domain('DFDL') NAME 'RecordDetail'; |
|
Does DFDL support renaming the top-level parser element?
Does the DFDL schema correspond to 'Root.DFDL.RecordDetail...' or to 'Root.RecordDetail...'? |
|
Back to top |
|
 |
kimbert |
Posted: Mon Jul 01, 2013 2:19 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I do not understand what Root element it is unable to find? |
The first child of OutputRoot.DFDL must have the same name ( and the same namespace ) as a global element in your DFDL xsd. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Jul 02, 2013 4:45 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
kimbert wrote: |
Quote: |
I do not understand what Root element it is unable to find? |
The first child of OutputRoot.DFDL must have the same name ( and the same namespace ) as a global element in your DFDL xsd. |
Kimbert, can you please be a little more specific:
Does it have to be the same name and namespace as a global element in the DFDL or is it sufficient to attach the parse to OutputRoot.DFDL.myrootelement ?
Thanks  _________________ MQ & Broker admin |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 02, 2013 5:34 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Does it have to be the same name and namespace as a global element in the DFDL or is it sufficient to attach the parse to OutputRoot.DFDL.myrootelement ? |
OK. Imagine that your output message tree is under OutputRoot.DFDL.myFavouriteMessageName.
You have deployed 20 DFDL xsds. There are 50 different global elements in those xsds. When the DFDL converts the message tree into a sequence of bytes, which global element will it use?
Answer: It will use the global element with the same name ( and namespace ) as the first child of OutputRoot.DFDL. So in this case, it will look for a global element 'myFavouriteMessageName' among the deployed xsds.
In other words, when parsing the DFDL parser uses the global element name that was specified on the input node ( or in the CREATE...PARSE clause, or the createElementAsLastChildFromBitstream() call ... ). When writing, it uses the name of the root element in the OutputRoot tree. |
|
Back to top |
|
 |
imnd |
Posted: Tue Jul 02, 2013 10:39 am Post subject: |
|
|
Newbie
Joined: 01 Jul 2013 Posts: 6
|
Hi all, thanks for your replies.
I was able to make it work by not using DFDL domain at all. I used XMLNSC, the assumption being that once the message is successfully parsed, it is really not important to maintain the same domain for the message. I replaced these lines
Code: |
CREATE LASTCHILD OF OutputRoot Domain('DFDL') NAME 'RecordDetail';
SET OutputRoot.*[<] = refInput; |
with this line
Code: |
SET OutputRoot.XMLNSC.RecordDetail = refInput; |
that's all. In retrospect, it seems so simple  |
|
Back to top |
|
 |
kimbert |
Posted: Tue Jul 02, 2013 2:31 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
I was able to make it work by not using DFDL domain at all. I used XMLNSC, the assumption being that once the message is successfully parsed, it is really not important to maintain the same domain for the message. |
I don't understand. The domain does matter. Unless you just want to pass the logical message tree to the next node.
But in your first post, your message flow was trying to convert the DFDL message tree into a bitstream when it complained about the root element. Presumably, you wanted a non-XML bitstream at that point in time.
Now you have changed OutputRoot to an XMLNSC tree. The output bitstream will now be an XML document. Is that what you need? |
|
Back to top |
|
 |
imnd |
Posted: Wed Jul 03, 2013 11:49 am Post subject: |
|
|
Newbie
Joined: 01 Jul 2013 Posts: 6
|
Quote: |
But in your first post, your message flow was trying to convert the DFDL message tree into a bitstream |
It was? Sorry I didn't realize that is what the code was doing. Can you point me to the piece of code that converts it (DFDL/Text ?) into bitstream?
Quote: |
The output bitstream will now be an XML document. Is that what you need? |
Yes, for this use case (and perhaps most cases). XML seems to be the easiest and most popular of formats. |
|
Back to top |
|
 |
kimbert |
Posted: Wed Jul 03, 2013 12:02 pm Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
Quote: |
Can you point me to the piece of code that converts it (DFDL/Text ?) into bitstream?
|
No. But I can point you to the error message that you quoted:
An error occurred whilst serializing with DFDL
What do you mean by 'DFDL/Text'? |
|
Back to top |
|
 |
imnd |
Posted: Thu Jul 04, 2013 3:38 am Post subject: |
|
|
Newbie
Joined: 01 Jul 2013 Posts: 6
|
Quote: |
What do you mean by 'DFDL/Text'? |
I was under impression that the data is being read by DFDL parser in text format (ASCII or Unicode), because i was able to see all text in debug mode, and when you said
"your message flow was trying to convert the DFDL message tree into a bitstream"
I somehow concluded that it is converting that text to a binary format, like a BLOB (when I saw bitstream in earlier post, i translated it as bitstream=binary). I realize that I may have jumped to a wrong conclusion. No one ever used the word "binary" but that is what i read
So, by DFDL/Text, I meant that it was parsed as a text, how can it become a BLOB? which piece of code changed it to a BLOB? Silly me.... |
|
Back to top |
|
 |
kimbert |
Posted: Thu Jul 04, 2013 3:49 am Post subject: |
|
|
 Jedi Council
Joined: 29 Jul 2003 Posts: 5542 Location: Southampton
|
A stream of characters is also a stream of bytes. It is also a stream of bits.
The word 'bitstream' is used throughout the info center because WMB is able to handle data of all types - not just character data.
Quote: |
I was under impression that the data is being read by DFDL parser in text format (ASCII or Unicode), because i was able to see all text in debug mode |
DFDL can read any data format ( bits, bytes or characters ). In message broker, the DFDL parser converts a document into a message tree. I assume that you know what a message tree is. When a DFDL message tree arrives at an output node ( like MQOutput ) the DFDL parser converts the message tree back into a bitstream. In your case, that bitstream is also a stream of characters.
Similarly,
- CREATE...PARSE creates a message tree from a BLOB
- ASBITSTREAM creates a BLOB from a message tree
Clear now? |
|
Back to top |
|
 |
imnd |
Posted: Thu Jul 04, 2013 4:08 am Post subject: |
|
|
Newbie
Joined: 01 Jul 2013 Posts: 6
|
I see... Thanks for making it clear  |
|
Back to top |
|
 |
Kazim_Baig |
Posted: Mon May 02, 2016 10:42 pm Post subject: |
|
|
Novice
Joined: 26 Apr 2016 Posts: 19 Location: Bangalore
|
Hi All,
Thanks for your posts. |
|
Back to top |
|
 |
|