Question
· Oct 20, 2017

Record mapper xml to a xml output file

I have a batch record mapper that reads a csv file and passes the message to a process that uses the EnsLib.MsgRouter.RoutingEngine and would like to pass the message to an operation that will output that as a XML file but so far been unlucky as the operation that I use , uses the EnsLib.EDI.XML.Operation.FileOperation which only works with the messages("BusinessOperation class for writing XML messages to a file. Works with XML messages of type EnsLib.EDI.XML.Document.") is there a way to achieve this or somewhere to read in order to achieve this I have asked before on this post but the answers I got never helped  so any ideas appreciated thanks in advance

Discussion (2)1
Log in or sign up to continue

Record map messages are objects, where as EnsLib.EDI.XML.Operation.FileOperation expects messages of type EnsLib.EDI.XML.Document (vdoc). There are 2 options for you:

1. Transform the record map batch message to XML. e.g call the XMLExportToStream which will convert the record map batch to XML into a stream, which can then be loaded to EnsLib.EDI.XML.Document (using ImportFrom stream methods). This vdoc message then be forward to your XML file operation.

2. Create a custom operation which can create XML from the recordmap batch and write it to a file.

Thank you.

Does your router apply a data transformation to map the Record Map into an object of type EnsLib.EDI.XML.Document? If you have a schema for the target XML format, you can import that into Ensemble under Interoperate > XML > XML Schema Structures, and then create a Data Transformation to go from your Record Map to an EnsLib.EDI.XML.Document, with your imported schema.  Then send the result to your XML FileOperation, as that should be in the format that the operation expects.