Sun 20 Jan 2008
Java Webservices – Relationship between JAX-WS, JAX-RS, Metro and Jersey
Posted by admin under Java , jersey , programming , webservice[7] Comments
Have you ever wondered about the relationship of different actors within Java’s Webservice Stack? I did. The key to the right answers you may find watching this list of Glassfish projects.
So there seems to be a simple formula (RI = reference implementation):
JAX-WS = JAVA-API( XML-based Webservices, means mainly WSDL/SOAP though REST is possible too )
RI(JAX-WS) = { javax.xml.ws.**.* , core Web services support } = JAX-WS “RI” [is subset of] Metro
Metro = JAX-WS “RI” + WSIT/Tango ( WSIT/Tango provides support for Security, Reliability, Transactions and Interoperability with .NET 3.0 )
JAX-RS = JAVA-API( RESTful Web Services )
RI(JAX-RS) = { javax.ws.rs.**.* } = Jersey
JAX-WS 2.1 along with JAXB 2.1 is integrated in JDK 6 Update 4 release as is JAX-WS in JDK 6. It is part of Java EE 5 as well. To use Metro 1.1 on JDK6 U4, you just have to put the Metro jars in the classpath. Metro is integrated with Glassfish Application Server.
It is possible to run REST Services with JAX-WS using the appropriate Binding like described in RESTful Web Services.
JAX-RS is yet not finally released (see Schedule). If you are using NetBeans IDE 6.0, you do not need to download the Jersey distribution. Instead, install the RESTful Web Services plugin from the Plugin Manager under the Tools menu. Developing RESTful Webservices is much easier here. Implementing RESTful Web Services in Java provides a good start.
If you are looking for the Metro libraries, either get them from GlassFish (webservices*.jar) , or download them from Metro distribution.
Some nice slides for an Metro/Jersey overview : Metro and Jersey.
To use Metro in your application you will need this jars (see also Metro FAQ):
$METRO_HOME/lib/webservices-rt.jar
$METRO_HOME/lib/webservices-api.jar
$METRO_HOME/lib/webservices-extra-api.jar
$METRO_HOME/lib/webservices-extra.jar
May 9th, 2008 at 8:29 am
Nice post .. clearifying different API and RIs.
I still have one question and not able to find answer for it.
For developers, there should not be a difference programming for SOAP vs REST … I want to be able to write single interface and expose it as SOAP or REST as a deployment or configuration option.
Having JAX-WS for SOAP based services primarily and then JAX-RS for RESTful services, have you find any want to use both API in single interface, may be mixing annotations from both in single java interface?
May 9th, 2008 at 11:25 am
No, I have not done it myself. Cause it seems to me that the semantic of method handling can be quite different (see also http://www-128.ibm.com/developerworks/webservices/library/ws-restvsoap/ ). I know people who tried to support interfaces in REST and SOAP versions with different wrapper interface classes, but finally one of them (REST) became primary cause the application was more document oriented and the whole implementation of the underlying methods was influenced. So the SOAP Version was not used and supported anymore.
One way to achieve what you are out for could be using:
@BindingType(value=HTTPBinding.HTTP_Binding)
from JAX-WS. An example you can find in http://www.informit.com/content/images/9780130449689/samplechapter/0130449687_CH03.pdf
or search for “Basic SOA using Rest” .
Please drop a message if you have found something more useful regarding this issue.
January 16th, 2009 at 5:55 pm
Try using Enunciate! It dynamically creates all your server/client endpoint needs. JAX-WS, REST, Spring, GWT_RPC, etc…
http://enunciate.codehaus.org/index.html
June 4th, 2009 at 11:42 pm
I saw a presentation today at JavaOne 2009 that was about using SOAP and REST together. I posted a brief description of what was said on the presentation. Check it out at http://thedevelopercorner.blogspot.com/2009/06/coding-rest-and-soap-together.html
August 19th, 2011 at 7:16 am
Hi there,
Seems I am bit late here – but its better late than never
Very useful info. Thanks for publishing it.
But I am wondering if it can be updated, as its been a while since this was posted, & things has changed a lot.
cheers!
September 21st, 2011 at 2:24 pm
What does “RI” mean here ?
September 21st, 2011 at 2:31 pm
OK, Reference Implementation.
I didn’t read carefully the intro of the article.
Sorry for the stupid question