...
- From Eclipse main menu, select File->New->Other
- In the New dialog, select Web->Dynamic Web Project and click Next
- Type jaxws-rest-converterclient as the Project Name and click Next
- On the Project Facets page, the default selections are enough.
- Make sure that the check box Generate Deployment Descriptor is selected and click Next
- On the Geronimo Deployment Page modify the Group Id to org.apache.geronimo.samples.jaxws.rest and the Artifact Id to jaxws-rest-converterclient.
- Click Finish
Developing the Web based Client
- Right Click the jaxws-converterclient, and Select New->JSP
- Name the jsp as index.jsp and click Finish
- Add the following code to the index.jsp
...
- Right click again and add another jsp named post.jsp
- Add the following code to post.jsp
...
- Right click again and add a Servlet named ConverterHandler
- Add the following code to ConverterHandler.java
...
- Right click on the Apache Geronimo Server Runtime present in the servers view and select Add and Remove Projects
- Add jaxws-rest-converterclient to configured projects list and then click Finish
- Wait for some time till the server status changes to Synchronized
...
- Right click the index.jsp present under WebContent directory of our project and select Run As->Run On Server
- In the popup, check the check box Always use this server when running the project and then click Finish
- Now Eclipse will try to open the jsp in a web browser which shows you a form to enter amount in Dollars.
- Enter any amount and press submit, the jsp should display the result that is returned by the web service.
Info | |||||||
---|---|---|---|---|---|---|---|
| |||||||
The code for testing the RESTful service via POST method hasn't been added to the ConverterHandler.
|
This completes the development of a simple RESTful client that consumes a RESTful Web Service that is already deployed on the server.