Monday, December 23, 2013


Web Services Beginner Guide

1) Create dynamic project as below.



2) create a package names 'com.net' in src and create below class with code.









3) Eclispe window -> preferences should be set as below.Becuase first run we are going to do using Apache Axis.





The tomcat server should have been added as below.

If tomcat is running, then it should show 'server' open in navigator. Else start the server in 'server' console by right clicking on shown server in console.

4) Have the tomcat server running within eclipse. Right clik project -> new -> web service and then browse the service class and give location and modify as below screen shot.


Below are the next set of screen shots u will get if you keep on doing next.


Sometimes when doing next we may get error.But click back and do next again.Then sometimes errors will dissapear.








4) when above is done, there will be separate client project created to test this.It will open up as below.



5)When we click on our service method, which is getRank, then we get below form to test the service.

6) Once input is done and invoke is clicked, it will show the input in result section as below and Sys out will be printed to console as below.

result section will show string only if the web service is returning a string.else if it is only a sys out, it will show the output in console.

http://localhost:8080/Test-WS-1Client/sampleTestServiceRankingProxy/TestClient.jsp

Test-WS-1Client= generated client project name
sampleTestServiceRankingProxy = here  'TestServiceRanking' is the class name including the service method which we have defined



7) Below is how to access the wsdl on diferent browser.

http://localhost:8080/Test-WS-1/services/TestServiceRanking?wsdl

Test-WS-1 = server project name
services = this is a must to include
TestServiceRanking = class name including the service method which we have defined