Enterprise Integration Zone is brought to you in partnership with:

I am working as a Senior Architect having 13+ experience in IT Industry with core competencies in Web-oriented Solutions/Architecture (Primarily: Java/J2EE, RDBMS) with experience in architecture, design, development and deployment on heterogeneous platforms (Sun Solaris/Ultrasparc, Linux/Unix, Intel/AMD x86) and Application Servers (Websphere, WebLogic, JBOSS, Tomcat, Terracotta). Also, having diverse experience in numerous JEE Web Frameworks (Struts, Spring, Wicket, JSF, Custom frameworks), open-source technologies (based on multiple languages like PHP, Scala, .NET) and COTS (Commercial off-the-shelf) solutions (e.g. CA SiteMinder, Wily Introscope, Websphere DynaCache, WebLogic Portal). Ankur is a DZone MVB and is not an employee of DZone and has posted 7 posts at DZone. You can read more from them at their website. View Full User Profile

Apache CXF vs. Apache AXIS vs. Spring WS

05.08.2013
| 41580 views |
  • submit to reddit
This blog does not try to compare all available Web Services Development Frameworks but focuses only on three popular approaches regarding three Open Source frameworks: Apache CXF, Apache AXIS & Spring WS.

Let's look at positives & concerns in nutshell of each of these frameworks:

Framework
Key Positives
Key Concerns
Apache AXIS2
❶ Most Commonly Used, Matured & Stable Web Services Development Framework

❷ Supports Multiple Languages (C++, Java)

❸ Supports both Contract-first & Contract-last Approach

❹ In context of Orchestration & Web Services Transaction (long-running transactions) it supports wide variety of related WS-* specifications:
WS-Atomic Transaction, WS-Business Activity, WS-Coordination, WS-Eventing, WS-Transfer
Compatible with Spring Framework
❶ Comparatively More Code Required/Generated w.r.t. Spring WS/CXF

❷ Is being phased out gradually (mostly by Apache CXF)

❸ It is not fully compliant for JAX-WS JAX-RS
Apache CXF
❶ Most widely used Web Services Standard Now; Improvement over AXIS2, which is now gradually being replaced by Apache CXF

❷ Intuitive & Easy to Use (less coding required as compared to AXIS2)

❸ Clean separation of front-ends, like JAX-WS, from the core code

❹ Fully compliant with JAX-WS, JAX-RS & others

❺ Best Performance across all available framework with minimum computation overhead

❻ Supports wide variety of front-end models

❼ Supports both JAX-WS & JAX-RS (for Restful Services)

❽ Supports JBI & SDO (not supported in AXIS2)

❾ Compatible with Spring Framework
❶ Does not support Orchestration & WS Transactions yet

❷ Does not support WSDL 2.0 yet
Spring WS
❶ Best in terms of supporting Contract-first Web Services Development Approach

❷ Enforces Standards & Best Practices by Framework Constraints (no way out of it & hence limitation as well)

❸ Supports Spring Annotations as well as JAX-WS

❹ Least code from developer’s perspective

❺ Best Aligned with Spring Technology Stack (also similar architectural stack as Spring MVC) including Spring Security
❶ Least number of WS-* Specifications supported (does not fully compliant with JAX-WS)

❷ Spring offers itself as standard & hence other Java-compliant frameworks support better standards support

❸ Only support Contract-first Web Services Development Model


I have carried out further detailed analysis (using a scorecard) to grill these frameworks further & came up with following scorecard:



 

Conclusion


  • Apache AXIS2 is relatively most used framework but Apache CXF scores over other Web Services Framework comparatively considering ease of development, current industry trend, performance, overall scorecard and other features (unless there is Web Services Orchestration support is explicitly needed, which is not required here)
  • Though Spring Core Framework is an established technology, Spring Web Services is still evolving in comparison with Apache CXF and CXF has wider support of standards and proven framework from performance perspective.
  • Hence, Apache CXF is the recommended framework and clearly the most preferred in my opinion.

Disclaimer:
All data and information provided on this site is for informational purposes only. This site makes no representations as to accuracy, completeness, correctness, suitability, or validity of any information on this site and will not be liable for any errors, omissions, or delays in this information or any losses, injuries, or damages arising from its display or use. All information is provided on an as-is basis.This is a personal weblog. The opinions expressed here represent my own and not those of my employer or any other organization.
Published at DZone with permission of Ankur Kumar, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Maa Zzzza replied on Wed, 2013/05/08 - 7:46am

Try to use the CXF with big players server from IBM or Oracle there is always some problem with configuration. Spring WS is working like a charm.

Kevin Walker replied on Wed, 2013/05/08 - 10:02am

I second that, I have used CXF for very high volume web services without a problem. It was fairly easy to develop and come up with solutions to handle real world issues like time outs, deployment was on JBoss 5.x

David Karr replied on Wed, 2013/05/08 - 10:34am

Concerning the main article: If you're covering both JAX-WS and JAX-RS here, note that Spring WS does not support JAX-RS. Spring MVC can be used to build REST services, but that also does not support JAX-RS.

To the comment about "problems with configuration with IBM or Oracle", that is likely an issue with the JAX-WS implementation. I've deployed two CXF JAX-RS services to production on Oracle WebLogic, with zero hassles.

Ankur Kumar replied on Thu, 2013/05/09 - 3:14am in response to: Maa Zzzza

Agree with nature of Spring WS regards to its ease of integration & development. That's why it has been scored well in specific area. Also, note that Scorecard can be customized as per need (for example, if you give more importance to Governance & Vendor Alignment, then weight of it can be increased and scorecard will change)

Ankur Kumar replied on Thu, 2013/05/09 - 3:15am in response to: David Karr

Thanks for highlighting JAX-RS support.

Brock Mills replied on Fri, 2013/05/10 - 1:03am

Hi Ankur,

Good article, however what about comparing Jersey alongside Apache CXF? 

Also I think there's definitely an aspect of what kind of services you are developing that drives the choice of framework. Ie if I am not using SOAP then my decision becomes "which JAX-RS implementation should I use"?

Cheers


Brock


Murali Krishnan replied on Wed, 2013/05/15 - 10:05am

Nice article and agree with the conclusion about Apache CXF. Having worked on and used Axis2 and CXF heavily I personally think that CXF outshines Axis2 in almost every area. Axis 1 for JAX-RPC was great, but 2.x code base is a mess in many areas... CXF integration with Spring and Jetty is a big plus. The JAX-RS support is excellent as well... (though Jersey still is the best REST-only framework by a distance). Some of the terminologies that CXF uses (like Conduit, Exchange, Invoker etc) can be a bit confusing initially however, for the uninitiated.

<Begin shameless plug>: CXF is also the WS engine of choice for our Web Services Testing tool called Examine (http://www.stratumsoft.com/examine-features ). If you work with Web Services (SOAP or REST), do check it out... It comes with various functionalities like mocking SOAP, REST services, SOAP, REST client, useful XML tools etc. Many of these features make use of CXF internally. <end plug>

Regards
Murali

Ankur Kumar replied on Thu, 2013/05/16 - 2:13am in response to: Murali Krishnan

Thanks for your insightful inputs. We are already using Service Virtualization software to mock Web Services.

Navaneeth Gowribalan replied on Tue, 2013/11/12 - 3:57pm in response to: Ankur Kumar

 Hi Ankur,

Very nice article, but i am facing issues while deploying CXF base restful services into oracle weblogic server. The error i am getting is "The ResourceConfig instance does not contain any root resource classes".

I deployed as a war application, that contents only service definitions. it runs fine (other could use the service when its deployed in tomcat, but getting "The ResourceConfig instance does not contain any root resource classes" error when deploying to oracle weblogic server. I tried all the options (creating a ear and specifying prefer-application-packages option in weblogic-application.xml etc). Please let me know there is anyother configuration i need to do to get rid of the error.

Error Stacktrace:

<Nov 12, 2013 3:21:20 PM EST> <Error> <com.sun.jersey.server.impl.application.RootResourceUriRules> <BEA-000000> <The ResourceConfig instance does not contain any root resource classes.>
<Nov 12, 2013 3:21:20 PM EST> <Error> <com.sun.jersey.spi.inject.Errors> <BEA-000000> <The following errors and warnings have been detected with resource and/or provider classes:
  SEVERE: Missing dependency for field: private org.apache.cxf.jaxrs.ext.MessageContext org.apache.cxf.jaxrs.provider.SourceProvider.context
  SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.json.JSONProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 1
  SEVERE: Missing dependency for field: private org.apache.cxf.jaxrs.ext.MessageContext org.apache.cxf.jaxrs.provider.FormEncodingProvider.mc
  SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.JAXBElementProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 14
  SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.RequestDispatcherProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 1
  SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.JAXBElementProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 1
  SEVERE: Missing dependency for field: private org.apache.cxf.jaxrs.ext.MessageContext org.apache.cxf.jaxrs.provider.MultipartProvider.mc
  SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.AbstractCachingMessageProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 3
  SEVERE: Missing dependency for method public void org.apache.cxf.jaxrs.provider.AbstractCachingMessageProvider.setMessageContext(org.apache.cxf.jaxrs.ext.MessageContext) at parameter at index 3>
<Nov 12, 2013 3:21:20 PM EST> <Error> <HTTP> <BEA-101216> <Servlet: "Jersey" failed to preload on startup in Web application: "AllyIWClaimServiceImpl".
com.sun.jersey.api.container.ContainerException: The ResourceConfig instance does not contain any root resource classes.
   at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:99)
   at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1331)
   at com.sun.jersey.server.impl.application.WebApplicationImpl.access$700(WebApplicationImpl.java:168)
   at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:774)
   at com.sun.jersey.server.impl.application.WebApplicationImpl$13.f(WebApplicationImpl.java:770)
   Truncated. see log file for complete stacktrace
>

Saurabh Chhajed replied on Mon, 2014/05/26 - 5:22am

Hello Ankur,

Nice Article!! This proved to be a good help for us while choosing between these technologies.Few points we observed -

  • Apache CXF was performing comparitively slower as compared to Axis2 and Spring WS for a sample implementation of one of our webservices.
  • Spring WS always woked like charm, it was quick to setup, and quite fast as compared to other two.
  • Good thing about Spring WS was it helped us eliminate the need to generate WSDL bound stubs for Service Interface using xjc utility which just required to generate stubs for Elements.
Thanks,Saurabh


Ankur Kumar replied on Mon, 2014/05/26 - 7:20am in response to: Saurabh Chhajed

Thanks for your comments. We chose AXIS2 after due diligence within internal architect's community. 

Nishant Raka replied on Thu, 2014/06/12 - 1:17am

We were developing SOAP web services using AXIS2, now want to move to CXF as now we will be developing REST webservices.

Does anyone have steps of changing the AXIS 2 with CXF, tasks to be done to accomplish this.

Thanks in advance

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.