Saturday, July 17, 2010

Considering Apache CXF ...

Recently, I completed my engagement with the CollectionSpace project and joined a small company in the south bay. Here I am again where we have to choose a web service framework to implement RESTful web services.

In CollectionSpace, we had selected JBoss's RESTEasy. One reason for that was that our deployment environment included JBoss due to the requirements driven by a major 3rd party software we had to use. I liked the simplicity of RESTEasy and also its quality. There were enough plugins to extend the framework. The proxy based client-side library was very useful in writing service consumers for testing purposes. Bill Burke and I had worked on a project more than 14 years ago. He then went JBoss route and I had joined BEA. Anyway, it was good to catch up with him. It was easy to rely on his work.

However, unlike CollectionSpace, here, there are legacy SOAP-based web services used for B2B transactions. These services are implemented using Metro - SUN's RI for JAX-WS. Metro does not support JAX-RS. For that, one would have to use Jersey. These are two different web service frameworks.

I have been investigating if Apache CXF could be used. Here is my impressions so far...will keep you posted. The following is not necessarily a comparison. These are just my notes with some perspective on using a web service framework.
  1. CXF supports both JAX-WS and JAX-RS. Same stack.
  2. It is also possible to use the same service implementation to support for JAX-WS and JAX-RS annotations. Don't know about complexities till I play with such an implementation
  3. Spring integration. This is something I missed in RESTEasy. It is good to describe the meta data for a service outside of Java code.
  4. CXF's advanced search capabilities looks really interesting. It has built-in support for FIQL. I look forward to using it. It'd be interesting to figuring out if SearchCondition could be represented as a resource to which access could be controlled.
  5. There is a nice built-in support for sub-resource locators. Not very difficult to do without it but nice to have it in a framework.
  6. Schema validation could be at service or at provider levels...again configurable with Spring beans.
  7. CXF supports 3 types of clients : Proxy-based, HTTP-centric and XML-centric. Many times, it is good to have these choices as Proxy-based clients and JAXB could hide some real scenarios. e.g. using JAXB on the client does not require one to b64 encode content if proper XML type is used.
  8. It is possible to configure implementation as singleton or prototype

Overall, these look promising to consider CXF. We will know more when we actually start using it.