Use Case: Creating SOAP Based Web Service for Addition of two numbers.
1) Create a new J2EE Web Application

2) Name the application as AdditionOfTwoNumbersWebService

3) Name the project 1 (i.e. Controller) as AdditionOfTwoNumbersController

Click Next

4) Name the project 2 (i.e. Model) as AdditionOfTwoNumbersModel

Click Next

Click Finish

Initial structure of Application with two Project's will look as below

5) Create a Java Class with
Package: com.addition.ws
Name: AdditionWS

6) Now write a simple method add which takes two input numbers and returns addition of those numbers as result as shown below.

Configuring/Creating Web Service
7) Right click on AdditionWS.java class and select Create Web Service option

Click Next

Click Next

Select Document/Wrapped and click Next

Select the method add(int number1,int number2):int and click Next

Click Next

Click Next

Click Next

Click Finish

8) Now Soap based service is created for Addition Of Two Numbers as you can see the symbol on AdditionWS.java has been changed which indicates that it is a service.

Testing Web Service generated/Created
9) Right click on AdditionWS.java and select Test Web Service which internally starts the integrated weblogic server and deploys this application on top of it.

10) After completion of weblogic server start with deploying the application we will get the below window open where we are providing some inputs for Addition of two numbers service.
Input1: 20
Input2: 21
No comments:
Post a Comment