AS2 Client to send B2B transactions to trading partners

(0 reviews)
AS2 Client to send B2B transactions to trading partners



This example illustrates how to implement a secured AS2 client application to send real-time B2B transactions to trading partners such as customers, suppliers, and 3rd party logistics providers.

This example subscribes to an Anypoint MQ queue to consume outbound business transactions, and leverages the AS2 Send with Sync MDN operation of the Drummond Group certified Anypoint AS2 Connector, to send the transactions to B2B trading partners via a secured AS2 transport protocol.

Setup the Example

  • Open the Example project in Anypoint Studio from Anypoint Exchange.
  • Install the latest version of Anypoint AS2 connector
  • The example project includes the required certificate / key pairs for the AS2 listener.
  • Update the configuration property file located in src/main/resources/ with the below values.
    • as2-keystore.password=test
    • tls-truststore.password=test
    • tls-keystore.password=muletest
  • 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 file with the API URL, Client Id and Client Secret for the Anypoint MQ connection.
      • anypoint-mq.url
      • anypoint-mq.clientid
      • anypoint-mq.clientsecret
  • Update the property as2.URL in src/main/resources/ with the URL of the trading partner’s AS2 receiver
  • Update the below properties in file with the basic authentication credentials for the AS2 URL.
    • as2-basicauth.user
    • as2-basicauth.password
    • Note: If the target AS2 service does not use basic authentication, set the Outbound request authentication parameter in the Authentication tab of the AS2 Send configuration to None.
  • Deploy the project to CloudHub

Run the Example

  • Publish a message to the Anypoint MQ queue b2b-outbound-mythical-as2.q from MQ console or an application.
  • The message should be picked up and sent to the trading partner’s AS2 service
    • Received AS2 message is published to the Anypoint MQ as2-inbound-edi.q as outlined when using the AS2 Listener example.
  • Alternatively, you can also use the application to send messages to any externally accessible AS2 receiver.
    • Update the AS2 Send configurations in the app to include the AS2-From, AS2-To identifiers & relevant certificates as appropriate in the AS2 Send configuration.


Published by
MuleSoft Organization
Published onNov 2, 2020
Asset overview

Asset versions for 1.0.x

Asset versions


B2BEnterprise ITMessagingNo values left to add
Industry Vertical