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.
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.
Drag up the slider for client and make it start
Click Next
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
In the TODO you can see we have two methods , add and subtract
Add the following lines for subtract and add methods TODO
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
That completes the WSDL creation, client creation and testing process using bottom up approach
Hi Jagat Jasjit Singh,
ReplyDeleteIts very nice to see the article and the way you have explained it. Although i am very new to web services but seeing your post got very encouraged and thanks for really lighting my problem as you do eventually for others.
It would be very great if you could further enhance the prog to show us the junit failure cases also as i see only the pass cases.
Can we also extract all the failure cases from the prog and document it?
Thanks