Use Case: Creating a client to invoke the SOAP Based Web Service for Addition of two numbers.
To create SOAP Based Web Service for Addition of two numbers, to deploy and to test the service please visit my previous post Click Here
1) Right click on AdditionWS.java service and select Create Client for Web Service Annotations
Select the target project and click Next
Check copy WSDL into project which is optional and click Next
2) Give the Package Name as com.addition,client and click Next
Click Next
Click Next
Click Next
Click Next
Click Finish
3) Now we can see the following files created inside the package com.addition.client
Open AdditionWSPortClient.java to test the AdditionWS service.
4) Add following lines to the code
int number3 = additionWS.add(20,21);
System.out.println("Addition of two numbers is: "+number3);
Now run this java class
We will get the result as Addition of two numbers is: 41 as highlighted above.
To create SOAP Based Web Service for Addition of two numbers, to deploy and to test the service please visit my previous post Click Here
1) Right click on AdditionWS.java service and select Create Client for Web Service Annotations
Select the target project and click Next
Check copy WSDL into project which is optional and click Next
2) Give the Package Name as com.addition,client and click Next
Click Next
Click Next
Click Next
Click Next
Click Finish
3) Now we can see the following files created inside the package com.addition.client
Open AdditionWSPortClient.java to test the AdditionWS service.
4) Add following lines to the code
int number3 = additionWS.add(20,21);
System.out.println("Addition of two numbers is: "+number3);
Now run this java class
We will get the result as Addition of two numbers is: 41 as highlighted above.
No comments:
Post a Comment