...
- From Eclipse main menu, select File ->New->Other-> New --> Other
- In the New dialog, select Web ->Dynamic -> Dynamic Web Project and click Next
- Type jaxws-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 and the Artifact Id to jaxws-converterclient.
- Click Finish
...
- Open a command prompt and point it to the bin directory of server installation.
- We will use the jaxws-tools utility provided in the server's bin directory to generate client stubs.
- Use the following command to generate the necessary stubs that are needed to consume the web service.
...
Developing the Web based Client
- Right Click -click the jaxws-converterclient, and Select New ->JSP-> JSP
- Name the jsp JSP as index.jsp and click Finish
- Add the following code to the index.jsp
...
- Right click again and add another jsp JSP named result.jsp
- Add the following code to result.jsp
...
- Right click the index.jsp present under WebContent directory of our project and select Run As ->Run -> 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.
...
- Create a Java Project
- Select File ->New->Project -> New --> Project
- In the popup window select Java ->Java -> Java Project and then click Next
- Name the project as jaxws-converterpojoclient and click Finish in the New Java Project dialog.
- Select File ->New->Project -> New --> Project
- Copy the files Converter.java and ConverterPortType.java into the appropriate package.
- Add another class with the name ConverterClient.java in the same package.
- Add the following code to the ConverterClient.java
...
- Now Right click the ConverterClient.class and select Run As ->Run -> Run as Java Application
- Now enter the amount in the console window of Eclipse
- The output will be shown which is retrieved by accessing the methods of Web service.
...