Skip to content
AS2 overview

AS2 overview

This page explains how AS2 works in MicroB2B and what you set up, in which order. The other AS2 pages cover each piece in detail.

What AS2 is

AS2 is a way to send business documents between two companies over HTTP or HTTPS. Each side runs an AS2 server and posts files to the other side’s address. AS2 adds three protections on top of a plain upload:

  • Signing proves who sent a message and that nobody changed it on the way.
  • Encryption keeps the contents secret from anyone who reads the traffic.
  • Receipts (called MDNs) confirm that the partner received the message intact. An MDN is a short, usually signed, reply from the receiving side.

Signing and encryption use certificates. You hold your own certificate with its private key. Your partner sends you their public certificate, and you send them yours.

MicroB2B never reads the documents it moves. It signs, encrypts, sends, receives and stores them as files.

The pieces

A partner’s page with its AS2 profile A partner’s page with its AS2 profile
PieceWhat it isWhere
CertificateA public certificate, with or without its private keyCertificates
OrganizationYou, the company that sends and receivesOrganizations
Organization AS2 profileYour AS2 ID and the certificate you sign and decrypt withThe organization’s page, Configure AS2
PartnerThe company you trade withPartners
Partner AS2 profileThe partner’s AS2 ID, address, certificates and security optionsThe partner’s page, Configure AS2
AS2 receiverListens on a port and path for messages from partnersPlugins > AS2 Receivers
AS2 senderPosts messages to partnersPlugins > AS2 Senders
RouteSays where a message goes nextRoutes

How a message flows

Incoming. A partner posts a message to your AS2 receiver. The receiver finds your organization by the AS2-To header and the partner by AS2-From. It decrypts the message, checks the signature and unpacks it. It answers with a receipt when the partner asked for one. Then your routes decide where the file goes, for example to a file writer.

A message for an AS2 ID that MicroB2B does not know is refused and not stored.

Outgoing. A file poller (or another source) picks up a file. A route sends it to an AS2 sender. The sender looks up both AS2 profiles by the message’s organization and partner. It compresses, signs and encrypts the file as the partner profile says, and posts it to the partner’s endpoint. The partner’s receipt then confirms the delivery.

Set it up in this order

  1. Upload your certificate with its private key, and the partner’s public certificate. See Certificates.
  2. Create your organization and give it an AS2 profile. See Organization AS2 profile.
  3. Create the partner and give it an AS2 profile. See Partner AS2 profile and AS2 security.
  4. Check that you have an AS2 receiver and an AS2 sender. A fresh installation has one of each. See AS2 receiver and AS2 sender.
  5. Check the routes for both directions. A fresh installation already routes its default file poller to its AS2 sender, and its AS2 receiver to its file writer. See Routes.
  6. Test the connection and send a test message. See Testing a partner.

Example: one partner, both directions walks through all of this for one partner.

Exchange details with your partner

Before you start, agree on these details with your partner and write them down:

You give the partnerThe partner gives you
Your AS2 IDTheir AS2 ID
Your receiver’s URL, for example https://as2.example.com/as2Their endpoint URL
Your public certificateTheir public certificate
Your receipt URL, if they send receipts asynchronouslyTheir TLS server certificate, if it is self-signed or from a private CA

Also agree on signing, encryption and receipts. The defaults of a new partner profile suit most partners.

AS2 IDs

An AS2 ID names one side of an AS2 exchange. It can be 1 to 128 printable ASCII characters: letters, digits, spaces and punctuation. It cannot contain " or \, and cannot start or end with a space. MicroB2B compares IDs exactly, so case and spaces count.

An ID with a space travels in quotes, for example AS2-From: "ACME CORP". MicroB2B removes the quotes from incoming headers before it looks up the profiles. So "ACME CORP" and ACME CORP both find the partner ACME CORP. A header that is not a valid AS2 ID is refused with HTTP 400 before anything is stored.

When something goes wrong

Each message has a page with its history and the reason for any failure. AS2: sending problems lists the common AS2 problems and what to do about them.