Axis 1.1 Web Service Module

Public Targets

TargetDescription
tcpmonaxis monitor (windows usage: start ant tcpmon)
wsdeploydeploy axis web service
wsundeployundeploy axis web service
gen.axisgenerate axis web service

Source: axis.xml

				<?xml version="1.0" encoding="UTF-8"?>
<project name="axis">
	<description>
  + ==\_/============J=A=V=A=G=E=N===A=N=T===M=O=D=U=L=E=S================= +
  +  \(_)/                                                                  +
  +  -(_)-               Axis 1.1 Web Service Module                        +
  +  /(_)\                                                                  +
  + ======================================================================= +
  +    Copyright (c) 2002-2005 Outsource Cafe, Inc.  All rights reserved.   +
  + ======================================================================= +
  +
  + Several macros are defined here that wrap Axis Ant tasks for converting
  + between Java, WSDL and stubs.
  + 
  + The Axis XDoclet code is immature at best, but in simple cases it may meet
  + your needs.  Our experience: unable to get a usable deploy.wsdd using JPJO code.
  + JBoss users are better off using the JBoss.NET mechanism for deployment,
  + see example below.
  +
  + The xdoclet.axis.suffix property defaults to 'WS'. 
  +
  + Todo: write uptodate targets for macros
  +
  + since: JAM 2.1
  + developer: RichardEasterling@OutsourceCafe.com
  + ======================================================================= +
  + Licensed under the Apache License, Version 2.0 (the "License");
  + you may not use this file except in compliance with the License.
  + You may obtain a copy of the License at
  +
  +   http://www.apache.org/licenses/LICENSE-2.0
  +
  + Unless required by applicable law or agreed to in writing, software
  + distributed under the License is distributed on an "AS IS" BASIS,
  + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  + See the License for the specific language governing permissions and
  + limitations under the License.
  + =J=A=M===========================================J=A=V=A=G=E=N=.=C=O=M= +
	</description>
	<!-- examples:
	properties:
	<property name="wsdl.name" value="${module.name}-${module.version}.wsdl"/>
	<property name="gen.wsdl.dir" location="${gen.dir}/${wsdl.folder}"/> defined in props-global.xml

	Generate WSDL from java class:
	<target name="java2wsdl">
		<java2wsdl.macro namespace="http://www.javagen.com/ws/gen" package="com.javagen.codegen.client" classname="com.javagen.codegen.JavaGenWS" wsdlName="${wsdl.name}" location="http://${appserver.host}:${appserver.http.port}/${webapp.context}/services/AxisServlet"/>
	</target>
	
	Generate web service proxy from WSDL:
	<target name="wsdl2rpc">
		<available file="${gen.wsdl.dir}/${wsdl.name}" property="wsdl-exists"/>
		<fail message="WSDL file not found: ${gen.wsdl.dir}/${wsdl.name}" unless="wsdl-exists"/>
		<wsdl2stubs.macro javaDir="${gen.itest.dir}" namespace="http://www.javagen.com/ws/gen" testcase="true" package="com.javagen.codegen.client" wsdlName="${wsdl.name}" wsdlDir="${gen.wsdl.dir}"/>
	</target>
	
	Combine two steps above into one - generate web service proxy from java class:
	<target name="wsdl2rpc">
		<java2stubs.macro namespace="http://www.javagen.com/ws/gen" package="com.javagen.codegen.client" classname="com.javagen.codegen.JavaGenWS"/>
	</target>

	Alternative to gen.axis target using JBoss.NET.  Generate the wsdd file, used to deploy EJB-based webservices.
	Override ejbdoclet (from ejb.xml) to include jbossnet subtask:
	<target name="ejbdoclet" unless="ejbdoclet.uptodate" depends="gen.uptodate">
		<ejbdoclet.macro>
			<fileset.tag...
			<predd.tag...
			<postdd.tag>
				<jboss version="${jboss.version}" xmlencoding="${xdoclet.xmlencoding}" typemapping="${jboss.type.mapping}" datasource="${jboss.datasource.name}" destdir="${xdoclet.build.metainf.dir}" validateXml="${xdoclet.validatexml}"/>
				<jbossnet destdir="${xdoclet.build.metainf.dir}" prefix="${module.name}" targetNamespace="${namespace}" webDeploymentName="${module.name}"/>
			</postdd.tag>
		</ejbdoclet.macro>
	</target>

	-->
	<!-- =================================================================== -->
	<!-- local properties: -->
	<!-- =================================================================== -->
	<property name="axis.context" value="${webapp.context}"></property>
	<path id="axis.classpath">
		<path refid="build.classpath"></path>
	</path>
	<!-- =================================================================== -->
	<!-- Check axis deploy.wsdd is uptodate with source -->
	<!-- =================================================================== -->
	<taskdef name="ejbdoclet" classname="xdoclet.modules.ejb.EjbDocletTask" classpathref="xdoclet.classpath"></taskdef>
	<taskdef resource="axis-tasks.properties" classpathref="build.classpath"></taskdef>
	<!-- =================================================================== -->
	<!-- tcpmon, start in a new console (windows usage: start ant tcpmon) -->
	<!-- =================================================================== -->
	<target name="tcpmon" depends="" description="axis monitor (windows usage: start ant tcpmon)">
		<java fork="yes" classname="org.apache.axis.utils.tcpmon" failonerror="true">
			<classpath refid="build.classpath"></classpath>
		</java>
	</target>
	<!-- =================================================================== -->
	<!-- wsdeploy -->
	<!-- =================================================================== -->
	<target name="wsdeploy" depends="" description="deploy axis web service">
		<axis-admin port="${appserver.http.port}" hostname="${appserver.host}" failonerror="true" servletpath="${axis.context}/services/AdminService" debug="true" xmlfile="deploy.wsdd"></axis-admin>
	</target>
	<!-- =================================================================== -->
	<!-- wsundeploy -->
	<!-- =================================================================== -->
	<target name="wsundeploy" depends="" description="undeploy axis web service">
		<axis-admin port="${appserver.http.port}" hostname="${appserver.host}" failonerror="true" servletpath="${axis.context}/services/AdminService" debug="true" xmlfile="undeploy.wsdd"></axis-admin>
	</target>
	<!-- =================================================================== -->
	<!-- java2wsdl macro: -->
	<!-- =================================================================== -->
	<macrodef name="java2wsdl.macro">
		<attribute name="namespace"></attribute>
		<attribute name="package"></attribute>
		<attribute name="classname"></attribute>
		<attribute name="methods" default=""></attribute>
		<attribute name="exclude" default="ejbCreate,ejbRemove,ejbActivate,ejbPassivate,setSessionContext"></attribute>
		<attribute name="style" default="RPC"></attribute>
		<attribute name="wsdlDir" default="${gen.wsdl.dir}"></attribute>
		<attribute name="wsdlName" default="service.wsdl"></attribute>
		<attribute name="location" default="http://${appserver.host}:${appserver.http.port}/${axis.context}/servlet/AxisServlet"></attribute>
		<element name="mapping.tag" optional="yes"></element>
		<sequential>
			<echo>@{classname} to @{wsdlName}</echo>
			<mkdir dir="@{wsdlDir}"></mkdir>
			<delete file="@{wsdlDir}/@{wsdlName}" failonerror="false"></delete>
			<!-- axis-java2wsdl requires a compiled class as input -->
			<mkdir dir="${build.classes.dir}"></mkdir>
			<javac destdir="${build.classes.dir}" classpathref="build.classpath" source="${compiler.source}" target="${compiler.target}" debug="${compiler.debug}" deprecation="${compiler.deprecation}" optimize="${compiler.optimize}" compiler="${compiler.type}" excludes="${compiler.excludes}">
				<src path="${src.java.dir}"></src>
				<src path="${gen.java.dir}"></src>
				<patternset refid="source.modifications.patternset"></patternset>
			</javac>
			<axis-java2wsdl classname="@{classname}" namespace="@{namespace}" exclude="@{exclude}" location="@{location}" style="@{style}" output="@{wsdlDir}/@{wsdlName}">
				<classpath refid="axis.classpath"></classpath>
				<mapping namespace="http://xml.apache.org/xml-soap" package="javax.activation"></mapping>
				<mapping.tag></mapping.tag>
			</axis-java2wsdl>
		</sequential>
	</macrodef>
	<!-- =================================================================== -->
	<!-- wsdl2stubs macro: -->
	<!-- =================================================================== -->
	<macrodef name="wsdl2stubs.macro">
		<attribute name="namespace"></attribute>
		<attribute name="package"></attribute>
		<attribute name="verbose" default="true"></attribute>
		<attribute name="testcase" default="true"></attribute>
		<attribute name="wsdlDir" default="${gen.wsdl.dir}"></attribute>
		<attribute name="wsdlName" default="service.wsdl"></attribute>
		<attribute name="javaDir" default="${gen.java.folder}"></attribute>
		<element name="mapping.tag" optional="yes"></element>
		<sequential>
			<echo>@{wsdlName} to proxy: @{javaDir}</echo>
			<available file="@{wsdlDir}/@{wsdlName}" property="wsdl-exists"></available>
			<fail message="WSDL file not found: @{wsdlDir}/@{wsdlName}" unless="wsdl-exists"></fail>
			<mkdir dir="@{javaDir}"></mkdir>
			<axis-wsdl2java output="@{javaDir}" testcase="@{testcase}" verbose="@{verbose}" url="@{wsdlDir}/@{wsdlName}">
				<mapping namespace="@{namespace}" package="@{package}"></mapping>
				<mapping namespace="http://xml.apache.org/xml-soap" package="javax.activation"></mapping>
				<mapping.tag></mapping.tag>
			</axis-wsdl2java>
		</sequential>
	</macrodef>
	<!-- =================================================================== -->
	<!-- java2wsdl2stubs macro: -->
	<!-- =================================================================== -->
	<macrodef name="java2stubs.macro">
		<attribute name="namespace"></attribute>
		<attribute name="package"></attribute>
		<attribute name="classname"></attribute>
		<attribute name="verbose" default="true"></attribute>
		<attribute name="testcase" default="true"></attribute>
		<attribute name="methods" default=""></attribute>
		<attribute name="exclude" default="ejbCreate,ejbRemove,ejbActivate,ejbPassivate,setSessionContext"></attribute>
		<attribute name="style" default="RPC"></attribute>
		<attribute name="wsdlDir" default="${gen.wsdl.dir}"></attribute>
		<attribute name="wsdlName" default="service.wsdl"></attribute>
		<attribute name="javaDir" default="${gen.java.folder}"></attribute>
		<attribute name="location" default="http://${appserver.host}:${appserver.http.port}/${axis.context}/servlet/AxisServlet"></attribute>
		<element name="mapping.tag" optional="yes"></element>
		<sequential>
			<echo>@{classname} to @{wsdlName} to proxy: @{javaDir}</echo>
			<mkdir dir="@{wsdlDir}"></mkdir>
			<delete file="@{wsdlDir}/@{wsdlName}" failonerror="false"></delete>
			<!-- axis-java2wsdl requires a compiled class as input -->
			<mkdir dir="${build.classes.dir}"></mkdir>
			<javac destdir="${build.classes.dir}" classpathref="build.classpath" source="${compiler.source}" target="${compiler.target}" debug="${compiler.debug}" deprecation="${compiler.deprecation}" optimize="${compiler.optimize}" compiler="${compiler.type}" excludes="${compiler.excludes}">
				<src path="${src.java.dir}"></src>
				<src path="${gen.java.dir}"></src>
				<patternset refid="source.modifications.patternset"></patternset>
			</javac>
			<axis-java2wsdl classname="@{classname}" namespace="@{namespace}" exclude="@{exclude}" location="@{location}" style="@{style}" output="@{wsdlDir}/@{wsdlName}">
				<classpath refid="axis.classpath"></classpath>
			</axis-java2wsdl>
			<mkdir dir="@{javaDir}"></mkdir>
			<axis-wsdl2java output="@{javaDir}" testcase="@{testcase}" verbose="@{verbose}" url="@{wsdlDir}/@{wsdlName}">
				<mapping namespace="@{namespace}" package="@{package}"></mapping>
				<mapping.tag></mapping.tag>
			</axis-wsdl2java>
		</sequential>
	</macrodef>
	<!-- =================================================================== -->
	<!-- wsdl tasks: -->
	<!-- =================================================================== 
	JUNK:
	<target name="java2wsdl" depends="" description="gen WSDL from java">
		<axis-java2wsdl classname="com.javagen.codegen.ws.EchoAttachmentsWS" namespace="javagen.com/EchoAttachmentsWS" location="http://localhost:2233/axis/servlet/AxisServlet" style="RPC" output="${basedir}/EchoAttachmentsWS.wsdl"/>
	</target>
	<target name="wsdl2java" depends="" description="gen java stubs from WSDL">
		<mkdir dir="${build.webservice.dir}"/>
		<axis-wsdl2java output="${build.webservice.dir}" testcase="true" verbose="true" url="${basedir}/EchoAttachmentsWS.wsdl">
			<mapping namespace="javagen.com/EchoAttachmentsWS" package="com.javagen.codegen.ws.rpc"/>
		</axis-wsdl2java>
	</target>
	-->
	<!-- =================================================================== -->
	<!-- Check axis deploy.wsdd is uptodate with source -->
	<!-- =================================================================== -->
	<target name="axis.uptodate" depends="">
		<mkdir dir="${xdoclet.build.webservice.dir}"></mkdir>
		<uptodate property="axis-uptodate" targetfile="${xdoclet.build.webservice.dir}/deploy.wsdd">
			<srcfiles dir="${src.java.dir}" includes="**/*${xdoclet.axis.suffix}.java"></srcfiles>
			<srcfiles dir="${gen.java.dir}" includes="**/*${xdoclet.axis.suffix}.java"></srcfiles>
		</uptodate>
	</target>
	<!-- =================================================================== -->
	<!-- Generates axis wsdd
        NOT READY FOR PRIME TIME!!!!!!

        The Axis XDoclet code is immature at best.  I could not get a usable 
        deploy.wsdd using JPJO code.
	-->
	<!-- =================================================================== -->
	<target name="gen.axis" unless="axis-uptodate" depends="axis.uptodate" description="generate axis web service">
		<echo>AXIS: xdoclet.webservice.suffix = ${xdoclet.webservice.suffix}</echo>
		<ejbdoclet destdir="${build.classes.dir}" excludedtags="${xdoclet.excludedtags}" ejbspec="${ejb.spec.version}" force="${xdoclet.force}" mergedir="${xdoclet.merge.dir}">
			<fileset dir="${src.java.dir}">
				<include name="**/*${xdoclet.webservice.suffix}.java"></include>
			</fileset>
			<fileset dir="${gen.java.dir}">
				<include name="**/*${xdoclet.webservice.suffix}.java"></include>
			</fileset>
			<axisdeploy destDir="${xdoclet.build.webservice.dir}" validateXML="${xdoclet.validatexml}" prefixWithPackageStructure="false" mergedir="${xdoclet.merge.dir}"></axisdeploy>
			<axisundeploy destDir="${xdoclet.build.webservice.dir}" validateXML="${xdoclet.validatexml}" prefixWithPackageStructure="false"></axisundeploy>
		</ejbdoclet>
	</target>
</project>