- Download the latest axis release from here.
- Unzip it in a folder in your hard disk (e.g D:/Dev/Java)
- Copy the web.xml file of axis-1_4\webapps\axis\WEB-INF in WEB-INF folder of your application
- Create a folder in WEB-INF folder of your application and call it deploy (or any other name)
- Create a folder in WEB-INF folder of your application and call it script (or any other name)
- create a new dynamic project : New > Others…> web dynamic web project > Next
- Use the same configuration as shown in the following figure :
- Click on Next and use the same configuration
- Click on Next and use the same configuration
- Click on Finish
- The result must be as following
- Create an Axis Library : right click on the project > Properties > Java Build Path >Librairies > Add Library > User Library > Next
- Click on New and rename the library Axis Library > OK
- Click on Add jars…
- Select all jars from axis-1_4\webapps\axis\WEB-INF\lib > Open > OK
- 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”
*/
public String sayHello(){ return “Hello Axis”; } - In the deploy folder, create two files deployHellowAxis.wsdd et undeployHelloAxis.wsdd
- <parameter name=“className” value=“com.workpace.axis.ws.HelloAxis” />
- 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” />
</service>
</deployment> - Insert the following code in undeployHellowAxis.wsdd and save it :
<undeployment xmlns=“http://xml.apache.org/axis/wsdd/”>
<service name=“HelloAxisWS” />
</undeployment> - 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 - Select the project, Run > External Tools > External Tools Configurations…
- Right click on program and use the same configuration as follow and Apply
- Repeat the same manipulation with undeployHelloAxis and Apply > Close
- In the Server panel, right click on the Tomcat server and choose Add and remove… then select axisWS > Finish
- So to deploy your web service:
- To test it click here
- 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 :
- How to install a new tomcat server in your workspace?
- How to make a connection with a sqlServer database by using Java?
- How to make a connection with a mySql database by using Java?
- How to create a web service SOAP?
2 comments
No ping yet
jasa seo says:
February 2, 2012 at 3:37 am (UTC 0)
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.
Olin Bruzek says:
August 26, 2011 at 9:55 am (UTC 0)
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.