javaspringservletsactionscript-2

AS2 receive Java


First....I must confess I know very little about AS2 as only became aware of its existence today!. However, I need to create a Java web application which can accept a data transfer via AS2.

Typically I use Spring Boot for web applications, but can see no major vendors (Spring / Apache) with a AS2 library to utilise, however I did find this...https://jmaven.com/dependency/com.helger.as2/as2-server

Does anyone know of any other libraries, tutorials or sample code for creating a service to listen for AS2 requests or any failing that some good further reading on AS2? Can I create an AS2 listening endpoint without using com.helger.as2 libraries and just use standard apache/spring libraries? It has to be AS2 rather than AS4 due to old implementations being used by the company I'm working for.

Many thanks


Solution

  • As2 is an http protocol, so basically you have to write an api controller that accepts POST requests. That's the easy part, the fun part is that you have to verify the signature, decrypt and eventually send an MDN as response. I made an implementation in C# and the only example I found was this: https://mattfrear.com/2011/01/03/receiving-as2-messages-with-net/. You should try read it. You have to use these classes from BouncyCastle: CmsEnvelopedData class to decrypt and CmsSignedData to sign. If you don't want to read a bunch of RFC's about AS2, I can give you more info.