IBM BPM: How to Convert a .csv File to .xml File

This article illustrates how to convert a .csv file to .xml file using Flat File Export and Import in IBM Integration Designer.

High-Level Design

An Assembly Diagram is a visual representation of the various components and their interfaces. It offers an overview of the interaction between these components and connects them using a line (wire). Every component has an interface, although it is also possible to use Java interfaces. The resulting application resembles a collection of web services that interact with each other. This method of packaging application components is called Service Component Architecture (SCA).
The Assembly Diagram below represents the high-level design of the Mediation Module, which contains an Import Component, a Mediation Component, and an Export Component. The main implementation is done in the Mediation Component.
By double-clicking the Mediation Component in the Assembly Diagram, the implementation may be done in the Mediation Flow, as shown below. Mapping is used to map the data. Service Invoke is used to invoke an external service (served by an import component in the Assembly Diagram).

Components Used in the Solution

  • Flat File Export: This export component is used to connect to a local file system and pick a file from it.
  • Mediation Component: Implementation of mapping between the Flat File Export and the Flat File Import.
  • Flat File Import: This export component is used to connect and save the file to local file system.
  • Mediation Module: This module integrates and connects services. A Mediation Module can contain mediation flows and can be deployed on IBM Process Server.
  • Business Object: Business objects are containers for application data that represent business functions or elements, such as a customer or an invoice.


Create a new Mediation Module to implement a Flow.

1. Go to File -> New -> Mediation Module.

2. Give the Module a name. Click Next.

3. Select “Lazy parsing.” Click Finish.
Once the Module is created, it will have an Assembly Diagram, data, integration logic, dependencies, interface, etc.

Create a Business Object

1. Right click on Data -> New -> Business Object.
2. Select the Module and enter the name of the business object. Click Next.
3. Click Finish to create the business object.
4. Add fields to the business object. Enter the names of the fields and the types of the inputs.
5. Click Save.
  • You can add fields to the BO by clicking the “F” symbol, as shown below.
  • Give the fields names (ex: Name, ID) and their types (ex: string, int). These fields will be mapped to the values in the .csv file that has been read.

Create a Flat File Inbound Adapter

1. In the workspace under Inbound Adapters, select (or drag and drop) the Flat File Export.
2. Select Simple: Create an inbound Flat File Service to read a local file. Click Next.
3. Give a name to the Flat File Export as shown below. Click Next.
4. Browse and select the BO that will have the same format as the .csv file. Select the directory from which the file has to be read.
5. Create and browse an archive folder to archive the .csv file that is being read during file processing.
6. In the input file format, selct Other. 
7. For the data handler, click Select. In the Data Format Configuration window, click on the “Delimited” option and select CSVDataHandler. Click Finish. 
8. Click Finish.
9. From the Outbound Adapters, select or drag the Flat File Import.

Creating an Outbound Flat File Service

1. Select Simple: Create an inbound Flat File Service to read a local file. Click Next.
2. Click Next.
3. Browse for the business object and select the output file for the BO. Click OK.
4. Browse for the output directory and select the output file. Click OK.
5. Select the folder. Click Next.
6. Create and browse an archive folder for the output of the .csv file that is being read during file processing.
7. Create and browse an archive folder to archive the .csv file that is being read during file processing.
8. Make sure that the output file format is .xml. Click Finish.


Converting the .csv File

1. Connect the modules with connectors and form the mediation flow.
2. Double click on the CVStoXML module. Click Yes.
3. Select the module. Click OK.
4. Double-click the Emit operation and select the blank mediation flow.
5. Select the Callout Service Invoke.
6. Set the import as FlatFileImportPartner. Click OK.
7. Connect the FlatFileExport input to the FlatFileImportPartner you created using the Mapping primitive.
8. Double-click on Mapping. Click Next.
9. Click Finish to create the map.
10. Connect the Emit input on the left side to the Create input on the right side of the of the mapping_req window.
11. Save your work with Ctrl+S.
12. Place the Trace, which is in the Tracing mediation workspace, between the mapping and the FlatFileImporterPartner so we can trace the logs in the console.
13. In the response window, place the Stop and Fail mediation primitives from the Error Handling section. Connect to the Out and Fail pins of the FlatFileImportPartner callout response.
14. Save your work.


Using the process above, we can convert a .csv file to .xml file by using FlatFile Export and Imports.

Nagesh Bhatt
Software Engineer

Nagesh Bhatt specializes in IID, WAS, and Java. With three years of experience in the IT industry, he has implemented several complex integrations using IBM Integration Designer.

Manju Rahangdale
Technical Professional in Integration Technologies

Manju Rahangdale has with six years of experience in development, architecture, design, solutioning, and sustenance covering all aspects of SDLC. His additional skills include the analysis, configuration, and implementation of complex integrations like BPEL, ESB, and WebService using IBM Integration Designer.

Suvajit Mukhopadhyay

Suvajit Mukhopadhyay is a Smarter Process evangelist with nearly ten years of experience in BPM. His expertise includes pre-sales, architecture, design, development, and sustenance for various Fortune 500 customers. He has a proven track record with Smarter Process implementations in banking and financial services.