Template to map application messages to outbound EDI X12 transactions

(0 reviews)
Template to map application messages to outbound EDI X12 transactions

home

This template helps in creating translation map to convert application messages (JSON / XML) to outbound EDI X12 messages to be sent to B2B trading partners.

resources/otb-template-1-b6d61c7c-560f-40cb-8c70-a5d83acf4126.png

Use Case

This Anypoint template serves as a foundation for creating maps for converting outbound business transactions (such as purchase orders or invoices) from application message formats such as JSON or XML to EDI X12 transactions, to be used in Anypoint Partner Manager or in a stand-alone Mule application processing the B2B integration workloads.

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 application messages to outbound EDI X12 transactions.
    • 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 JSON or XML Message Type

Set the source JSON or XML message type to define the metadata structure of your application message, 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. Select the Transform Message component in Studio canvas, and in the input section, next to Payload, click Define metadata.
  3. Click Add.
  4. In Type id, enter a new message type ID, for example enterprise-outbbound-purchase-order.
  5. Click Create type.
  6. From the Type drop-down menu in Select metadata type, select JSON or XML.
  7. Browse to the location of the JSON or XML schema file you imported in Step 1 and click Select

resources/otb-src-msg-type-645ac50e-6165-485b-a1ed-3c1cd100fb4c.png

Set the Target EDI 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 to 4010-204 Load tender transaction.

JSON/XML to EDI X12 mapping

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

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

resources/otb-map-09bff6f6-5be8-4acb-a7f2-1e999a9cffe5.png

Example map

Download a sample project from Exchange that has pre-built mapping to transform XML purchase order messages to EDI X12 850 transactions.

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 a JSON or an XML payload to the URL http://localhost:8081/x12/out.The application returns the translated EDI X12 transaction.
  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/OUT-application-message-to-X12-version-transaction-partner.dwl and rename it to something meaningful, such as OUT-SAP-purchaseorder-XML-to-X12-4010-850-MythicalSupplier.dwl.
    2. Later, when you create and configure an outbound 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.2
1.0.1

Tags