14.2 build.xml脚本代码
在这里增加了详细的注释。基本覆盖了axis全部使用方式。
<?xml version="1.0" ?>
<!DOCTYPE project [
<!ENTITY properties SYSTEM "file:../xmls/properties.xml">
<!ENTITY paths SYSTEM "file:../xmls/path_refs.xml">
<!ENTITY taskdefs SYSTEM "file:../xmls/taskdefs.xml">
<!ENTITY taskdefs_post_compile SYSTEM "file:../xmls/taskdefs_post_compile.xml">
<!ENTITY targets SYSTEM "file:../xmls/targets.xml">
]>
<!-- ===================================================================
<description>
Component file for Axis
Notes:
This is a build file for use with the Jakarta Ant build tool.
Prerequisites:
jakarta-ant from http://jakarta.apache.org
Build Instructions:
To wsdl2java
ant wsdl2java
Author:
lanning thunder4393@gmail.com zhanglelei@channelsoft.com
Copyright:
Copyright (c) 2002-2003 Apache Software Foundation.
</description>
==================================================================== -->
<!-- ====================================================================
1. You may use service interface to generate wsdl and other code files with <target name="java2wsd">
2. You also may use wsdl to generate code files and wsdd file with <target name="java2wsd">
====================================================================
-->
<!-- basedir is a build-in properties, it may directly be ${basedir}-->
<project default="wsdl2java" basedir="." >
<property name="axis.home" location=".." />
<property name="app.name" value="axis" />
<property name="componentName" value="com/int97" />
<property name="dev.dir" location="${basedir}" />
<property name="dev.classes.dir" location="${axis.home}/webapps/axis/WEB-INF/classes" />
<path id="dev.classpath">
<pathelement path="${dev.classes.dir}"/>
</path>
<path id="axis.classpath">
<fileset dir="${axis.home}/webapps/axis/WEB-INF/lib">
<include name="**/*.jar" />
</fileset>
</path>
<path id="all.classpath">
<path refid="axis.classpath"/>
<pathelement location="${dev.classes.dir}" />
</path>
<!-- the <taskdef> declaration to declare all the tasks listed in a properties file
inside the axis-ant.jar file
other definition method:
<taskdef name="axis-java2wsdl" classname="org.apache.axis.tools.ant.wsdl.Java2WsdlAntTask"
loaderref="axis" >
<classpath refid="classpath.id"/>
</taskdef>
-->
<taskdef resource="axis-tasks.properties" classpathref="axis.classpath" />
&properties;
&paths;
&taskdefs;
&taskdefs_post_compile;
&targets;
<target name="clean"/>
<target name="copy" depends="setenv"/>
<!-- =================================================================== -->
<!-- Set relevant parameters for concrete application
for example:
1. set wsdl file name
2. set mapping's package name
3. wsdl2java's properties need to refer the axis docs -->
<!-- =================================================================== -->
<target name="wsdl2java">
<echo message="Generating java files from wsdl"/>
<wsdl2java url="${dev.dir}/OpenBusinessService.wsdl"
output="${dev.dir}"
deployscope="session"
serverSide="yes"
skeletonDeploy="yes"
noimports="no"
verbose="yes"
typeMappingVersion="1.1"
testcase="yes">
<mapping namespace="http://134.96.71.13:8080/axis/OpenBusinessService.wsdl" package="com.int97.webserviceclient"/>
</wsdl2java>
</target>
<!-- axis-java2wsdl is a taskdefing the public Axis taskdefs in the axis-tasks.properties-->
<target name="java2wsdl">
<echo message="Generating java files from wsdl"/>
<!-- <java2wsdl> is equal with <axis-java2wsdl>-->
<axis-java2wsdl output="${dev.dir}/OpenBusinessServiceTest.wsdl"
classname="com.int97.test.OpenBusinessService"
location="http://localhost:8080/axis/services/OpenBusinessService"
namespace="urn:OpenBusinessService"
style="RPC" >
<!-- classpath is neccesary, otherwise, <java2wsdl> won't find the class.
<classpath refid="all.classpath" /> -->
<classpath path="${dev.classes.dir}" />
</axis-java2wsdl>
</target>
<!-- Deprecated
<target name="compile" depends="copy">
<javac srcdir="${axis.home}" destdir="${build.dest}" debug="${debug}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}">
<classpath>
<path refid="classpath"/>
</classpath>
<include name="samples/addr/**/*.java"/>
<exclude name="samples/addr/*.java" />
<exclude name="samples/**/*SMTP*.java" unless="smtp.present" />
<exclude name="**/old/**/*.java" />
</javac>
<wsdl2java url="${axis.home}/samples/addr/AddressBook.wsdl"
output="${build.dir}/work"
deployscope="session"
serverSide="yes"
skeletonDeploy="yes"
noimports="no"
verbose="no"
typeMappingVersion="1.1"
testcase="no">
<mapping namespace="urn:AddressFetcher2" package="samples.addr"/>
</wsdl2java>
<copy todir="${build.dir}/work/samples/addr" overwrite="yes">
<fileset dir="${axis.home}/samples/addr">
<include name="Main.java"/>
<include name="DOMUtils.java"/>
<include name="AddressBookSOAPBindingImpl.java"/>
</fileset>
</copy>
Compile the echo sample generated java files
<javac srcdir="${build.dir}/work" destdir="${build.dest}" debug="${debug}" nowarn="${nowarn}" source="${source}" fork="${javac.fork}">
<classpath refid="classpath" />
<include name="samples/addr/**.java" />
</javac>
</target>
-->
<!-- Use this file to undeploy some handlers/chains and services
-->
<!-- Two ways to do this:
-->
<!--
java org.apache.axis.client.AdminClient undeploy.wsdd -->
<!--
after the axis server is running -->
<!-- or
-->
<!--
java org.apache.axis.utils.Admin client|server undeploy.wsdd -->
<!--
from the same directory that the Axis engine runs -->
<!-- ???AdminService is setted in the server-config.wsdd, it's class is
org.apache.axis.utils.Admin
servletpath the path to the AxisAdmin servlet
url full url to the admin endpoint
-->
<target name="deploy">
<axis-admin port="8080" hostname="localhost" failοnerrοr="true"
servletpath="${app.name}/services/AdminService" debug="true"
xmlfile="${basedir}/deploy.wsdd" />
</target>
<target name="undeploy">
<axis-admin port="8080" hostname="localhost" failοnerrοr="true"
servletpath="${app.name}/services/AdminService" debug="true"
xmlfile="${basedir}/undeploy.wsdd" />
</target>
<!--<target name="run"/> -->
<!-- <target name="undeploy"/> -->
<!-- ============================================
Reference Resource
============================================
target name="j2w-nicethingsbean">
<axis-java2wsdl classname="samples.ejb.NiceThingsBean"
methods="sayHello,findNiceThingsFor,updateNiceThingsFor"
output="nicethings.wsdl"
location="http://localhost:8080/axis/services/NiceThingsBean"
namespace="http://localhost:8080/axis/services/NiceThingsBean"
namespaceImpl=
"http://localhost:8080/axis/services/NiceThingsBean">
<complextype classname="samples.ejb.NiceThings"
namespace="urn:NiceThingsBean"/>
< You can also pass in another serializer/deserializer if you don't want to use the default
BeanSerializerFactory for a particular complextype
serializer="org.apache.axis.encoding.ser.BeanSerializerFactory"
deserializer="org.apache.axis.encoding.ser.BeanDeserializerFactory" >
</axis-java2wsdl>
</target>
-->
</project>