Comments (15)
it works now, many thanks
@Bean
public ServletRegistrationBean AS2ReceiveServlet(ServletContext servletContext) {
WebScopeManager.onGlobalBegin(servletContext);
ServletRegistrationBean register = new ServletRegistrationBean(new AS2ReceiveServlet(), "/as2");
register.addInitParameter("as2-servlet-config-filename", "config/config.xml");
return register;
}
from as2-lib.
WHen I removed it from the servlet, it again gave me an error of no global scope. I ended up keeping it in my servlet and defining my own listener which doesnt define a global scope and that worked.
from as2-lib.
Version 2.2.8 was a long time ago :)
You are right, there are no explicit APIs for this.
This was a fix #20 where you are allowed to overload some stuff in the AbstractHttpSenderModule
(namely createSSLContext ()
and createHostnameVerifier ()
). That ,means you can create a sublcass of AS2SenderModule
where you overload these methods, and than invoke as2Client.setAS2SenderModuleFactory (MyAS2SenderModule::new);
to set the new factory.
hth
from as2-lib.
@phax thanks, what's more, may I ask how to add https(ssl_protocol, ssl_keystore, ssl_keystore_password) on AS2ReceiverModule
from as2-lib.
I don't fully understand your request.
You need a server-like component to request something - e.g. the standalone as2-server or an application server based solution using e.g. as2-servlet. The configuration on how to receive something via https depends on what you are using to receive something.
With the AS2Client directly, you can only get synchronous MDNs back. Asnychronous MDNs must be handled externally and cannot be dealt with by AS2Client.
hth
from as2-lib.
@phax yes, I configure AS2ReceiverModule in standalone as2-server which can successfully handle as2(http) request. For https, I add these attributes(ssl_protocol, ssl_keystore, ssl_keystore_password) on AS2ReceiverModule but it does not works with as2(https)
from as2-lib.
I must admit I have no idea.
I'm using https only on Tomcat, by adding an httpd in front, to perform the SSL handshake. I have no experience on how to perform this "standalone" :(
Closed by accident
from as2-lib.
@phax I enable https service by using tomcat embed in spring-boot. But now I have trouble reusing AS2ReceiverHandler since it use socket io(I can retrieve ServletRequest and ServletResponse from sprint-boot controller). Could you please adivse, thanks
from as2-lib.
Well okay, here are some questions:
a) are you using as2-servlet
or are you using the as2-server
?
b) Did you have a look at how this can be configured in Tomcat: (e.g. https://tomcat.apache.org/tomcat-7.0-doc/ssl-howto.html for Tomcat 7)?
from as2-lib.
I use as2-server at the beginning, find it was using socket io. Shall I turn to as2-servlet?
Because I am using spring-boot, which contain a tomcat server inside and simplify the configuration, I follow this configuration to enable https (step2 https://drissamri.be/blog/java/enable-https-in-spring-boot ), it looks like
server.port=8443
server.ssl.key-store=keystore/client-certs.p12
server.ssl.key-store-password=mypassword
server.ssl.keyStoreType=PKCS12
server.ssl.keyAlias=fwks
from as2-lib.
Yes, please switch to the as2-servlet. Spring boot obviously embedds Tomcat, and Tomcat can (to my knowledge) only handle Servlets.
If you can provide a wrapper around the as2-demo-webapp I'm also happy to publish it here....
from as2-lib.
I turn to as2-servlet now, and regist AS2ReceiveServlet into spring-boot in this way
@Configuration
public class ServletConfiguration {
@Bean
public ServletRegistrationBean AS2ReceiveServlet() {
ServletRegistrationBean register = new ServletRegistrationBean(new AS2ReceiveServlet(), "/as2");
register.addInitParameter("as2-servlet-config-filename", "config/config.xml");
return register;
}
}
However it fail to initialze this servlet, and throw the following exception
......
Caused by: java.lang.IllegalStateException: No global scope object has been set!
at com.helger.scope.mgr.ScopeManager.getGlobalScope(ScopeManager.java:158)
at com.helger.scope.singleton.AbstractGlobalSingleton._getStaticScope(AbstractGlobalSingleton.java:48)
at com.helger.scope.singleton.AbstractGlobalSingleton.getGlobalSingleton(AbstractGlobalSingleton.java:65)
at com.helger.xservlet.servletstatus.ServletStatusManager.getInstance(ServletStatusManager.java:67)
at com.helger.xservlet.AbstractXServlet.<init>(AbstractXServlet.java:182)
at com.helger.as2servlet.AS2ReceiveServlet.<init>(AS2ReceiveServlet.java:32)
Could you please advise
from as2-lib.
You need an additional bean that requires the ServletContext.
Upon creation, you need to call:
WebScopeManager.onGlobalBegin (ServletContext);
and for shutdown you need to invoke:
WebScopeManager.onGlobalEnd ();
hth
from as2-lib.
I did this but when I register the AS2WebAppListener, it also tries to set the global scope and throws an exception that global scope has already been set
from as2-lib.
@kalkrishnan This is preferrably used in the WebAppListener - remove it from the servlet than
from as2-lib.
Related Issues (20)
- Performance issues in AS2 servlet when transferring files HOT 2
- unable to send file to AS2 server from AS2-LIB HOT 5
- getting started HOT 9
- Can AS2DirectoryPollingModule run with as2-lib-spring-demo HOT 7
- Disposition isn't correct when using servlet HOT 14
- "Invalid HTTP Request" Error with Servlet-based Demo-Web-App HOT 8
- java.lang.IllegalStateException: unable to create shared stream: java.io.FileNotFoundException: /tmp/as2-lib-res-16551011638687829143.tmp (No such file or directory) HOT 7
- Spring boot: possible to make custom handler a spring managed bean? HOT 3
- partnership attribute: remove_cms_algorithm_protection_attrib HOT 2
- Error receiving from chunked transfer encoding HOT 11
- MIC calculation on outgoing AS2 is incorrect when using compress before signing HOT 9
- Question : Does AS2 includes standard HTTP headers and custom generated headers for communication between 2 systems interacting using AS2 protocol. HOT 1
- Cant' send files to distant client using "MainSendToMendelsonTestServer.java" HOT 2
- Trying to use RSASSA_PKCS1_V1_5_WITH_SHA3_256 signing alg results in IllegalArgumentException: Unknown signature type requested: RSASSAPSS HOT 13
- latest certificates from keystore is not fetching when service is running HOT 2
- Advice on creating documentation HOT 7
- Can't work with AS2 version 5.0 with bc-fips HOT 4
- NoClassDefFoundError: javax/mail/internet/MimeBodyPart HOT 2
- Private Key is Null for public key HOT 4
- bcMail temporary files not deleted when compression is used (as2-lib 5.1.2)
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from as2-lib.