Web Services in Java

What are Web Services ?

According to W3C ,Web Services are the message-based design frequently found on the Web and in enterprise software. The Web of Services is based on technologies such as HTTP, XML, SOAP, WSDL, SPARQL, and others.” Web services provides  interoperability between different applications running on different platforms.So in simple words , using Web services , applications running in different platforms can communicate each other over the internet.Also Web Services are platform and browser independent . In this chapter we will be looking into the Web service support in Java EE.This discussion is a simple Web Service  tutorial.

Web Services in Java

Java EE has two APIs  those gives web services support. They are: JAX-WS and JAX-RS.  We will be looking to  each of these APIs  in the coming chapters.We will be discussing examples too.This Web Service  Tutorial  gives an overview about these two APIs.


JAX-WS stands for Java API for XML Web Services . It  provides support for SOAP(Simple Object Access Protocol ) web services.SOAP web services uses XML messages that follows the SOAP standard.

Features of SOAP Web Services

  • Requests and responses are transmitted as SOAP messages(XML files) over HTTP
  • Even though SOAP structure is complex , developer   need not bother about the complexity in messaging. The JAX-WS  run time system manages  all the parsing related stuffs.
  • Since JAX-WS uses the W3C defined technologies , a SOAP web service client can access a SOAP web service that is running in a non java platform.
  • A machine readable  WSDL (Web Service Description Language)  file  which describes all the  operations about a service can be present in case of SOAP web services

Implementation details of JAX-WS Web Services

  • At server side developer needs to write an interface with service methods
  • At server side there are concrete classes  implementing those interfaces
  • So at the client side , the client simply  creates a proxy object of the service  and hence invokes the service

We will be looking more about the implementation details in the coming chapters.


JAX-RS provides support to RESTful Web Services.REST stands for Representational State Transfer.

Features of RESTful Web Service

  • Neither XML Messaging  nor WSDL definition needed
  • Development of RESTful Web Service is easier  when compared with SOAP
  • Services are completely stateless
  • Project Jersey is the production ready implementation of JAX-RS specification
  • REST is well suited for PDAs and Mobile Phones . Using SOAP WEB Services in such low profile devices is obviously an overhead.
  • Since there is no formal web service interface definition , there should be a mutual understanding between the service and the client regarding the data being passed along.
  • RESTful Web Service exposes a set of resources .Clients can identify these resources using URIs.
  • Resources are manipulated using PUT,GET,DELETE and POST operations. A PUT operation creates a resource, POST transfers a new state to a resource, GET retrieves the current state of the resource , DELETE operation deletes a resource

The implementation details of JAX-RS web services  will be explaining once we are doing an example

See Related Discussions:

JAX-WS Tutorial

JAX-RS Tutorial