Wednesday, May 9, 2007

Installing and deploying app for Axis 1.X

First of all, I have to say that it's a pain in the #@!$@# to deploy your class as webservices using Axis 1.x. Unless you have to do it, here is what I did.

Installing Axis

1. Copy webapps/axis directory from axis_unzip_folder/webapps/axis to web applications folder

2. Make sure the following jars are in the WEB-INF/lib folder

  • axis.jar

  • axis-ant.jar

  • commons-discovery-0.2.jar

  • commons-logging-1.0.4.jar

  • jaxrpc.jar

  • log4j-1.2.8.jar

  • log4j.properties

  • saaj.jar

  • wsdl4j-1.5.1.jar



3. Make sure that web.xml and server-config.wsdd is in your WEB-INF folder

4. Evalutate installation with happyaxis.jsp

ref

Deploying application

1. We have a piece of code

2. We want to take theexisting code, wrap it up as a Web service, and then deploy it to the Apache Axis system.

3. Once we have a running service on the server side, we will create java stubs that allow up to communicate with the service, only requiring the WSDL.

Here are the steps:

1. Java2WSDL: Generate the WSDL file for the given interface.

To run ant tasks for java2wsdl, make sure the following jars are in the classpath

1. axis.jar
2. axis-ant.jar
3. jaxrpc.jar
4. log4j.jar
5. saaj.jar
6. wsdl4j.jar


2. WSDL2Java: Generate the server side wrapper code, and stubs for easy client access.

Java stub classes/interfaces will be generated according to the wsdl specified.

3. classinterfaceSoapBindingImpl: Fill in wrapper to call the existing code.

4. Deploy the service to Apache Axis

Deploy the war folder/file onto application server
Run: java org.apache.axis.client.AdminClient
-p"7003" -h"localhost" -s"axis-test/servlet/AxisServlet" war\hello\deploy.wsdd

5. Write a client that uses the generated stubs, to easily access the web service.

HelloWorldService service = new HelloWorldServiceLocator();

HelloWorld hw = service.gethello();

Ref

No comments: