WebSphere 6.1 web service client using SSL

It’s hard to develop web services using native WebSphere 6.1 support without the aid of IBM developing tools such as Application Server Toolkit or Rational Application Developer. Even it’s hard to find, download and install these tools.

IBM provides a bunch of detailed information and manuals on every product, but this fact does not guarantee sometimes an easy way to desired solution.

How to invoke a web service using SSL? The response to this question can be found on many places: IBM Redbooks,  some articles from IBM,  official product documentation… And all of them base the solution on the use of Rational Application Developer to modify XML web service descriptor ibm-webservicesclient-bnd.xmi. This should be fine, if Rational Application Developer were a free tool.

To avoid the use of this product, XML manual modification it’s also possible according to this information. Just only including a reference to a WebSphere Application Server SSL Configuration makes the work:

I’ve never understand IBM’s vision, in my opinion information must be sufficient but not extensive.

ThreadLocal considerations. Use in WebSphere 6 and Weblogic 10.

ThreadLocal class enables the sharing of a variable in a statically way across a whole Java process by attaching this variable to a single Thread (p.e. Thread.currentThread()). This is specially useful to make accesible values recovered in filter layer to the other ones.

Think about database logging of HTTP requests or responses. Note that this is the unique point to retrieve, for instance, complete signed requests or responses. All this process (request and response) is executed on a single thread, so ThreadLocal mechanism can be used to share the request content with the DAO layer. By doing a threadLocal.set(request) on Filter class and a threadLocal.get() on DAO class the described functionality is achieved.

And here is where different behaviours arrive. WebSphere 6 doesn’t clean servlet pooled threads after execution while Weblogic 10 does. So, ThreadLocal variable must be cleared in WebSphere for every new request!

Typically is discouraged the use of this tecnique in managed environments, but in many cases the best should be the simpliest.

Reference – IBM – Threading lightly.