Archives for 


REST Based Web Services

RESTFul Web Service Client Example

In the previous section  we have seen  a sample web service . In this section we can write a simple client for the service we developed

Restful Web Service Client example

RESTFul Service Client for a GET Service

Let us start with a client for a GET service.Once completion we can develop the same for a POST,PUT and DELETE  services

Before starting the  coding part of client , publish the web service we already developed  and start the server.

There are many libraries available for us to develop RESTful service clients. We can use the Apache Http Client libraries or the  JAX-RS implementation specific libraries.In our example we are using Apache Http Client components.We can download it from the Apache web site.We are using version 4.3 in our example. Extract and put the jar files in the lib folder to our project path.

The jars are :








Now run the code , and the output would be the String message

RESTFul Service Client for a POST Service

Now add a simple POST  service also to the we already developed.So the would be

Compile and republish it to server.Now we need to develop a client for the new service also .Modify the Client class as shown below and run it.

It would display the output of both the services.

Related Discussions

Web Services – An Over view

JAX-WS Tutorial

JAX-RS Tutorial