Home > Documentation > Developing > Tutorials > Developing Web services > RESTful Web Services > Developing Client for RESTful Web Service |
This tutorial will take you through the steps required in developing, deploying and testing a RESTful Web Service Client in Apache Geronimo for a web services which are already deployed on the server
We will be creating a Web based Client which can access the RESTful web service via GET and POST methods. You can easily create this client without any external tools except that of a server environment.
To run this tutorial, as a minimum you will be required to have installed the following prerequisite software.
Details on installing Eclipse are provided in the Development environment section.
This tutorial assumes that you have completed the Developing a simple RESTful Service tutorial. Here we will try to develop the client for the web service deployed in the above mentioned tutorial.
This tutorial will take you through the following steps:
Here the servlet might notify that some imports are not resolved. We need to add two external jar files to resolve these errors.
The jar files that needed to be added in the build path are:
commons-codec-1.3.jar - <GERONIMO_INSTALL_DIR>\repository\commons-codec\commons-codec\1.3\commons-codec-1.3.jar
commons-httpclient-3.0.1.jar - <GERONIMO_INSTALL_DIR>\repository\commons-httpclient\commons-httpclient\3.0.1\commons-httpclient-3.0.1.jar
XPath (XML Path Language) is a language for selecting nodes from an XML document with very advanced features.
Our response message sent by web service may look like this:
We will first try to get the NodeList present between <return> elements, Then we evaluate each child node to get the results.
This concludes the development section of our web based client.
The code for testing the RESTful service via POST method hasn't been added to the ConverterHandler.
A sample post file might look like this
This completes the development of a simple RESTful client that consumes a RESTful Web Service that is already deployed on the server.
Bookmark this on Delicious Digg this | Privacy Policy - Copyright © 2003-2011, The Apache Software Foundation, Licensed under ASL 2.0. |