Processing B2B message using AS4 protocol in Integration


This article explains about processing the transaction using the AS4 protocol.


It is assumed that readers of this article know how to setup a B2B enterprise profile, partner on B2B platform, and create a flow service.


• Set up B2B enterprise profile, partner profile, Business Document and TPA.
• Flow service to send and receive the AS4 message.

Topics Covered

  • Develop flow service to send and receive the message using AS4 protocol in integration using One-Way/Push mechanism
  • End to End working flow.

Usecase Flow Diagram

Step 1: The initiating MSH sends the data packaged as a user message to the responding MSH.

Step 2: The responding MSH receives and processes the user message.


• In our use case we have 2 tenants one tenant from where we will submit the transactions and another tenant which will receive the transaction.
• In our use case in B2B Sender is “Silver Brew Enterprises” and Receiver is “Agile Software”
• We will submit the Shipment order xml (Purchase order xml) message from integration using the B2B operation.
• The message is received at the receiver b2b side and then the message is given to Integration for further processing.

What is AS4 protocol?

• AS4 (Applicability Statement 4) is an open standard for the secure and payload-agnostic exchange of Business-to-business documents using Web services.

• Secure document exchange is governed by aspects of WS-Security, including XML Encryption and XML Digital Signatures.

• Payload agnosticism refers to the document type (e.g. purchase order, invoice, etc.) not being tied to any defined SOAP action or operation.

For more details please refer: AS4 - Wikipedia

Message exchange patterns in AS4

AS4 supports the following ebMS MEPs for both the sender and the receiver:

• One-Way/Push: Sends a user message to a trading partner.

• One-Way/Pull: Sends a pull signal to a trading partner to receive a user message.

• Two-Way/Sync: Synchronously exchanges messages between two trading partners.

• Two-Way/PushPull: Pushes a request user message to a trading partner and uses a pull signal to receive a reply user message.

• Two-Way/PushPush: Asynchronously exchanges messages between two trading partners.

For more details please refer: Working with Trading Partner Agreements - B2B

Setup is done on B2B

• Configuration for source tenant

Enterprise Profile

Partner Profile

Outbound Channel for AS4 Protocol

Configure trading partner agreement

  1. AS4 protocol, all the configuration, and details are configured at the TPA level.
  2. It has become quite critical we configure the TPA with all mandatory details. During run time all the configurations are referred from TPA only.
  3. Attached is the TPA zip file for reference. (2.9 KB)

Configuration for Destination tenant

Enterprise Profile

Partner Profile

Create Inbound AS4 channel

Create a Custom XML document

• Created the custom shipment order XML document.
• After importing it, promote the attributes to identify the sender and receiver.

Create a Processing rule to process the received message

Assets developed on Integration layer

Source tenant

  • Developed asset to submit the message from Integration flow service to B2B.
  • In our case we have developed the flowservice ”SubmitAS4Message”.

• Attached is the flowservice for the same. (9.6 KB)

Destination tenant

  • Developed asset to receive the message from B2B.

  • In our case we have developed the flow service “RcvDataFromB2B”.

  • This will receive the data from B2B and parse it.

  • Attached is the flow service for the same. (9.6 KB)


  • In our case we have set extract attachment as true in the TPA. Therefore we can receive and parse the actual data directly.
  • If we have not set the parameter to true, then we need to use getContentParts operation to extract the message.

End-to-End Testing

  1. Transaction on B2B source tenant.

  1. Transaction received on destination B2B tenant.

Transaction received Integration

Assets Developed

Source Tenant.

FlowService: SubmitAS4Message (9.6 KB)

B2B Assets

Destination Tenant.

FlowService: RcvMessageFromB2B (9.6 KB)

B2B Assets

1 Like