Nav

AS2 and EDI X12 Purchase Order WalkThrough

This page shows how a company can use Anypoint Partner Manager (APM) to manage and track B2B processes. You will develop a Mule application that:

  1. Transforms an XML purchase order read from the company’s filesystem to an X12 850 document

  2. Sends the 850 to a supplier over AS2

  3. Listens for (on an AS2 endpoint) and receives an X12 997 document that identifies whether the 850 was accepted or rejected

APM manages and records all B2B exchanges.

B2B_AS2EDI_01

Audience

This document is intended for a technical audience with basic knowledge of Anypoint Platform, including:

Setting up a Partnership

The first step in building the solution is to create a partnership in Anypoint Partner Manager between your organization and a supplier.

In this walkthrough, we show an example in which you initiate an order from a supplier, but APM works equally well when a customer is ordering from you.

A partnership:

  • Identifies your company

  • Identifies your partner

  • Establishes the parameters by which B2B data is exchanged between you and your partner

  • Allows this data to be tracked and viewed from Anypoint Partner Manager

Get Started

  1. Start APM. The B2B Transactions Page appears.

  2. In the left-hand navigation pane, click Trading Partners. The Trading Partners Page appears.

img-partner-configuration
Figure 1. Trading Partners Page

Configure Home Company Identifiers

  1. On the Trading Partners Page, click the top partner (Your company) in the Trading Partners list.
    The Company Information Page appears.

  2. On Company Information Page, in the left-hand navigation pane, click Identifiers.
    The Identifiers Page appears.

  3. On the Identifiers Page, click New.
    The Identifier Page appears.

  4. On the Identifier Page, click the down-arrow in the Type dropdown listbox, then click AS2.
    The AS2 Identity box appears.

  5. In the AS2 Identity box, enter MOUNTAINOUT, then click Save.

  6. In the left navigation pane, click Identifiers to return to the Identifiers Page.

  7. Click New to add another identifier.
    The Identifier Page appears.

  8. On the Identifier Page, click the down-arrow in the Type dropdown listbox, then click X12-ISA.
    X12 Identity boxes appear.

  9. At the right end of the Interchange ID Qualifier (ISA) dropdown listbox, click the down-arrow to display options for this setting.

  10. Click ZZ (Mutually Defined).

  11. In the Interchange ID (ISA) box, enter MOUNTAINOUT.

  12. Click Save.

Create and Configure a Partner

In this section, you will:

  • Create a trading partner

  • Configure the partner’s AS2 and X12 identities

  • Set the runtime parameters with which the AS2 Connector and X12 Module operate when sending to the supplier or receiving from that supplier

Create a Partner

  1. On the Trading Partners Page, click Create new partner.
    The Company Page appears.

  2. In the Company Name box, enter MY-SUPPLIER.

  3. Click Save.

Create an AS2 Identity

  1. In the left navigation pane, click Identifiers.
    The Identifiers Page (for the partner you created in [Create Partner]) appears.

  2. Click New.
    The Identifier Page appears

  3. On the Identifier Page, click the down-arrow in the Type dropdown listbox, then click AS2.
    The AS2 Identity box appears.

  4. In the AS2 Identity box, enter MY-SUPPLIER, then click Save.

  5. In the left navigation pane, click Identifiers to return to the Identifiers Page.

  6. Click New to add another identifier.
    The Identifier Page appears.

  7. On the Identifier Page, click the down-arrow in the Type dropdown listbox, then click X12-ISA.
    X12 Identity boxes appear.

  8. At the right end of the Interchange ID Qualifier (ISA) dropdown listbox, click the down-arrow to display options for this setting.

  9. Click ZZ (Mutually Defined).

  10. In the Interchange ID (ISA) box, enter MOUNTAINOUT.

  11. Click Save.

Configure an AS2 Endpoint

  1. In the left navigation pane, in the CONFIGURATION section, click Endpoints.
    The Endpoints Page appears.

  2. On the Endpoints Page, click New.

  3. In the Endpoint section, enter the following values in the corresponding boxes:

    Box

    Value

    Protocol

    AS2

    Type

    Send

    If you do not enter a value in the Name box, APM populates the box with a name that combines the Protocol, the Type, and the Partner Name. If you choose to enter a different name, consider that the name should lend itself to recognition in the context of being selected in other APM contexts.
  4. Verify that Default for My Supplier is checked.

  5. In the Settings section, in the URL box, enter http://localhost:8081.

  6. Click Save.

  7. In the left navigation pane, click Endpoints.
    The Endpoints Page appears.

  8. On the Endpoints Page, click New.
    The Endpoint Page appears.

  9. In the Endpoint section, enter the following values in the corresponding boxes:

    Box

    Value

    Protocol

    AS2

    Type

    Receive

    Regarding the Name box, the note provided for the Send Endpoint applies here, also.

  10. Verify that Default for My Supplier is checked.

  11. In the Settings section, in the URL box, enter http://localhost:8082.

  12. Click Save.

  13. In the left navigation pane, click Endpoints.

Copy your Environment ID

  1. On the B2B Transactions Page, in the left-hand navigation pane, click Administration, then click Environments.

  2. In the row that corresponds to the environment with which you are working, click copy.

Identify or Create an API Key

In order to create a Mule project, you must enter an API Key and an environment ID.

If you have an existing API Key, use it. If you do not know the API Key, consult your organization’s MuleSoft administrator.

If your organization has not created an API Key, you can use APM to create one.

The API Key is used by every Mule application across your entire Master Organization that communicates with Anypoint Partner Manager. Therefore, before you create a new API Key, coordinate with your organization’s MuleSoft administrator to ensure that none of your organization’s processes are using an existing API Key because, if they are, creating a new API Key will cause them to cease functioning. In that case, instead of creating a new API Key, use the existing API Key.

To obtain a key, see Create a New API Key.

You can determine your environment ID on the same page that you create a new API key.

Setting up an Anypoint Studio Project

For information about using Anypoint Studio, see Anypoint Studio.

  1. Download as2-x12-walkthrough.zip.

  2. In Anypoint Studio, click File.
    The File Menu appears.

  3. On the File Menu, click Import.
    The Import Source Selection Window appears.

  4. In the Import Source Selection Window, select Anypoint Studio generated Deployable Archive (.zip).

  5. Click Next.
    The Import Mule Project Window appears.

  6. In the Import Mule Project Window, browse to the location to which you downloaded the archive (in Step 1), then select the archive and click Open.
    The Project Name box auto-populates.
    NOTE: The Project Name must be unique with respect to any previously-imported projects. If it is not, Finish will not be enabled. If this is the case, change the Project Name so that Finish is enabled.

  7. Click Finish.
    The project appears in the Anypoint Studio Package Explorer pane.

  8. In the project (expand if necessary), expand the src/main/app, double-click mule-app.properties.
    Project properties appear in the Anypoint Studio Canvas.

  9. In Line 1, api.key = NEED_TO_FILL_IN, replace NEED_TO_FILL_IN with the API Key from Identify or Create an API Key.

  10. In Line 2, environment.id = NEED_TO_FILL_IN, replace NEED_TO_FILL_IN with the environment ID from Copy your Environment ID.

  11. In Anypoint Studio, click File, then click Save All.

Running the Application

  1. In Anypoint Studio, right-click the project.

  2. On the right-click menu, click Run As, then click Mule Application.
    On startup, the application creates an outbox folder in the project’s root directory. If the outbox directory isn’t visible, refresh the project in the Package Explorer view.

  3. The project includes a file named po.xml in the src/test/resources folder. Copy po.xml, then paste it in the outbox folder.
    The application processes the pasted file, then deletes it.

  4. In Anypoint Manager, in the left navigation pane, click Transaction Monitoring
    The Transaction Monitoring Page appears.

img-transaction-monitoring
Figure 2. Transaction Monitoring Page

The Transaction Monitoring Page should confirm that:

  • An XML purchase order was read from the company’s filesystem and transformed to an X12 850 document.

  • The 850 was sent to a supplier over AS2.

  • The AS2 Connector listened for (on an AS2 endpoint) and received an X12 997 document that identifies whether the 850 was accepted or rejected.

For more information, see: