Contact Free trial Login

AS2 - Examples - Mule 4

Example: Configure a Send AS2 Message

  1. Place the connector in your flow as applicable.

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

    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 and/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 and/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. The message is 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. The message is 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 where certificates and keys are provided.

    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.

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

  5. Send the file or message by either using Send with sync mdn or Send with async mdn:

    • The payload is the message content to be sent.

    • Filename is the file name of the message being sent.

    • 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 the MDN Listener.

Configure an MDN Listener

Place the connector’s MDN Listener as a source in your flow as applicable and reference the global config defined here.

Key Description

Self config - AS2 OID

Sender partner’s OID.

Self config - x509 alias

Sender’s certificate and/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 and/or private key alias in the keystore.

Partner config - Email

Receiver partner’s email.

HTTP Listener config

Reference to HTTP Listener global config.

Keystore config - Keystore Path

The path of the keystore where certificates and keys are provided.

Keystore config - Keystore Password

The password for the keystore.

Keystore config - Private key Password

The private key password if required.

Example: Configure an AS2 Listener for Receiving a Message

  1. Place the connector’s AS2 Listener as a source in your flow as applicable for your needs and reference the global config as defined here.

    Key Description

    Self config - AS2 OID

    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 config.

    Keystore config - Keystore Path

    The path of the keystore where certificates and keys are provided.

    Keystore config - Keystore Password

    The password for the keystore.

    Keystore config - Private key Password

    The private key password, if required.

    Inbound Request Authentication

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

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

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