Design and implement business logic and bind it as service using SOAP (Simple Object Access Protocol), also implement client to call service.
Right Click ->New Project
Select from Categories Java Web and Projects Web Application
Provide Project Name : TaxCalWebService
Click on next
Click on Finish
(New Project will be created)
Right click on project (TaxCalWebService) -> New -> WebService
Provide the Web Service Name (CalculateTaxService) and package name : ws. click on Finish
New Web Service class will created
Right click on CalculateTaxService -> Add web service operation
Provide name and parameters
New Method will be create in CalculateTaxService
Make the following code modifications in calculateTaxAmount method
We are done with the web service, Right click on the project and run.
Creating web service client project:
Right click project explorer -> New Project -> Java Web (Web Application)
Provide name of the project and click on Next
Click on Finish
Expand the client project -> Source page -> Right Click -> New -> Servlet
Provide : Class name : TaxCalServlet, package name : ws
Click on Next
Click on Finish.
In index.html page add new form in the body tag
Open the Serlvet class (TaxCalServlet) -> Right click -> Call Web Service Operation….
Then the follow Screen appears select the web service ( calculateTaxAmount) and click OK.
New private method will be added to TaxCalServlet.
Add the following code snippet in TaxCalSerlvet
We are done with the Client
Run the client program.