Template to map inbound EDI X12 transactions to application message format

(0 reviews)
Template to transform EDI X12 transactions to Enterprise message format

home

This template helps in creating translation mapping to convert inbound EDI X12 messages received from B2B trading partners to application message formats such as JSON or XML.

resources/image-f9fc0de7-a2b5-4a16-9787-b651da3f0b7f.png

Use Case

This Anypoint template serves as a foundation for creating maps for inbound B2B/EDI X12 messages to backend application formats, to be used in Anypoint Partner Manager or in a stand-alone Mule application.

Setup Mule project in Anypoint Studio

  • Setup Mule project in Anypoint Studio
  • Launch Anypoint Studio.
  • From the File menu, select New > Project from Template.
  • Log in to Anypoint Exchange with your Anypoint Platform credentials
  • Search for X12.
  • Click the template named Template to map inbound EDI X12 transactions to application message format.
    • Alternatively, download the template directly from Anypoint Exchange
  • Click Open, to create a new project in your Studio workspace that is preloaded with the template.

Set the Source X12 Message Type

  • The template is configured with X12 version 4010, Transaction set 850 purchase order
  • Follow these steps to set the source X12 message type for the map:
    • Click the Global Elements tab at the base of the Studio canvas in global-configs.xml.
    • From Global Configuration Elements, select X12 EDI Inbound and click Edit.
    • In Schema definitions, select Edit inline.
    • Select the value /x12/004010/850.esl and click the edit icon.
    • Change the schema value to the version and transaction set you want to map from.
      • For example, set Value to /x12/004010/204.esl, if you want to map from 4010-204 Load tender transaction.

Set the Target JSON or XML Message Type

Set the target JSON or XML message type to transform inbound EDI X12 messages to your application message formats, such as XML or JSON:

  1. Copy the schema file of your target application message type into the <Project-name>/src/main/resources folder in the template project.
  2. From the Mule Palette view, click the Transform Message component and drag it on to the Studio canvas.
  3. Select the Transform Message component and in the output section, next to Payload, click Define metadata.
  4. Click Add.
  5. In Type id, enter a new message type ID, for example enterprise-inbound-purchase-order.
  6. Click Create type.
  7. From the Type drop-down menu in Select metadata type, select JSON or XML.
  8. Browse to the location of the JSON or XML schema file you imported in Step 1 and click Select

resources/inb-map-template-tgt-msg-type-7d4a7bb7-fe57-4803-ba89-849842bc3b65.png

X12 to JSON/XML mapping

The new X12 transaction set structure displays in the input pane on the left, and your application message structure (JSON or XML) displays in the output pane on the right.

You can now begin mapping from the input to the output according to your mapping specifications.

resources/inb-map-1f0ffe0f-27dd-4dc6-b826-29d6293d87fb.png

Example map

Download a sample project from Exchange that has pre-built mapping to transform 4010 850 purchase order transactions into a JSON application message structure.

Testing the map locally

Follow these steps to test the translation map locally in Anypoint Studio:

  1. In Package Explorer, right-click on the template project, and select Run > Run as Mule application.
  2. Use a REST client to post an EDI message payload to the URL http://localhost:8081/x12/in.The application returns the translated JSON or XML.
  3. If you are using the map in Anypoint Partner Manager:
    1. After you verify that the map works correctly, copy the DataWeave map from src/main/resources/x12/IN-X12-version-transaction-to-applicationmessage.dwl and rename it to something meaningful, such as IN-X12-4010-850-to-SAP-purchaseorder.dwl.
    2. Later, when you create and configure an inbound message flow in Partner Manager, you can import the dwl file to the Map section.

Reviews

TypeTemplate
OrganizationMuleSoft
Published by
MuleSoft Organization
Published onNov 2, 2020
Asset overview

Asset versions for 1.0.x

Asset versions
VersionActions
1.0.0

Tags