Comparing Spring webservices and CXF

Spring web services at a glance -

Spring web services is focused on creating contract-first document oriented web services. Spring web services, being a product of Spring, offer first class support of using Spring configurations and integrating with Spring framework.

Spring promotes contract-first development completely and provides an ability to plug-in various XML APIs (SAX, DOM, STAXM, XOM, JDOM..) to handle XML messages. Using Spring web services, you can always ensure the XML contract (xml schemas) is marshaled correctly into Java objects. Spring web services support JAXB 1 and 2, Castor, XMLBeans, JiBX, and XStream as part of its XML Marshalling support.

Spring web-service provides options to secure web services using Acegi security and provides ability to encrypt/decrypt messages and support for webservices security standards.

CXF at a glance –

Apache CXF is an open source web service framework that provides an easy to use, standard-based programming model for developing web services. Web services can be implemented using different application protocols like SOAP, XML, JSON, RESTful HTTP, and support various transport protocols like HTTP or JMS (JavaMessage Service).

CXF supports both code-first and contract first development and provides first class support for using Spring configuration.  CXF supports all of the widely used web service specifications.

To get started with CXF, you can download a complementary chapter and index of Apache CFX Web Service Development book.

Sample Apache CXF Web Service Book Chapter

Which one should I use ?

The choice of selecting a web services stack depends on multiple factors like standards compliance, ease of development , deployment options, unit testing options, integration with leading frameworks like Spring, flexibility and extensibility and so on.

In my view, the strict enforcement on using contract first development only with spring web services can become a bottle neck, depending on your requirements.

There might be scenarios where you would want to use code-first development and can easily generate contracts (xml schemas) that way you intended. If you are aware of how Java objects are generated to XML and limitations associated with it, this would also help you to generate the right XML format.

CXF provides support for code first and contract first development, and provides ability to plug-in various flexible binding mechanisms. Leaving the choice of code-first and contract first development to a user based on their requirements is a big plus.  Using CXF, you could achieve what Spring web services offer today, although it doesn’t support the numerous XML API options and binding support offered by Spring web-services, but it should suffice for most of the requirements.


Banner

Image of Apache CXF Web Service Development

<a href=”http://www.amazon.com/gp/product/B0015T963C?ie=UTF8&tag=sw0fd-20&linkCode=as2&camp=1789&creative=9325&creativeASIN=B0015T963C”><img border=”0″ src=”41t7SWZ2vpL._SL160_.jpg”></a><img src=”http://www.assoc-amazon.com/e/ir?t=sw0fd-20&l=as2&o=1&a=B0015T963C” width=”1″ height=”1″ border=”0″ alt=”" style=”border:none !important; margin:0px !important;” />

Did you enjoy this post? Why not leave a comment below and continue the conversation, or subscribe to my feed and get articles like this delivered automatically to your feed reader.

Comments

No comments yet.

Leave a comment