Mudassir Shahzad

Enterprise Software Development

What are Jax-RS, Jax-WS and Jax-B ?

What are Jax-RS, Jax-WS and Jax-B ?

Nowadays, different systems are inter-connected by using webservices. One system provides a webservice and one or more systems consume it and vice versa.

Now, there are two types webservices (at this point of time), currently being used in the world.

RESTFul and SOAP.

Often stuck at the question, what is the difference between jaxrs, jaxws and jaxb, developers tend towards social forums to seek “the answer” but seldom finds the right answer. So I thought I should write a post about it.

In this post, regardless of the discussion about SOAP Vs RESTFul, we focus strictly on what each of them are.

You must have heard of a wsdl file, right ?

Yes ?? go on…

 

No ?? WSDL : WebServices Description Language = This file is used in SOAP based webservices and specifies the input, protocol and output etc of the webservice.

 

Okay, on with the flow..

 

JaxB – Java API for XML binding, bundled with Java SE 6 and above, is used for

Java to XML conversion             or                    XML to Java Conversion.

 

Jax-RS – Java API for XML Restful webservices, also bundled with Java SE 6 and above, is used create restful webservices.

 

Jax-WS – Java API for XML webservices, bundled with Java SE 6 and above, is used to create SOAP based webservices.

 

Given the definition, here’s the crux of the post:

 

  • Jax-WS, Jax-RS and Jax-B are API’s (Combined set of classes for developer ease).
  • All are bundled with Java SE 6 and above.
  • You can either use Jax-WS (for SOAP) or Jax-RS (for RESTFul).
  • JaxB is just a helper to help you convert java to/from XML.

 

Some good people have provided implementations of SOAP and RESTFul or JAX-WS and JAX-RS respectively which makes the life of a developer, easy.

 

A moment of silence in their honor… with feeling…

 

For RESTFul, some of very good implementations are : Jersey (https://jersey.java.net/) and RESTEasy (http://resteasy.jboss.org/)

 

For SOAP, some of very good implementations are : Apache SOAP (http://xml.apache.org/soap/)

 

Important Note :

— > In SOAP, WSDL is the medium of communication.

— > In RESTFul, JSON is the medium of communication.

 

If this article helped you, pay it forward by sharing…

 

 

 

 

 

 

Mudassir Shahzad

Website:

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.