Modernize your B2B EDI Transactions with MuleSoft

Written by Ali Akthar

Technical Account Manager

Electronic Data Interchange (EDI) is the medium to exchange business documents in a standard format between business partners, which can be easily understood to reduce the cost, increase processing speed, reduce errors, and provide efficiency.

Today, many organizations use EDI integration to share document types ranging from Purchase orders to invoices, requests for a loan application, etc. In addition, the exchange of data happens between the business partners for business transactions such as the supply chain.

B2B EDI Transaction Framework

A B2B EDI transaction has various formats (X12, EDIFACT, XML, CSV, and others) and transport protocols (AS2, FTP/S, and others) which are commonly used as a translation layer in electronic transactions between companies. Unfortunately, organizations typically don’t have a unified medium to exchange data with their trading partners. Therefore, it is often necessary to develop custom solutions for each trading partner. When custom software development is required for each trading partner, the effort and time needed to onboard new trading partners increase dramatically, thereby limiting the business relationships a company can pursue.

B2B Transaction Framework enables developers to build a single set of Mule Runtime flows that can process a wide range of messages from different partners by dynamically applying rules and configuration data stored in Any point Partner Manager (APM). Thus, non-programmers such as data analysts can use APM to onboard new trading partner relationships and support new transaction types without developing, testing, or deploying new Mule Runtime flows.

EDI Use Cases

There are several use cases & features associated with EDI,

  • Bulk data transfer – Enterprises can send large datasets, that includes moving huge documents with a single transfer.
  • Standardization and reliability – EDI communications leverage well-defined standards, leading to a significant increase in accuracy and efficiency.
  • Security – EDI solutions provide access only to predefined authorized users and use audit trails. This makes EDI one of the safest means to transfer data.
  • Process automation – EDI is an accepted rule that follows business processes.

MuleSoft X12 Connector

MuleSoft provides out-of-the-box connectors to connect with other systems and perform operations. For example, the X12 connector can be used to read documents such as invoices from a supplier using SFTP protocol and complete business operations.

In Any point Studio, X12 can be added to your project by searching it in Mule Palette. If needed, search in the exchange to download it. Once it is added to your project, you will be able to see it in the palette.

Once the X12 connector is added to the project, the user can implement the flow to receive and process the data in another document. Simplistically, the flow would look like this.

Following operations are happening in this flow.

  • The user can create a pool of documents on SFTP server for any new files using SFTP connector
  • Using X12 connector, read EDI file and transform the representation
  • Convert EDI format into JSON model that the API can consume
  • As there might be more than one invoice in an incoming file, send each of the converted JSON objects

With this flow in place, the user will read EDI files from the SFTP folder, transform the invoice into a JSON format and deliver it to the invoice processing.

MuleSoft EDIFACT Connector

MuleSoft EDIFACT EDI connector enables the organization to convert EDIFACT messages to and from DataWeave compatible formats. The EDIFACT EDI Connector uses a YAML format called EDI Schema Language (ESL) to denote EDI schemas. Basic ESLs describe the structure of EDI messages in terms of:

  • Structures, known as messages, in EDIFACT terminology

  • Groups, segments, composites, and elements

Organizations can customize the EDIFACT schema definitions to suit the data by defining an overlay schema. An overlay schema is a type of ESL that enables organizations to modify a base schema, such as an EDIFACT D.98B ORDERS schema, with proposed specific conventions. In addition to that, organizations don’t need an overlay schema if they use the structure defined by the standard. Still, most EDI exchanges modify the base definitions in an implementation convention.

To make the best use of the connector, the organization needs to know the locations of the schemas in the project. If the organizations are using base EDIFACT schemas and not customizing anything, the schema location follows the /edifact/{version}/{message}.esl convention. For example, using the D.98B version of the ORDERS message, the schema location is /edifact/d98b/ORDERS.esl.

If they use one or more custom schemas, place them in the src/main/resources directory and refer to the location relative to this directory. For instance, if you have put your ORDERS schema (either overlay or full) in src/main/resources/mypartner/ORDERS.esl, the schema location is /mypartner/ORDERS.esl.

MuleSoft XML Connector

The XML connector process and extracts data from an XML document. Even though DataWeave is recommended for most XML-related cases, use the XML connector for cases involving XML standards such as XSLT, XPath, XQuery, or XSD.

Common use cases for XML Module consist of the following:

  • Take XML input content and transform it based on XQuery expressions

  • Evaluate Xpath expressions in XML input content and extract the result

  • Take XML input and transform it with an XSL style sheet

  • Validate documents against an XSD schema

MuleSoft CSV Connector

The CSV data format is represented as a DataWeave array of objects in which each object represents a row. All simple values are represented as strings.

The DataWeave reader for CSV input supports the following parsing strategies:

  • Indexed
  • In-Memory
  • Streaming

By default, the CSV reader stores input data from an entire file in memory if the file is 1.5MB or less. If the file is larger than 1.5 MB, the process writes the data to disk. For huge files, organizations can improve the performance of the reader by setting a streaming property.

Adopting MuleSoft EDI Platform

Royal Cyber with MuleSoft brings API-led connectivity to B2B integration, allowing businesses to drive innovation in their enterprise by applying a modern connectivity framework to legacy technologies. This means that if an organization wants to create a mobile app, it can expose and share the data from the app through a modern API layer and over traditional EDI protocols out to the partner. The API-led approach enables robust hybrid connectivity that allows real-time business transactions and more efficient business processes. Read this Whitepaper to overcome challenges in MuleSoft’s EDI Implementation. For more information, you can email us at [email protected] or visit

Leave a Reply