Apache Axis Web Service with Maven (modified)

I have modified the existing SOAP web service project here -> https://mattisee.wordpress.com/2013/10/04/creating-a-simple-web-service-using-apache-axis-1-4/ with some minor modifications to use Maven for deployment.The command line to generate the stubs is still the same, but with javax.mail.jre15_1.4.1 jar added:

new -> Maven project on Eclipse


set LIB_HOME=D:\GitWorkspace\packages\axis-bin-1_4\axis-1_4\lib

set SERVER_IMPL_HOME=D:\OxygenWorkspace2\githubws\axisExample\AxisServerExample

//Screenshot of the library below
//LIB_HOME is the lib folder of the axis installation with javax.mail.jre15_1.4.1 jar added to the axis library.

//SERVER_IMPL points to the project root created as a Maven project

axis_installation_lib
To create the wsdl file from java code ->

java -cp "%LIB_HOME%/axis-ant.jar;%LIB_HOME%/axis.jar;%LIB_HOME%/commons-discovery-0.2.jar;%LIB_HOME%/commons-logging-1.0.4.jar;%LIB_HOME%/jaxrpc.jar;%LIB_HOME%/log4j-1.2.8.jar;%LIB_HOME%/saaj.jar;%LIB_HOME%/wsdl4j-1.5.1.jar;%LIB_HOME%/javax.mail.jre15_1.4.1.jar;%SERVER_IMPL_HOME%\target\classes" org.apache.axis.wsdl.Java2WSDL -o %SERVER_IMPL_HOME%/src/main/resources/mattiz.wsdl -l "http://localhost:8080/axis/services/MattizAxisTest" -n urn:mattiz -p"mattiz" urn:mattiz com.mattiz.ws.axis.server.impl.MattizAxisServerImpl

To create the stubs from the generated wsdl->

java -cp "%LIB_HOME%/axis-ant.jar;%LIB_HOME%/axis.jar;%LIB_HOME%/commons-discovery-0.2.jar;%LIB_HOME%/commons-logging-1.0.4.jar;%LIB_HOME%/jaxrpc.jar;%LIB_HOME%/log4j-1.2.8.jar;%LIB_HOME%/saaj.jar;%LIB_HOME%/wsdl4j-1.5.1.jar;%LIB_HOME%/javax.mail.jre15_1.4.1.jar;" org.apache.axis.wsdl.WSDL2Java -o %SERVER_IMPL_HOME%/src/main/java -p com.mattiz.axis.request -s %SERVER_IMPL_HOME%/src/main/resources/mattiz.wsdl

Follow the remaining instructions without change, but leave out the build.xml.Instead use run as maven install on the pom.xml (uploaded to git)
To generate the server-config file (wsdd) in the Axis tomcat installation run this on command line

java -cp ""%LIB_HOME%/axis-ant.jar;"%LIB_HOME%/axis.jar;"%LIB_HOME%/commons-discovery-0.2.jar;"%LIB_HOME%/commons-logging-1.0.4.jar;"%LIB_HOME%/jaxrpc.jar;"%LIB_HOME%/log4j-1.2.8.jar;"%LIB_HOME%/saaj.jar;"%LIB_HOME%/wsdl4j-1.5.1.jar" org.apache.axis.client.AdminClient -lhttp://localhost:8080/axis/services/AdminService %SERVER_IMPL_HOME%/src/main/java/com/mattiz/axis/request/deploy.wsdd

There are no changes on the client side. And since this is a standalone application I have not created a Maven project for this. Neither is there a build.xml.
The maven pom.xml for the server project is here->

<project>
	<modelVersion>4.0.0</modelVersion>
	<groupId>com.mattiz.axis</groupId>
	<artifactId>AxisServerExample</artifactId>
	<version>0.0.1-SNAPSHOT</version>
	<packaging>war</packaging>
	<name>mattiz</name>
	<description>Axis Server Example</description>
	<properties>
		<mavenVersion>2.0</mavenVersion>
	</properties>
	<scm>
		<url>http://svn.apache.org/viewcvs/webservices/axis/trunk/java</url>
	</scm>
	<dependencies>
		<dependency>
			<groupId>org.apache.axis</groupId>
			<artifactId>axis</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency><!-- depends on nothing; I think -->
			<groupId>axis</groupId>
			<artifactId>axis-jaxrpc</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency><!-- depends on nothing; I think -->
			<groupId>axis</groupId>
			<artifactId>axis-saaj</artifactId>
			<version>1.4</version>
		</dependency>
		<dependency><!-- depends on nothing; I think -->
			<groupId>axis</groupId>
			<artifactId>axis-wsdl4j</artifactId>
			<version>1.5.1</version><!-- version independent of axis -->
			<scope>runtime</scope>
			<!-- note: also at wsdl4j:wsdl4j (a sf.net project) -->
		</dependency>
		<dependency>
			<groupId>commons-logging</groupId>
			<artifactId>commons-logging</artifactId>
			<version>1.0.4</version>
			<scope>runtime</scope>
		</dependency>
		<dependency>
			<groupId>commons-discovery</groupId>
			<artifactId>commons-discovery</artifactId>
			<version>0.2</version>
			<scope>runtime</scope>
		</dependency>
		<!-- -->
		<dependency>
			<groupId>org.apache.axis2</groupId>
			<artifactId>axis2-java2wsdl</artifactId>
			<version>1.7.6</version>
		</dependency>
	</dependencies>
	<repositories>
		<repository>
			<id>axis</id>
			<name>Axis repo</name>
			<layout>default</layout>
			<url>https://mvnrepository.com/artifact/org.apache.axis/axis</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>axis2</id>
			<name>Axis2 repo</name>
			<layout>default</layout>
			<url>https://mvnrepository.com/artifact/axis/axis-jaxrpc</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
		<repository>
			<id>axis3</id>
			<name>Axis3 repo</name>
			<layout>default</layout>
			<url>https://mvnrepository.com/artifact/org.apache.axis2/axis2-java2wsdl</url>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
		</repository>
	</repositories>
	<pluginRepositories>
		<pluginRepository>
			<id>central</id>
			<name>Maven Plugin Repository</name>
			<url>http://repo1.maven.org/maven2</url>
			<layout>default</layout>
			<snapshots>
				<enabled>false</enabled>
			</snapshots>
			<releases>
				<updatePolicy>never</updatePolicy>
			</releases>
		</pluginRepository>
	</pluginRepositories>
	<build>
		<finalName>mattiz</finalName>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-war-plugin</artifactId>
				<version>3.2.0</version>
				<configuration>
					<webappDirectory>/output/deploy/directory</webappDirectory>
				</configuration>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-compiler-plugin</artifactId>
				<version>2.3.2</version>
				<configuration>
					<source>1.8</source>
					<target>1.8</target>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

The source code has been uploaded to git here.
https://github.com/CuppajavaMattiz/mattiz/tree/master/new_mattiz
Cheers!

About cuppajavamattiz
Matty Jacob - Avid technical blogger with interests in J2EE, Web Application Servers, Web frameworks, Open source libraries, Relational Databases, Web Services, Source control repositories, ETL, IDE Tools and related technologies.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: