Contact Free trial Login

AS2 Connector 6.1 Examples - Mule 4

The following examples show how to configure send and receive messages with receipts in Anypoint Connector for AS2 (AS2 Connector):

Configure Sending AS2 Messages

This example shows you how to configure an AS2 send message with an MDN request.

  1. In Anypoint Studio, place AS2 Connector in your flow.

  2. To send an AS2 message with a request for MDN in your Mule application, create a global AS2 Connector Send config element for use by the AS2 send operations, specify values for the following fields:

    Key Description

    Self config - AS2 Partner Name

    Sender’s AS2 system identifier. Used for AS2-From and AS2-To headers.

    Self config - x509 alias

    Sender’s certificate or private key alias in the keystore. Required if using signing or encryption.

    Self config - Email

    Sender partner’s email.

    Partner config - AS2 ID

    Receiver’s AS2 system identifier. Used for AS2-From and AS2-To headers.

    Partner config - x509 alias

    Receiver’s certificate or private key alias in the keystore. Required if using signing or encryption.

    Partner config - Email

    Receiver partner’s email.

    Requester config - Subject

    Free-form text for MIME subject header. Can include references to self or partner simpleName values along with the message fileName, for example, sending the file example.txt to partner via AS2.

    Requester config - MDN MIC Signature Algorithm

    The algorithm with which MIC is calculated for the MDN signature. UNSIGNED by default.

    Requester config - Request a receipt

    Option to request a receipt from the partner. SIGNED_OPTIONAL by default.

    Requester config - Request delivery URL

    Asynchronous receipt delivery URL that points to the MDN listener endpoint.

    Requester config - Encryption Algorithm

    The encryption algorithm for encrypting the message. UNENCRYPTED by default.

    Requester config - MIC Signature Algorithm

    The algorithm with which MIC is calculated for the message signature. UNSIGNED by default.

    Requester config - Content transfer encoding

    The content transfer encoding. BINARY by default.

    Requester config - Compression type

    ZLIB is the only supported compression and decompression type. NONE by default.

    Keystore config - Keystore Path

    The path of the keystore with certificates and keys.

    Keystore config - Keystore Password

    The password for the keystore.

    Keystore config - Private key Password

    The private key password, if required.

  3. Configure a connection to the partner AS2 endpoint by providing the Partner Base URL value.

  4. If you want to configure other connection details (such as TLS, proxy, basic authentication, and timeouts), do so now.

  5. Send the message by using either the Send with Sync MDN or Send with Async MDN operation:

    • payload is the message content to send.

    • Filename is the file name of the message to send.

    • The Boolean required to configure if the process should fail or if the receipt status is not processed.

  6. If you choose to request an asynchronous receipt, you must configure MDN Listener.

Configure an AS2 MDN Listener for Receiving Receipts

This example shows you how to set up the As 2 mdn listener source to receive receipts.

  1. In the Mule Palette view, select AS2 > As 2 mdn listener.

  2. Drag As 2 mdn listener to the Studio canvas and reference the global configuration defined here:

Key Description

Self config - AS2 ID

Sender partner’s OID.

Self config - x509 alias

Sender’s certificate or private key alias in the keystore.

Self config - Email

Sender partner’s email.

Partner config - AS2 ID

Receiver partner’s OID.

Partner config - x509 alias

Receiver’s certificate or private key alias in the keystore.

Partner config - Email

Receiver partner’s email.

HTTP Listener config

Reference to HTTP Listener global configuration.

Keystore config - Keystore Path

The path of the keystore with certificates and keys.

Keystore config - Keystore Password

The password for the keystore.

Keystore config - Private key Password

The private key password if required.

Configure an AS2 Listener for Receiving Messages

This example shows you how to configure an As 2 listener source to receive MDN requests asynchronously.

  1. In the Mule Palette view, select AS2 > As 2 listener.

  2. Drag As 2 listener to the Studio canvas and reference the global configuration defined here:

    Key Description

    Self config - AS2 ID

    Receiver partner’s OID.

    Self config - x509 alias

    Receiver alias as defined in the keystore file.

    Self config - Email

    Receiver partner’s email.

    Partner config - AS2 ID

    Sender partner’s OID.

    Partner config - x509 alias

    Sender alias as defined in the keystore.

    Partner config - Email

    Sender partner’s email.

    HTTP Listener config

    Reference to HTTP Listener global configuration.

    Keystore config - Keystore Path

    The path of the keystore with certificates and keys.

    Keystore config - Keystore Password

    The password for the keystore.

    Keystore config - Private key Password

    The private key password, if required.

    Inbound Request Authentication

    Configure Basic Authentication credentials that are allowed within the incoming request.

  3. Configure a connection to the partner if the MDN request is to be sent asynchronously.

  4. If you want to configure other connection details (such as TLS, proxy, and timeouts) do that now.