This example illustrates how to transform enterprise outbound purchase order XML messages into EDI X12 850 purchase order transactions and send to external trading partners such as suppliers as part of an order-to-cash lifecycle.
This example receives outbound purchase order transactions from back-end systems via a HTTPS listener, and leverages Dataweave and X12 Write operation of the Anypoint X12 connector to transform the XML messages into X12 850 transactions. The translated EDI purchase order transactions are published to an Anypoint MQ queue, to be sent to a supplier via AS2 as outlined in this example.
Setup the Example
- Open the Example project in Anypoint Studio from Anypoint Exchange.
- Install the latest version of Anypoint X12 connector
- Update the configuration property file located in src/main/resources/app.properties with the below values.
- Anypoint MQ configurations
- Create a new Anypoint MQ queue b2b-outbound-mythical-as2.q from Anypoint MQ console
- Create a new client app in Anypoint MQ console
- Update the below properties in app.properties file with the API URL, Client Id and Client Secret for the Anypoint MQ connection.
- The project includes the dataweave map to transform Enterprise outbound XML purchase order messages into EDI X12 4010 850 transactions.
- Note: The example uses static configurations for X12 identifiers and Anypoint MQ. They can be replaced with expressions for dynamic routing and setting up of identifiers.
- Deploy the project to CloudHub or run locally
Run the Example
- Using a REST Client, POST the XML payload src/main/resources/Enterprise-Outbound-PO.xml to https://localhost:8443/b2b/enterprise-ob-po/ or https://app-name.cloudhub.io/b2b/enterprise-ob-po/ if deployed to CloudHub.
- The raw EDI X12 850 purchase order transaction is returned as the response, and it is also published to the Anypoint MQ queue b2b-outbound-mythical-as2.q, ready to be sent to the trading partner.