Web Service Client using Bottom up approach in Eclipse

This post is in continuation to http://jugnu-life.blogspot.com/2011/08/getting-started-with-web-services.html

This post will cover how to Create a new Web Service Client project , bottom up approach of development.

 

Web Service Client Project

In the Wizard paste the URL of WSDL copied earlier

Sect Axis Runtime as Apache Axis2

Click on Client Project and Enter new New Client Project Name BottomUpWebServiceClient , it will automatically become of type Dynamic Project . Its fine.

clip_image001[4]

clip_image001[6]

Drag up the slider for client and make it start

Click Next

clip_image001[8]

Keep all settings as default

Select

Generate a Junit test case to test the service

Click Finish

That completes the Client generation process

Now we will test this what we have created

In the test package

Open the file CalculatorTest.java

clip_image002

In the TODO you can see we have two methods , add and subtract

Add the following lines for subtract and add methods TODO

clip_image002[4]

subtract8.setC(10);

subtract8.setD(30);

I am just passing values of parameter c and d as 10 and 30 respectively

Similarly for addition we can write like

sum10.setA(100);

sum10.setB(30);

I am just passing values of parameter a and b as 100 and 30 respectively

Save the file

RightClick on CalculatorTest and Select Run As Junit Test

All the 4 tests should pass as shown below

clip_image002[6]

That completes the WSDL creation, client creation and testing process using bottom up approach