Thursday, March 17, 2016

Soap Web Service Example - Simple Calculator

Hi All, The below is simple SOAP calculator example. I have created this with below technologies.

1. Eclipse Indigo IDE
2. Apache Tomcat 6
3. Apache Axis

Step 1: Create one dynamic project which name is SimpleCalculator


Step 2: Cretae one package like com.ws.calculator and write one Calculator java class with four methods for addition, substration, multiplication and division.




Step 3: Once Calculator class is created, next you need to create web services through Bottom Java bean approach. I was forget to tick (Checkbox) Publish the web Service and Monitor the web service. Please tick it.




 Step 4:  Click Next button, Now you able to see which style you have to follow for soap web service. You can choose document / literal .
 Step 5: After that click Next, continuosuly it will ask click Next. From your Calculator java code Calculator wsdl will be generated, this concept is called Bottom Up. You can see below, generated wsdl file.


 Step 6: Click Launch button, Eclipse browser will open like below.


 Step 7: Now SimpleCalculatorClient code also generated. Click addition(int,int) method. It will ask you provide two inputs. Once you provide inputs , bottom you able to see correct result like below.

Step 8: We know soap will process all request and responses in the XML format only. Below I provided screenshot for requesting addtion method in the XML format.

Step 9: You can see below response result in the XML format for the above request XML.


Thats ALL.  Happy Learning! Any doubts please raise in comment.


3 comments:

  1. This comment has been removed by the author.

    ReplyDelete
  2. The WSDL file isn't getting created. Its displaying Error: 500.

    ReplyDelete
    Replies
    1. Please mention which steps you are getting struggle

      Delete