Technologies, methods and tools

Exposing a web service via https with JBoss FUSE

Have you ever tried to expose a JAX-WS web service via https in JBoss FUSE? Well I tried to do that recently and ran into issues. I hope this post may help you on that task.

You could start by simply stating https in the address of you jaxws:endpoint:<jaxws:endpoint implementor="com.acme.services.MyServiceImpl"
address="https://127.0.0.1:8443/services/MyService"/>

You would the also have to configure SSL for port 8443 via httpj:engine-factory. The problem is that if you work with OSGI blueprints the documentation for that is not optimal and I feel uncomfortable to figure out a security relevant configuration by try and error.

So what I did instead is that I exposed my web service via http on localhost and put a proxy in front of it. A proxy decouples your SSL encryption from your main application. That is in general a good idea because security stuff usually has it’s own life cycle which can be quite quick. The proxy is set up through a Camel route featuring Jetty. The documentation on this approach is also far better.

Let’s have a look at my blueprint.xml. Note: You should put your proxy in a different module than your web service to get the “decoupling” advantage. This example has it in one module just for easier reading.

It starts with our jaxws:endpoint on localhost:8081. The camel context thereafter features the proxy configuration and last but not least there are the sslContextParameters with configuration for SSL. You could also configure ciphers and other more advanced stuff within the sslContextParameters.

The camel route is pretty simple: Take requests from https://0.0.0.0:8443/services/MyService and forward them to our internal web service on localhost:8081. Please note that the URI parameters as explained in the XML comments are quite important. For production some additional tuning parameters could be necessary, but for a basic working example that’s it. You may have a look at the camel-jetty documentation for additional parameters.

I hope this post may help you. If you’ve got further ideas or questions feel free to post a comment or send me an email to immanuel.sims |a| akquinet.de