Author: Ankita Jha
cXML (or Commerce XML) is an XML-based standard that allows transactions to be sent and received between a buyer and a seller’s system. Mule provides an x12 connector for the conversion of cXML to EDI. Here we will be converting a cXML file to EDI version x12/4010/856. 856 is the Advance Ship Notice EDI.
This is how the application will look like:

Below mentioned steps are to be followed for the transformation:
- Import the x12 module to your project from Exchange.

- Put a File – On a New or Updated connector and point it to the folder where your cXML file resides. Instead of this a listener can also be put and the cXML can be sent as the body.
- A logger can be put in to check the payload received.
- Put the x12 write connector after the logger. The x12 will need to be added and configured. The desired EDI version can be put here as the schema definition. Here we can put standard/custom EDI schemas that need to be used. The schemas will get included as a part of Mule folder as soon as we import x12 to our project


- For the EDI file to be formatted and segments to be separated by a new line, add this to the configuration.

- Drag the transforming message to map the fields and for the transformation. As soon as the transforming message is added, the elements according to the mentioned EDI file are populated for the mapping.

- Map the fields as required.
- Log the output.
Sample Input and Output:
Input –

Output –
