phax / as2-lib

A generic Java AS2 library, servlet and server
107 stars 43 forks source link

"Invalid HTTP Request" Error with Servlet-based Demo-Web-App #131

Closed vansh-flexe closed 2 years ago

vansh-flexe commented 2 years ago

I keep receiving the following error for the demo-web-app running on tomcat -

[http-nio-8080-exec-7] INFO com.helger.as2lib.exception.AS2Exception - as2-lib 4.9.0-SNAPSHOT IOException terminated: Failed to read Servlet Request: Invalid HTTP Request (0€ *†H†÷)
[http-nio-8080-exec-7] ERROR com.helger.as2servlet.AbstractAS2ReceiveBaseXServletHandler - Not having a data source to operate on

Both setups - Tomcat and Google App Engine - return the same error. I tried using both clients, the Mendelson client and Main Test Client.

For the most part, I focussed on comparing the behavior of the demo app with that of the socket-based OpenAS2 server. While requests to the OpenAS2 server succeed, the requests to the demo app fail at the following line because the Http Servlet Input Stream is empty.

FileName - src/main/java/com/helger/as2servlet/AbstractAS2ReceiveBaseXServletHandler.java

        final IHTTPIncomingDumper aIncomingDumper = getEffectiveHttpIncomingDumper ();
        aMsgDataSource = HTTPHelper.readAndDecodeHttpRequest (new AS2InputStreamProviderServletRequest (aRequestIS),
                                                              aResponseHandler,
                                                              aMsg,
                                                              aIncomingDumper);

I am running the latest snapshot of as2-lib - 4.9.0 - SNAPSHOT.

I also tried sending unencrypted requests with POSTMAN and they failed with the same error, at the same line, which made me think this is not related to certs.

Is this expected?

vansh-flexe commented 2 years ago

@phax Found an unrelated issue with using MyHandlerModule with OpenAS2Server whereby initialization fails since MyHandlerModule is missing a default constructor.

However, still stuck on setting up the servlet to receive requests and successfully process requests. Would appreciate any help.

phax commented 2 years ago

Yes I know - sorry I am currently swamped :/ Will respond asap.

kem-flexe commented 2 years ago

Is there any update to this? I am seeing the same thing. It looks like version 4.8.0 there is some issue with the library trying to read from the inputstream. All my attempts at sending a request result in the above error message. Downgrading to 4.7.1 seems to resolve the issue. Ideally I would like to use the latest version. I am using spring boot to load the servlet.

phax commented 2 years ago

Point taken - I see the issue. Will deploy a 4.9.0 SNAPSHOT version later for testing

phax commented 2 years ago

@kem-flexe , @vansh-flexe a first 4.9.0-SNAPSHOT version is available. Can you please check that locally before I release. My tests were positive

kem-flexe commented 2 years ago

Looks like it's working fine now. I installed it locally and was able to see it work. Thank you :)

phax commented 2 years ago

Thanks for the confirmation. Than I will do the 4.9.0 release immediately.

phax commented 2 years ago

Release 4.9.0 is out the door https://github.com/phax/as2-lib/releases/tag/as2-lib-parent-pom-4.9.0 and soon at Maven Central