How to make a web service by using Eclipse?

  1. Download the latest axis release from here.
  2. Unzip it in a folder in your hard disk (e.g D:/Dev/Java)
  3. Copy the web.xml file of axis-1_4\webapps\axis\WEB-INF in WEB-INF folder of your application
  4. Create a folder in WEB-INF folder of your application and call it deploy (or any other name)
  5. Create a folder in WEB-INF folder of your application and call it script (or any other name)
  6. create a new dynamic project : New > Others…> web dynamic web project > Next
  7. Use the same configuration as shown in the following figure :
  8. Click on Next and use the same configuration
  9. Click on Next and use the same configuration
  10. Click on Finish
  11. The result must be as following
  12. Create an Axis Library : right click on the project > Properties > Java Build Path >Librairies > Add Library > User Library > Next
  13. Click on New and rename the library Axis Library > OK
  14. Click on Add jars…
  15. Select all jars from  axis-1_4\webapps\axis\WEB-INF\lib > Open > OK
  16. Create a new Class and rename it HelloAxis in the com.workpace.axis.ws package
    Add the following code as a method
    /*** To say Hello
    * @return “Hello Axis”
    String sayHello(){ return “Hello Axis”; }
  17. In the deploy folder, create two files deployHellowAxis.wsdd et undeployHelloAxis.wsdd
    1. <parameter name=“className” value=“com.workpace.axis.ws.HelloAxis” />
  18. Insert the following code in deployHellowAxis.wsdd and save it :
    <deployment xmlns=“http://xml.apache.org/axis/wsdd/” xmlns:java=“http://xml.apache.org/axis/wsdd/providers/java”>
    <service name=“HelloAxisWS” provider=“java:RPC” style=“wrapped” use=“literal”>
    <parameter name=“allowedMethods” value=“*” />
    <parameter name=“scope” value=“Request” />
  19. Insert the following code in undeployHellowAxis.wsdd and save it :
    <undeployment xmlns=“http://xml.apache.org/axis/wsdd/”>
    <service name=“HelloAxisWS” />
  20. In the script folder, create a deployWS.bat and insert this code :
    cd “{PUT_HERE_THE_ PATH_OF_YOUR_WORKSPACE}\axisWS\WebContent\WEB-INF\deploy”set CLASSPATH=.;..\lib\axis.jar;..\lib\axis-ant.jar;..\lib\commons-discovery-0.2.jar;..\lib\commons-logging-1.0.4.jar;..\lib\jaxrpc.jar;..\lib\log4j-1.2.8.jar;..\lib\saaj.jar;..\lib\wsdl4j-1.5.1.jarjava org.apache.axis.client.AdminClient -s /axisWS/services/AdminService %1%.wsdd
  21. Select the project, Run > External Tools > External Tools Configurations…
  22. Right click on program and use the same configuration as follow and Apply
  23. Repeat the same manipulation with undeployHelloAxis and Apply > Close
  24. In the Server panel, right click on the Tomcat server and choose Add and remove… then select axisWS > Finish
  25. So to deploy your web service:
  26. To test it click here
  27. So to undeploy your web service:

You can send parameters to your web service by using parameters in your method

Create a SimpleCalculate.java class or download id from here. You have here for basics methods: addition(), subtraction(), multiplication() , division(). Put this class in com.workpace.axis.ws package.

Redo the steps from 18. to 25. by changing HelloAxis by SimpleCalculate and hello Axis by simple calculate

Click here to show the page


See also :

Share it with your freinds on Facebook Tweet it to your freinds on Twitter Myspace Friendfeed Technorati del.icio.us Digg Google Yahoo Buzz StumbleUpon


No ping yet

  1. jasa seo says:

    I’ve recently started a blog, the info you offer on this site has helped me greatly. Thanks for all of your time & work. “You do ill if you praise, but worse if you censure, what you do not understand.” by Leonardo DaVinci.

  2. Olin Bruzek says:

    Just wish to say your article is as astounding. The clearness in your post is just excellent and i can assume you’re an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please continue the rewarding work.

Leave a Reply

Your email address will not be published.

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

WP SlimStat