THIS IS A TEST INSTANCE. ALL YOUR CHANGES WILL BE LOST!!!!
...
Table of Contents | ||||||
---|---|---|---|---|---|---|
|
Web based Client
Create a Dynamic Web Project to consume the Web Service
- 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
...
This concludes the development section of our web based client.
Setting Up the Deployment Plan
- As two external jars have been added to the project's build path, One needs to specify them as dependencies so that at runtime application can resolve the classes.
- Expand WebContent/WEB-INF directory and open geronimo-web.xml
- Add the following code to geronimo-web.xml
Code Block | ||||
---|---|---|---|---|
| ||||
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> <ns8:web-app xmlns="http://geronimo.apache.org/xml/ns/j2ee/connector-1.2" xmlns:ns2="http://geronimo.apache.org/xml/ns/deployment-1.2" xmlns:ns3="http://geronimo.apache.org/xml/ns/naming-1.2" xmlns:ns4="http://openejb.apache.org/xml/ns/openejb-jar-2.2" xmlns:ns5="http://openejb.apache.org/xml/ns/pkgen-2.1" xmlns:ns6="http://geronimo.apache.org/xml/ns/j2ee/application-2.0" xmlns:ns7="http://geronimo.apache.org/xml/ns/security-2.0" xmlns:ns8="http://geronimo.apache.org/xml/ns/j2ee/web-2.0.1" xmlns:ns9="http://java.sun.com/xml/ns/persistence" xmlns:ns10="http://geronimo.apache.org/xml/ns/j2ee/application-client-2.0"> <ns2:environment> <ns2:moduleId> <ns2:groupId>default</ns2:groupId> <ns2:artifactId>jaxws-rest-converterclient</ns2:artifactId> <ns2:version>1.0</ns2:version> <ns2:type>car</ns2:type> </ns2:moduleId> <ns2:dependencies> <ns2:dependency> <ns2:groupId>commons-codec</ns2:groupId> <ns2:artifactId>commons-codec</ns2:artifactId> <ns2:version>1.3</ns2:version> <ns2:type>jar</ns2:type> </ns2:dependency> <ns2:dependency> <ns2:groupId>commons-httpclient</ns2:groupId> <ns2:artifactId>commons-httpclient</ns2:artifactId> <ns2:version>3.0.1</ns2:version> <ns2:type>jar</ns2:type> </ns2:dependency> </ns2:dependencies> </ns2:environment> <ns8:context-root>/jaxws-rest-converterclient</ns8:context-root> </ns8:web-app> |
Deploying and Testing the Web Client
Deploy
- 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
Testing
- 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.
...