How to: Transform Text Files into XML
Problem:
I was having trouble routing a message that was extracted for an email by my own custom pipeline component (also see How to: Extract email attachements using a custom pipeline component).
A flatfile was placed in a filelocation and had to be converted to XML and mapped from a scanorder to a weborder format so Axapta could pick it up.
So first, I discovered how mapping on ports works. (How to: Apply mapping on send and receive ports).
After that I went on with the tranformation of a FF (Flat file) to XML
Transformations are one of the most common components in the integration process. It's a translation from one format to an other.
There are two types of transformations;
- Semantic transformations usually occurs only in BizTalk maps. The document maintains the same syntax that is represented, but changes its semantics (data content).
- Syntax transformation occurs in the receive or send pipeline and aims to transform a document into an other representation, e.g. CSV to XML. The data is maintained but the syntax that is represented changes, it translates the document to an other format.
How are flatfiles processed by BizTalk:
Internally, BizTalk prefers to use the message type XML. Flat file schema's are simple XML schema's (XSD) with specific annotations. BizTalk uses them as metadata to describe not only XML documents but also flatfiles.
Syntax transformations occur in the receive or send pipeline. Usually text files (flat files) are processed at runtime as follows;
Flatfiles are received by an adapter associated to a receive location.
A pipeline configured in the receive location will be responsible for transforming de Flat file to XML.
Syntax transformation should occur at the disassemble stage of a pipeline with the flatfile disassembler component.
You have to create;
- A flat file schema (With the BizTalk flatfile Schema wizard), and
- A receive pipeline that will be responsible for processing and transforming flat files to xml.
The pipeline will need to have te flatfile disassemble component implemented in the disassemble stage, and the "document schema" propertie set to the created flat file schema.
Maak jouw eigen website met JouwWeb