This page explains how to setup an OpenPEPPOL AS2 AccessPoint from scratch. AP is the abbreviation for Access Point which is the technical endpoint for sending and receiving business documents.
There are three known possibilities (I'm aware of) on how to build an AS2 AccessPoint. The first one is using the cipa-dispatcher project which is part of the CIPA e-Delivery project maintained by the European Commission. It is a Mendelson frontend and therefore requires Mendelson to be setup besides CIPA. The second possibility is to use Oxalis as the software of choice. And the third solution - the one described in this document - is the usage of my as2-lib as the AS2 communication channel and as2-peppol-servlet for receiving AS2 messages within a standard Java servlet. By default no external AS2 software is required for this solution, so I'm presenting a fully self-contained Open Source solution. This solution is also used by the Austrian government to receive e-Invoices via PEPPOL.
Before you can start you need to have the following information in place:
An AccessPoint is a technical adapter for sending and receiving PEPPOL UBL documents. The following images shows the overall structure of a transmitted AS2 message in a very simplified way:
The outermost container is an S/MIME (Secure / Multipurpose Internet Mail Extensions) message. It is a basic MIME message including signature data. One MIME part of the message is the so called Standard Business Document Header (SBDH). It is a UN/CEFACT standard for merging XML documents with relevant metadata into a single XML document. PEPPOL maintains its own Envelope specification that is based on SBDH. Finally inside the SBDH the main UBL business document is contained. The complete UBL 2.1 specifications can be downloaded from the OASIS UBL web site.
This section points to projects that help in implementing the different layers of an AS2 message. If you are already familiar with these concepts you may simply skip this section.
<dependency> <groupId>org.bouncycastle</groupId> <artifactId>bcmail-jdk15on</artifactId> <version>1.56</version> </dependency> <dependency> <groupId>com.sun.mail</groupId> <artifactId>javax.mail</artifactId> <version>1.5.6</version> <exclusions> <exclusion> <groupId>javax.activation</groupId> <artifactId>activation</artifactId> </exclusion> </exclusions> </dependency>Note: the
activationartefact is excluded from
javax.mailbecause when using JDK 6 (or higher) the activation package is already contained in the Java runtime.
<dependency> <groupId>com.helger</groupId> <artifactId>ph-sbdh</artifactId> <version>3.0.2</version> </dependency> <dependency> <groupId>com.helger</groupId> <artifactId>peppol-sbdh</artifactId> <version>5.2.4</version> </dependency>
<dependency> <groupId>com.helger</groupId> <artifactId>ph-ubl21</artifactId> <version>5.1.0</version> </dependency>
An example project that shows how to receive PEPPOL documents via AS2 can be found in the as2-peppol-server project. It uses as2-lib, ph-ubl and peppol-sbdh to receive messages from arbitrary PEPPOL AS2 receivers. It requires no external AS2 handler (like Mendelson) and no mandatory database setup. as2-peppol-server is a Java 1.6+ project and licensed under Apache 2.0 license.
Detailed setup description can be found directly on the as2-peppol-server project page.
An example project that shows how to send PEPPOL documents via AS2 can be found in the as2-peppol-client project. It uses as2-lib, ph-ubl and peppol-sbdh to send messages to arbitrary PEPPOL AS2 receivers. as2-peppol-client is a Java 1.8+ project and licensed under Apache 2.0 license.
The steps to send a document are outlined as follows:
0088:test). The determination of the recipient ID is not in scope for PEPPOL!
busdox-transport-as2-ver1p0. From this endpoint use EndpointReference as the destination URL and also remember the certificate of the recipient. It is later needed to extract the as2-to ID.
com.helger.peppol.sbdh.DocumentDatawhich is filled with the UBL document, the sender participant ID, the receiver participant ID, the document type ID and the process ID (all stated in the prerequisites above).
APP_1000000002) received via the previous SMP lookup.