Reading Time: 13 minutes

In our previous blogs, we covered a high-level overview of various Anypoint B2B integration solutions to seamlessly connect with your trading partner ecosystem for exchanging business transactions. As part of the “How to” blog series, we will walk through various B2B integration use cases with Anypoint B2B Solutions. Our goal with this blog is to cover a B2B integration use case that processes EDI X12 transactions.

About X12

X12 is a popular EDI standard widely followed across industries in North America for a variety of use cases, enabling organizations to integrate with their business partners efficiently. 

Anypoint X12 connector

MuleSoft’s Anypoint X12 connector helps organizations simplify steps for configuration, validation and translation of X12 messages without having to worry about implementation. The X12 connector can be used for use cases such as:

  • Managing the end-to-end order-to-cash workflow using the X12 connector from receiving purchase orders, sending shipment notices, handling invoices, and payment reconciliation.
  • Managing the full lifecycle of supply chain operations by integrating transportation management systems (TMS) and Warehouse management systems (WMS).
  • Exchanging employee healthcare information securely between organization and healthcare provider to implement the employee benefit eligibility, coverage, and benefit enquiry by leveraging standardized X12 HIPAA EDI documents.
  • Healthcare claims processing.

Processing X12 transactions with Anypoint X12 connector

In this blog, we will cover an use case with two fictional enterprises, NTO Retailer and Mythical Supplier, exchanging purchase orders as outlined in the following diagram:

  • At NTO Retailer: Translate outbound enterprise purchase order XML messages from back-end ERP into EDI X12 850 transactions.
  • At Mythical Supplier: Validate inbound EDI purchase orders received, translate to enterprise purchase order JSON structure, and integrate with back-end systems.

As a prerequisite, install the latest version of the X12 Connector in Anypoint Studio prior to downloading the demo X12 applications.

NTO Retailer: Outbound Purchase Order application

We will use the demo application example-b2b-nto-outbound-purchase-order to showcase how to implement the XML to EDI X12 transformation using DataWeave and Anypoint X12 Connector’s Write operation.

The application uses a HTTPS Listener as the message source to receive enterprise purchase order XML messages from the back-end systems, DataWeave + X12 Write to translate the XML message into X12 v4010 850 Purchase order EDI message. The generated X12 message is published to an Anypoint MQ queue, to be sent to Mythical Supplier via AS2.

X12 Write configuration

Schema definitions: Choose Edit inline and add /x12/004010/850.esl

X12 Connector uses EDI Schema Language (ESL) to maintain X12 standard specifications supported by the connector. You can also clone the standard ESLs and customize should you or your trading partner have a requirement deviating from the X12 standards.

Identity: Setup the ISA/GS Sender and Receiver identifiers, along with the qualifiers. These fields can be dynamically populated using expressions. The demo application uses a static configuration.

Writer: Configurations for delimiters, control numbers, and other validations for the X12 data generated.

XML to EDI X12 850 transformation

The Transform message component in the application translates the received XML enterprise purchase order payload into EDI X12 850 message structure. X12 Write component with the schema definition (850.esl) lets DataSense to automatically populate the X12 structure on the target side of the map, enabling easier way to map the XML data into X12 structure. 

The output of the DataWeave map is X12 message presented in a Java Object structure and the X12 Write component in the next step performs the validation against X12 specifications and the validation rules in the connector configuration, producing the raw EDI message in X12 format.

X12 Control numbers

X12 Connector provides three ways of generating control numbers on the generated X12 payload.

  • X12 Connector managed global control numbers through control number keys
    • When to use: If your organization or your trading partner have a requirement to maintain uniqueness of interchange, group or transaction set control numbers across different identifier combinations and document types.
    • How to use: 
      • Set the configuration “Use supplied values” to False.
      • Leverage the control number key configurations (at the configuration level, or operation level) to set a key that is unique for the partner. These values can be dynamically passed at the operation-level.

For example: The values for the interchange and group control number keys can be “PartnerName-ISA,” “PartnerName-GS,” used across different identifiers and transaction types for the same partner.

  • X12 Connector managed identifier combination control numbers:
    • The connector automatically maintains the sequencing of control numbers for the sender/receiver identifier combination, initializing the value to the number specified in the configuration.
    • When to use: If you want the connector to automatically maintain the sequencing based on the sender/receiver identifiers and do not have requirements for global control numbers at a partner level.
    • How to use:
      • This is the default behavior when no value is passed into the optional interchange / group / Transaction number key configurations.
      • The Write configuration “Use supplied values” must be set to False.
  • Bring your own control number 
    • If you need to generate the control numbers and use them on the EDI payload, you can set the parameter “Use supplied values” to true, and map the desired control number on the payload in the DataWeave map.
Deploying the outbound PO application

Deploy the application to CloudHub or a standalone Mule runtime, and NTO Retailer is now ready to receive outbound enterprise purchase order XML messages from back-end systems, and send EDI purchase orders to Mythical Supplier.

Mythical Supplier: Inbound purchase order application

We will use the demo application example-b2b-mythical-inbound-purchase-order to showcase how to implement the inbound purchase order service at Mythical Supplier’s end.

The application receives the raw X12 850 purchase order messages from an Anypoint MQ (published by the AS2 receiver application in the previous blog), uses X12 Read operation to validate received EDI 850 purchase order messages, transform to the inbound enterprise purchase order JSON format and handoff to a process API for further processing into the ERP/Order Management system. For demo purposes, the process API writes the translated JSON to Anypoint MQ.

X12 Read configuration

Configure the path to the ESL (/x12/004010/850.esl) in the Schema definition.

Identity: ISA/GS sender and receiver identifiers.

Parser: Configure the validation/parsing rules to be applied for validation.

EDI X12 850 to JSON transformation

DataWeave component after the X12 read is used to transform the EDI data into the enterprise inbound purchase order JSON message format.

The translated data then gets sent to the process API via HTTP request component, and subsequently is published to Anypoint MQ.

Deploying the inbound PO application

Deploy the application to CloudHub or a standalone Mule runtime, and Mythical supplier is now ready to receive EDI purchase orders and seamlessly integrate with the backend applications.

Testing the end-to-end flow

This completes the end-to-end implementation of the use case.

Post an XML purchase order payload to NTO Retailer’s outbound purchase order service.

The message will not go through the below processing stages:

Browse the Anypoint MQ queue where the translated inbound enterprise purchase order is published after Mythical Supplier receives the EDI data via AS2 and converts into JSON format.

Summary

To get started with Anypoint Platform, sign up for a free trial version or learn more about the modern approach to B2B integrations. Anypoint AS2 & X12 Connectors are premium connectors, requiring additional entitlement. Contact your account representative to obtain a trial license for the AS2 and X12 connectors.

In the upcoming blog, we will showcase how to configure, test, and deploy B2B integrations quickly using Anypoint Partner Manager –– taking advantage of features to onboard trading partners quickly, gain improved visibility into their B2B transactions activity and enable organizations to easily manage their growing trading partner ecosystem. 


Series Navigation<< How to implement AS2 connectivity with your B2B trading partner networkHow to quickly onboard B2B trading partners with Anypoint Partner Manager >>