Skip to content

Submodule as2‐lib

Philip Helger edited this page Feb 7, 2020 · 3 revisions

Package structure

This library manages the package com.helger.as2lib and all sub-packages:

  • com.helger.as2lib - contains the global AS2 settings
  • com.helger.as2lib.cert - contains the certificate factory
  • com.helger.as2lib.client - contains the AS2 client for sending messages
  • com.helger.as2lib.crypto - contains the BouncyCastle crypto code for signing, verification, encryption and decryption of messages
  • com.helger.as2lib.disposition - contains code to handle content disposition
  • com.helger.as2lib.exception - contains basic exception classes
  • com.helger.as2lib.message - contains the main message and MDN classes
  • com.helger.as2lib.params - generic code that allows for parameterization of certain message related configuration items
  • com.helger.as2lib.partner - contains the partnership and factory code
  • com.helger.as2lib.partner.xml - contains the XML based version of a partnership factory
  • com.helger.as2lib.processor - contains the basic building blocks for processing of messages
  • com.helger.as2lib.processor.module - contains the basic classes for "active" modules (modules that can be started and stopped)
  • com.helger.as2lib.processor.receiver - module for receiving messages
  • com.helger.as2lib.processor.receiver.net - module for receiving messages from Sockets
  • com.helger.as2lib.processor.resender - modules for re-sending messages
  • com.helger.as2lib.processor.sender - module for sending messages
  • com.helger.as2lib.processor.storage - module for storing messages
  • com.helger.as2lib.util - contains utility classes used in several places in this library or in derived projects
  • com.helger.as2lib.util.cert - utility classes for certificate handling
  • com.helger.as2lib.util.http - utility classes for HTTP connection handling
  • com.helger.as2lib.util.javamail - utility classes for javax.mail handling

AS2 client

as2-lib ships with a powerful client to send AS2 messages. It can easily be embedded in standalone Java applications and does not require any server part. All the necessary classes are in the package com.helger.as2lib.client.

For a quick start look at https://github.com/phax/as2-lib/blob/master/as2-lib/src/test/java/com/helger/as2lib/supplementary/main/MainSendToMendelsonTestServer.java as a working example on how to send an arbitrary file to the Mendelson test server.

The client basically separates between per-partnership settings (class AS2ClientSettings) and the content to be transmitted (class AS2ClientRequest). The glue that holds all of this together is the class AS2Client that takes the settings and the request, adds the possibility to define an HTTP(S) proxy server, and does the synchronous sending. The settings and the main client are thought to be reusable, whereas the request data is to be changed for every request.

The response of a client request is defined by class AS2ClientResponse. It stores the original message ID, the received MDN/the occurred exception and the execution duration. The interpretation of the received MDN is up to the user.

Clone this wiki locally