An example AS2 server to easily receive AS2 messages from PEPPOL
Java CSS
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


Build Status  A demo AS2 server to easily receive AS2 messages from PEPPOL. This project is only meant as a demo project for illustrative purposes, on how to implement a PEPPOL AS2 server. This server implementation writes all incoming documents to disc and does not do anything else with them! Additional or different logic must be implemented!

This AS2 server is based on my as2-lib library, as well as on as2-peppol-servlet, peppol-commons and ph-ubl. A client to send messages to this server is as2-peppol-client.

This project is licensed under the Apache 2 License.

Project structure

This project is a Java 1.8+ web application and as such meant to be used in an application server (like Tomcat, Jetty etc.).

It consists of the following major components:

  • A specialized servlet for retrieval: com.helger.peppol.as2server.servlet.PEPPOLAS2ReceiveServlet which defines the configuration for processing incoming files. The servlet is referenced from src/main/webapp/WEB-INF/web.xml.
  • The main handler for an incoming SBDH document in class com.helger.peppol.as2server.handler.AS2IncomingSBDHandler. This class is referenced via the default SPI lookup mechanism (see src/main/resources/META-INF/services/).
  • Additionally a configuration file src/main/resources/ is provided that defines the AS2 specific setup. It contains the path to the keystore as well as in which folders to store what

Before you start

Before this project can be run in a useful way a PKCS12 keystore with your PEPPOL AP certificate must be provided. By default the keystore must be located in src/main/resources/keystore/ap.pilot.p12 and must have the password peppol. To change this edit the file.

Btw. you need no database to run this server. If you want one just use one - but you don't need to.

Run it

The easiest way to run and debug the application is to execute class com.helger.peppol.as2server.jetty.RunInJettyPEPPOLAS2 from within your IDE (as a standard Java application). It starts up a minimal server and listens on port 8080. The servlet that receives PEPPOL messages listens to path /as2/ and supports only HTTP method POST. After startup locate your browser to http://localhost:8080 to check if it is running.

Test it

Now that the AS2 server is running you may have a closer look at my as2-peppol-client project which lets you send AS2 messages to a server. If both client and server are configured correctly a successful message exchange should be easily possible.

My personal Coding Styleguide | On Twitter: @philiphelger