Difference between JAX-WS, Axis2 and CXF - java

What is the difference between:
JAX-WS
Axis2
CXF
All three can be used to create webservices in Java.
As of I know JAX-WS is a specification and Axis2 and CXF are implementations, but Java 1.6 has implementation of JAX-WS if I am not wrong.
So one can use Java 1.6 to develop JAX-WS web services without using Axis2 or CXF? Then what is the use of Axis2, CXF?

The JAX-WS implementation built into the JDK really is just the basic soap stuff. If you need any of the more complex WS-* things like WS-Security, WS-RM, WS-Policy, etc..., you need to use one of the alternatives like CXF or Metro or Axis2. It can also depend on what you are trying to integrate with. For example, CXF has top notch Spring support as well as very good OSGi support.
CXF also has other things besides just JAX-WS. It has a compliant JAX-RS implementation as well and supports exposing services as both REST and SOAP very well. Has a W3C compliant SOAP/JMS implementation if that type of things is required. Basically, lots of stuff not available from the in-jdk JAX-WS impl.
Also see:
Difference between Apache CXF and Axis

In short.
WSDL WS-* are language-agnostic.
JAX-WS are Java standard to build web service.
Apache CXF and Apache Axis 2 are two implementations of JAX-WS. They also offer JAX-RS implementations so that you can build Restful services.
CXF has better integration with Spring, and Camel(camel-cxf). And Axis 2 seems not have a active release.

I found with CXF - integration with Spring is very easy. Moreover, It provides various features like:
Customization of Logging features
Inbound and Outbound interceptor
Application Level security
Easy Exception handling using custom Fault.
For more detail, if you want, please checkout this link:
http://predic8.com/axis2-cxf-jax-ws-comparison.htm
http://www.ibm.com/developerworks/java/library/j-jws11/
And, I read above links, its preety helpful for me. I hope it works for u too.
Thanks !

Web Service organization reles some guidelines i.e BP(Basic Profile) 1.0 and BP(Basic Profile) 1.1.
Base on the Guidelines All Language(Java/.Net) people release Specification with Default implementation
In java Base on BP 1.0 Specification Is JAX-RPC And 1.0 Specification Is JAX-WS
JAX-WS Default implementation is RI(Reference Implementation)
Base on the requirement/Choice we can change the implementation(RI/AXIS-2/CXF)
When we are using java 1.6 that case in JDK already available so not required any other jar. If you want to use different implementation that case required particular implememtation jar.
Axis-2 and CXF come from Apache

Related

How to call a JSON Rest web service with Tomee 1.6

My application is running on a Tomee plus 1.6 JEE server.
I need to call a RS WS that will return an object formatted as a JSon string.
I can do that with an openConnection("url"), and a manual parsing of the response. But I think there is a much higher way to do that in a JEE environment.
The problem is that I found many tutorials about how to write a Restful WS, but very few about how to invoke them. Moreover, eachtime, there are several libraries to add to the Tomee server (Jackson, ...).
My questions are :
is there any standard way to invoque a WS with no library to add ? I think there must be one because Tomee plus is supposed to be a full JEE server.
how to do that ?
Thanks for your help.
If you are not on tomee 7 but still tomee 1 you can use CXF WebClient to do that. TomEE 7 would let you use standard JAX-RS 2 client (part of EE 7) but was not in TomEE 1 (EE 6)
There are plenty of options to consume REST applications in Java nowadays. The current standard is the JAX-RS Client API, released in JAX-RS 2.0, and it's part of the Java EE 7 API.
Important: Once your are using Apache TomEE 1.6.0, which is Java EE 6 certified, the JAX-RS Client API won't be available for you. Keep reading.
JAX-RS Client API
The JAX-RS Client API (javax.ws.rs.client package), defined in the JSR 339 and released as part of the Java EE 7 API, is the standard way to consume REST web services in Java. Besides others, this specification is implemented by Jersey, RESTEasy and Apache CXF.
Vendor specific proxy frameworks
Both Jersey, RESTEasy and Apache CXF also provide a proxy framework API. Those APIs are vendor specific and are not part of the JAX-RS Client API.
The basic idea is you can attach the standard JAX-RS annotations to an interface, and then implement that interface by a resource class on the server side while reusing the same interface on the client side by dynamically generating an implementation of that using java.lang.reflect.Proxy calling the right low-level client API methods.
For more details check the following:
Jersey proxy-based client API
RESTEasy proxy-based client API
Apache CXF proxy-based client API
Other resources
Here are some other options that you could consider as alternative to the JAX-RS Client API:
Apache CXF WebClient API †
Spring RestTemplate
OkHttp
Retrofit
Netflix Feign
† Apache CXF WebClient API: It's shipped with the Apache TomEE 1.6.0. In the cxf-rt-frontend-jaxrs.jar you are going to find the WebClient class, which is the entry point to the client API.
Thank you very much for your help.
Finally, I decided to use the standard JAX-RS API, but as it was not released yet in Tomee 1.6, I had to add a jar file in the lib directory of the server :
javax.json-1.0.4.jar, which I downloaded from Oracle web site.
To compile my project, I had to use an other jar file : javax.json-api-1.0.4.jar
Since you have mentioned that you are using TomEE plus 1.6, you already have JAX-RS client (Ref: Apache TomEE) which can be used to access REST WS.
The javax.ws.rs.client can be used to invoke the REST service and receive the response. More detailed tutorial can be found on Oracle Site.
EDIT: Missed the version number part. The API is available in 1.7.

How to decide on what framework to use in Java Web Service?(SOAP)

I am fairly new in Java EE web service. Right now we have a project to create an API web service that connects to a database and do some retrieve and write functions.
I've heard about the following:
Axis
Struts
Spring
Can someone please enlighten me as to what framework is applicable for the said project? I've tried Google of course but I need opinion on people who have experience on the said framework.
BTW we are going to create a SOAP web service. Additional tips are also appreciated.
Note that Java has the JAX-WS API which is a technology for building web services and clients that communicate using XML. In JAX-WS, a web service operation invocation is represented by an XML-based protocol, such as SOAP.
From the frameworks you mentioned, Spring brings SpringWS which you can use to build a SOAP web service.
However i don't know about Struts 2 core api offering any SOAP capabilities.
But it can be extend with other plugins that handle SOAP.
Axis (use the latest, Axis 2) is a good choice for SOAP. It is a Web Services / SOAP / WSDL engine. It also has some support for the Spring Framework.
There is also Apache CXF. It is the most widely used Web Services Standard Now; Improvement over AXIS2, which is now gradually being replaced by Apache CXF
If you need help deciding between them, read this comparison (Apache CXF vs. Apache AXIS vs. Spring WS) for the pros and cons.
There's also this great answer about cxf and axis 2.

Using JAX-WS RI of java 6 under heavy load

I have recently started with web services. In my project, I have to create a client side using wsdl provided.
I have implemented the client part using JAX-WS RI which is available as part of Java 6.
Now when I was going through some blogs, they mentioned that we should not use JAX-WS of java, as it is just an reference implementation and
we have to go for libraries like Apache CXF or Axis2.
Could you please advice if we can use JAX-WS RI of java in production ?
At the moment with JAX-WS RI of Java, our client application testing is going on without any issues. Will it create any problem if we use it under high load ?
Thanks,
Vijay

JBossWS vs JAX-WS

This might be a trivial question, but it's been confusing me and I couldn't find a direct answer from google and through online searching.
What is the difference between JBossWS and JAX-WS?
Is JBossWS an implementation built on JAX-WS, so in a sense JBossWS contains JAX-WS? If so what makes people use JBossWS and not JAX-WS?
Thanks so much!
What is the difference between JBossWS and JAX-WS?
Is JBossWS an implementation built on JAX-WS, so in a sense JBossWS
contains JAX-WS?
JAX-WS is a specification for building web services in Java. It defines annotations to be used (#WebService, ...) and so on. The jdk contains a reference implementation of this specification, the JAX-WS RI.
JBossWS implements the JAX-WS specification. That is, it supports the same annotations and programming model as the JAX-WS RI. It does afaik not contain the RI, but provides its own implementation.
If so what makes people use JBossWS and not JAX-WS?
No matter whether you are using JBossWS or the RI, you will be using JAX-WS. People will use an implementation different from the RI, because they need the support of additional WS-standards, such as WS-Security, WS-ReliableMessaging and more. The only additional standard the RI supports (apart from WSDL and SOAP of course) is WS-Addressing.
On that note: There are several more JAX-WS implementations with differing degree of support out there. For example Apache CXF or Metro.
According to their web page (http://www.jboss.org/jbossws/) it seems that JBossWS is part of the JBoss application server, so it is a JAX-WS implementation.
Features:
JAX-RPC and JAX-WS (2.2) support
JBoss Application Server 5 (JavaEE 5 compliant) web service stack
EJB 2.1, EJB3 and JSE endpoints
Attachments Profile Version 1.0
Support for MTOM/XOP and SwA-Ref
WS-Security 1.0 for XML Encryption/Signature of the SOAP message
WS-Addressing (W3C candidate release) and JSR-261
WS-ReliableMessaging
WS-Eventing
WS-Policy

Is Jersey just a framework for developing RESTful web services in Java?

The way I understand it is Java EE 6 includes the classes for java.ws.rs (JAX-RS) which are defined in the JSR 311 spec document. But I don't know why you would use Jersey or Apache CXF if the base classes are already built into Java EE 6. Can you not create a RESTful web service with those classes alone? Are Jersey, Apache CXF, etc just frameworks to make development of REST-based web services easier?
why you would use Jersey or Apache CXF if the base classes are already built into Java EE 6.
Can you not create a RESTful web service with those classes alone?
Java EE only defines standards, those classes are the standard API, but there is no implementation behind them. Jersey and CXF are competing implementations of the standard.
However, if you have a server that claims to support Java EE 6, it will have to contain an implementation for every API that's in the standard. For example, Glassfish includes Jersey, so you don't have to add it explicitly.
JAX-RS is just a specification. In order to use JAX-RS, you need an implementation of the spec.
Jersey is a JAX-RS implementation. Specifically, it is the reference implementation.

Categories

Resources