-
1. Re: Outbound connection from JBoss AS
fabrizio.benedetti Oct 5, 2012 6:45 AM (in response to gvseghbr)1 of 1 people found this helpfulYou can use Apache HttpComponents from within the EJB, or use Jboss Resteasy client.
For the certificate you have to use a java keystore and set SSL system properties in jboss start script.
Ex.: -Djavax.net.ssl.keyStore=/path/to/keystore.jks -Djavax.net.ssl.trustStore=/path/to/truststore.jks -Djavax.net.ssl.keyStorePassword=password -Djavax.net.ssl.keyStoreAlias=alias
Regards
/F
-
2. Re: Outbound connection from JBoss AS
gvseghbr Oct 5, 2012 7:29 AM (in response to fabrizio.benedetti)Hi Fabrizio,
First of all, thank you for the response.
However, I was hoping there would be a more "managed" solution to this. What I had hoped for, was to be able to use JBoss’ security realms for the SSL and something similar to invoking remote EJBs.
In the option that you propose, I have to manage the ConnectionManager and all connections myself.
Kind Regards,
Gregory
-
3. Re: Outbound connection from JBoss AS
j4m3s Oct 5, 2012 8:05 AM (in response to gvseghbr)I use the REST-Easy client from within JBoss to consume external REST services. It's built on top of Apache Http client so you can use a variety of options including setting headers etc. I haven't used it with SSL but looking at this StackOverflow question it looks easy enough: http://stackoverflow.com/questions/12369495/accepting-a-self-signed-certificate-in-java
-
4. Re: Outbound connection from JBoss AS
fabrizio.benedetti Oct 5, 2012 8:15 AM (in response to j4m3s)James Fellows ha scritto:
I use the REST-Easy client from within JBoss to consume external REST services. It's built on top of Apache Http client so you can use a variety of options including setting headers etc. I haven't used it with SSL but looking at this StackOverflow question it looks easy enough: http://stackoverflow.com/questions/12369495/accepting-a-self-signed-certificate-in-java
I also would use REST-Easy client.
Only a precision. In StackOverflow question they talk about SSL configuration server side. From EJB perspective, it needs only SSL client side. It is sufficient to set the system properties as I said and automatically REST-Easy/Apache HttpClient inherits them.
Regards
/F
-
5. Re: Outbound connection from JBoss AS
j4m3s Oct 5, 2012 8:51 AM (in response to fabrizio.benedetti)You need to check out the apache http4 docs to see what params you need to set. I shouldn't have included that StackOverflow link - it's not very helpful, sorry.
To configure the apache HTTP4 executor that underpins a RESTeasy request you pass in an ApacheHttpClient4Executor instance as the third parameter into the RESTEasy ProxyFactory.create() method.