Translation Maps
Anypoint Partner Manager uses DataWeave translation maps to transform business transactions between your partner’s message formats (CSV, EDIFACT, X12, JSON, or XML) and your organization’s enterprise application message formats (CSV, JSON, or XML).
To use a translation map, create the map in Anypoint Studio and then import the map to Partner Manager when you configure an inbound or outbound message flow.
To start with an example of a translation map, download and then customize the B2B/EDI: Order to Cash - Mapping Examples from Exchange. This example includes the following transformations for message flows:
-
Inbound message flows:
-
X12 4010 850 to JSON
-
EDIFACT D97A to JSON
-
CSV to JSON
-
XML to JSON
-
-
Outbound message flows:
-
JSON to X12 4010 855
-
JSON to EDIFACT D97A
-
JSON to CSV
-
JSON to XML
-
To customize this example:
-
Open the
.jar
file in Studio. -
Change the source message type.
-
Change the target message type.
-
Map the input to the output.
-
Test the map locally.
-
Import the map to a Partner Manager message flow.
Open the .jar File in Studio
To open the .jar
file:
-
Launch Studio.
-
From the File menu, select Import > Packaged mule application (.jar) and click Next.
-
Select the downloaded
.jar
file and click Open. -
Click Finish.
Change the Source Message Type
To change the message type:
-
Click the Global Elements tab at the base of the Studio canvas.
-
From Global Configuration Elements, select the configuration for the map to use in an inbound or outbound message flow.
-
Click Edit.
-
In Name, change the name of the configuration to something meaningful.
-
If the message flow uses the EDI, JSON, X12, or XML format:
-
In Schema definitions, select Edit inline.
-
In Value, enter the version and transaction set to map to or from.
For example, set Value to
/x12/005010/830.esl
to map to or from a005010-830
transaction.
-
-
Click OK.
Change the Target Message Type
To change the target message type:
-
If your target message type has an associated schema, copy the schema file into the
<Project-name>/src/main/resources
folder in the project. -
Select the Transform Message component.
The new transaction set structure displays in one pane of the Transform Message graphical view, and your application message structure (CSV, JSON, or XML) displays in the other pane of this view.
-
Map the input fields to the output fields.
Test the Map Locally
To test the map locally:
-
In Package Explorer, right-click on the template project, and select Run > Run as Mule application.
-
Use a REST client to post a message payload.
For example Postman calls, see the
B2B-Order-to-Cash-Mapping-Studio.postman_collection.json
file in theexamples
folder.The application returns the transformed payload.
-
After you verify that the map works correctly, copy the DataWeave map from
src/main/resources
and rename it to something meaningful.