Skip to content

Submodule as2‐demo spring boot

Philip Helger edited this page Feb 23, 2023 · 5 revisions

This is a stub project that just shows how integration of as2-lib with Spring Boot could work. It doesn't do anything real.

Run the project with Maven:

mvn spring-boot:run

If everything went smooth, the application is reachable locally at http://localhost:8081

Elements

  • The class As2SandboxApplication contains the main Spring Boot application.
    • By implementing the ServletContextListener interface it allows for a clean shutdown via the method contextDestroyed. It is suggested you take this over in your application
  • The main AS2 logic happens in class ServletConfig
    • The constant AS2ServletXMLSession contains the AS2 configuration to be used
      • The content of this session is read from the file config/config.xml
      • This configuration file contains the certificate references, the partnership references and the processors to be used. See the sub page for details
      • This session is initialized once globally. If your AS2 settings are more dynamic, you need to adopt your approach
      • The AS2 session is NOT to be confused with an HTTP session - it's something completely different
    • The class registers a Servlet at path /as2 that is able to receive the main AS2 messages
      • It will take the configuration from the above mentioned AS2 session
      • When receiving a message, it will call the Java modules (not Java 11 modules - just AS2 handler modules) defined in the configuration file
      • This Servlet and the respective handler class need to be used in your application
    • The class also registers a second Servlet at path /as2mdn that is able to receive asynchronous AS2 MDNs
      • If your scenario only uses synchronous MDNs you don't need that servlet
Clone this wiki locally