Trading with AS2

Version: 17.07

Supported Since: 17.01

Use Case Description

Hogwarts is one of the best Universities in Great Britain. For the selected students they provide scholarships to support financially for the educational purposes. They have partnerships with many popular organizations to support this effort such as Gringotts bank, Hogsmead cafe and Ollivanders shopping complex. The students are allowed to buy required items from these partner organizations under the name of university. At the end of each month these organizations will compose invoices and send them over to Hogwarts. Hogwarts already have some backend applications to process the receiving invoices and generate a aggregated invoice to be sent out to Gringotts bank.As the information included in these invoices are confidential to the students and the university don’t want see them in wrong hands. Therefore to enforce the security and reliability university has discussed with their business partners and agreed upon establishing a secure and reliable trading system over the AS2 protocol. To provide the AS2 communication support Hogwarts has chose the AdroitLogic UltraESB-X as the trusted solution.

Proposed solution

Hogwarts has designed the solution in a way that the integration point for the ESB and the backend system will be a shared file system. The ESB will persist the receiving invoices over AS2 to a predeclared directory for the backend processing application to pick up. After processing and generating the aggregated invoice the backend application will persist it into a different predeclared directory in the shared file system. ESB is expected to pick the invoice file from that directory and send it over to the bank over AS2.

UltraStudio Configuration

UltraESB-X Configuration


In-order to develop the above mentioned flow, first you need to add AS2, File, Email from connector list and AS2, Attachment dependency from processors list. TIP: If you have already created a project, you can add above dependencies via Component Registry. From Tools menu, select Ultra Studio → Component Registry and from the Connectors list and Processors list, select above dependencies

After that, in the project.xpml file select the AS2 Trading template and fill the necessary fields. After that following resources will be added to the project.xpml file

as2 trading 1

For the complete system to work there are two major message flows required. 1. Message flow to receive invoices over AS2 and send out MDNs 2. Message flow to send out invoices over AS2 and receive MDNs

In-order to develop the AS2 message receipt flow, first let’s create an integration flow named “as2-inbound-integration” and follow the below steps

  1. Add a AS2 Gateway Ingress Connector to obtain the request messages in via As2 from the partner organizations. For the AS2 Gateway Configuration select AS2-Resource.

as2 trading 2
  1. Insert an Attachment Saver element to persist the incoming message to the file system. Use the pattern .*

as2 trading 3
  1. As some trading partners request synchronous MDNs while some others request asynchronous MDNs it is required to insert a MDN Option Evaluator element as the next element of the flow. The Async MDN requested outport of the element should direct the message to the async MDN sending element while the sync MDN sending element should invoke the AS2 Message receiving element to invoke sending the sync MDN with response.

  2. To send out asynchronous MDNs it is required to add an AS2 Async MDN Sender as the final element of the message inbound flow.

The complete flow will look like below.

as2 trading 4

In-order to develop the AS2 message sending flow, first let’s create an integration flow named “as2-outbound-integration” and follow the below steps

  1. Add a File Ingress Connector element to pick invoices from the shared file system and inject them into the ESB

as2 trading 5
  1. The AS2 message sending element expect the AS2 identifiers of the message sending station and the message receiving partner as transport headers of the message. For that lets add two Add Transport Header elements next.

as2 trading 6