Introduction

The AS2 Connector allows you to send and receive data from AS2 certified servers.

After reading this page you should be able to accomplish the following:

  • Install the AS2 Connector.
  • Build a simple Hello World project.
  • Run the example project.

Prerequisites

  • Anypoint Studio October 2014 with 3.5.1, 3.5.2 or 3.6.0 Runtime
  • AS2 Connector Eclipse Update Site distribution
  • JCE unlimited strength jurisdiction policy
  • Oracle Java Runtime Environment 7

Installing AS2 Connector

The following instructions were written for Anypoint Studio on OS X. Instructions may vary for other operating systems.

1. Launch Anypoint Studio and click on Help -> Install New Software.

installation step 1

2. Press Add to create a new repository.

installation step 2

3. Type in “AS2 Connector” in the Name field and click on Archive…

installation step 3

4. Select the AS2 connector Eclipse “Updatesite.zip” distributed by Modus Integration and press Open.

installation step 4

5. Expand Standard and select AS2 Module. Press Next > to review the items to be installed.

installation step 5

6. Press Next > again to review and accept the license. Press Finish to install the connector.

installation step 6.1 installation step 6.2

7. Press OK to accept the prompted security dialog box and allow Anypoint Studio to restart.

installation step 7.1 installation step 7.2

Example Use Case - Hello World

The following example requires basic familiarity with AS2, Anypoint Studio, and Mule ESB.

Receive AS2 messages without an agreement

Step 1

Create a new Mule Project using as run-time Mule Server 3.5.1 EE:

example step 1

Step 2

Locate the AS2 Connector on the right hand-side palette:

example step 2

Step 3

Drag the connector over to the canvas:

example step 3

Step 4

The connector requires an AS2 Connector Configuration. To create a connector configuration, you must first create a global HTTP endpoint and then bind the connector configuration to the endpoint. The connector’s operations leverage the HTTP endpoint to receive and send AS2 messages.

Click on the Global Elements tab and create an HTTP endpoint:

example step 4

Step 5

Set the HTTP endpoint name to the more descriptive name of “receive-as2-http-endpoint”. Click on the Connector Configuration add symbol to bring up the HTTP connector configuration dialog:

example step 5

Step 6

Set the HTTP connector name to the more descriptive name of “as2-http-connector” and press OK to go back to the global HTTP endpoint dialog box:

example step 6

Step 7

Press OK to close the global HTTP endpoint dialog box:

example step 7

Step 8

In this step, you will make an AS2 connector configuration and bind it to the global HTTP endpoint. From the Global Elements tab, create an AS2 Connector Configuration:

example step 8

Step 9

Type “receive-as2-http-endpoint” in the attribute Global HTTP Endpoint Reference to bind the AS2 connector to the previously created global HTTP endpoint. Press OK.

example step 9

Step 10

After completing the previous steps, you should have the following in the Global Elements tab:

example step 10.1

Back to the Message Flow tab, on the AS2 processor, select “AS2” from the Connector Configuration drop-down list and select “Receive” from the Operation drop-down list:

example step 10.2

Step 11

The connector’s Key Store Path attribute must be configured in either of the following scenarios:

  1. Connector receives a signed request,
  2. Connector receives an encrypted request
  3. Sender requests a signed receipt

The key store must be in JKS format. For scenario 1, the key store has to contain the certificate used by the AS2 connector to verify the request’s authenticity. Scenario 2 and 3 require the key store to have a dual-purpose public/private key pair that the connector uses to decrypt the request and sign the receipt. The key store entry alias name for the certificate is required to match the AS2-From field received in the request’s headers. Similarly, the key store entry alias name for the public/private key pair is required to match the AS2-To field received in the request’s headers. The attribute Key Store Password must be set if the key store is protected by a password.

A cross-platform tool that can help you with the setting up of JKS key stores is KeyStore Explorer.

IMPORTANT: For CloudHub deployments, key stores must be located within the Mule application Java classpath (e.g., “src/main/resources”). Furthermore, the key store path attribute has to be relative to the classpath. For instance, if the key store is located at “src/main/resources/key-stores/my-key-store.jks”, then Key Store Path is set to “key-stores/my-key-store.jks”.

Step 12

Add a File outbound endpoint to save the sender’s AS2 request content. Drag a File outbound endpoint from the palette next to the AS2 Connector. Set the Path attribute to “outbox” and Output Pattern to “data.txt”:

example step 12

Step 13

Finally, run the example as a Mule application:

example step 13

The connector will save the content of valid AS2 requests in the file “data.txt” inside the project root directory “outbox”.