axis-java-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Barry Lulas <Barry.Lu...@BristolWest.com>
Subject RE: Complete ant script?
Date Mon, 28 Oct 2002 21:02:47 GMT
thank you very much, this is very helpful!

-----Original Message-----
From: Jens Riboe [mailto:jens.riboe@ribomation.com]
Sent: Monday, October 28, 2002 3:48 PM
To: axis-user@xml.apache.org
Subject: SV: Complete ant script?


Hi Barry,

I have an Ant script that, based on a service interface,
generates the WSDL and then from that generates the server as well as client
side classes.

Here is a copy of the relevant parts of the script

=============================================
<?xml version="1.0" ?>

<project name="PerformanceTest" default="usage" basedir=".">

    <!--
****************************************************************************
******  -->
    <!--  PLEASE, SET THE EXTERNAL PROPERTIES BELOW -->
    <!--
****************************************************************************
******  -->
    <!-- External path properties -->
    <property name="jdk.dir"                  value="F:/Java/jdk-1.4.1" />
    <property name="tomcat.dir"               value="F:/Apache Group/Tomcat
4.1" />

    <!-- Tomcat properties -->
    <property name="tomcat.manager"
value="http://localhost:8080/manager" />
    <property name="username"                 value="admin" />
    <property name="password"                 value="admin" />
    <!--
****************************************************************************
******  -->


    <property name="jdk.bin"                  value="${jdk.dir}/bin" />
    <property name="tomcat.webapps"           value="${tomcat.dir}/webapps"
/>
    <property name="tomcat.lib"
value="${tomcat.dir}/common/lib" />


    <!-- Name properties -->
    <property name="version"                  value="2002-10-25" />
    <property name="package.base"
value="com.your.company.name.here" />
    <property name="serviceName"
value="YourServiceInterfaceHere" />


    <!-- Dir properties -->
    <property name="out"                      value="build" />
    <property name="java.src"                 value="src/java" />
    <property name="java.out"                 value="${out}/classes" />
    <property name="java.gen"                 value="${out}/gensrc/java" />

    <property name="conf.src"                 value="src/conf" />
    <property name="conf.gen"                 value="${out}/gensrc/conf" />

    <property name="jsp.src"                  value="src/jsp" />
    <property name="lib"                      value="lib" />
    <property name="tmp"                      value="${out}/tmp" />

    <property name="webapp.name"              value="${serviceName}" />
    <property name="webapp.out"               value="${out}/webapp" />
    <property name="webapp.inf"               value="${webapp.out}/WEB-INF"
/>
    <property name="webapp.classes"           value="${webapp.inf}/classes"
/>
    <property name="webapp.lib"               value="${webapp.inf}/lib" />
    <property name="webapp.file"
value="${out}/${webapp.name}.war" />

    <!-- Class path -->
    <path id="class.path">
        <pathelement location="${java.out}" />
        <fileset dir="lib"> <include name="**/*.jar"/> </fileset>
    </path>


    <!-- External Ant Tasks. You need catalina-ant.jar, which can be found
within Tomcat   -->
    <taskdef name="deploy"
classname="org.apache.catalina.ant.DeployTask"
classpathref="class.path" />
    <taskdef name="undeploy"
classname="org.apache.catalina.ant.UndeployTask"
classpathref="class.path" />
    <taskdef name="list"        classname="org.apache.catalina.ant.ListTask"
classpathref="class.path" />
    <taskdef name="start"
classname="org.apache.catalina.ant.StartTask"
classpathref="class.path" />
    <taskdef name="stop"        classname="org.apache.catalina.ant.StopTask"
classpathref="class.path" />



    <!--
============================================================================
=========
        Target: mk.build.dir
        Creates the build directory and its subdirs
    -->
    <target name="mk.build.dir">
        <mkdir dir="${out}" />
        <mkdir dir="${java.out}" />
        <mkdir dir="${java.gen}" />
        <mkdir dir="${conf.gen}" />
        <mkdir dir="${apidoc.out}" />
        <mkdir dir="${srcdoc.out}" />
        <mkdir dir="${tmp}" />
    </target>


    <!--
============================================================================
=========
        Target: init
        Sets the timestamp
    -->
    <target name="init" depends="mk.build.dir" >
        <tstamp/>
    </target>


    <!--
============================================================================
=========
        Target: clean
        Removes all generated files, as *.class, *.html, *.jar, ...
    -->
    <target name="clean" description="Removes all generated files, as
*.class, *.html, *.jar, ..." >
        <delete dir="build"  quiet="true" />
    </target>


    <!--
============================================================================
=========
        Target: generate.axis.files
        Generates AXIS files, such as Java stubs and skels, deploy.wsdd and
creates a
        server-config.wsdd ready to be put into a WAR.
    -->
    <target name="generate.axis.files"
        depends="init"
        description="Generates AXIS files, such as Java stubs and skels" >
        <!-- Generate a WSDL based on the business interface
DataTransport -->
        <java classname="org.apache.axis.wsdl.Java2WSDL"
classpathref="class.path" fork="true">
            <arg line="--output ${conf.gen}/${serviceName}.wsdl" />
            <arg line="--location
http://localhost:8080/${webapp.name}/services/${serviceName}" />
            <arg line="${package.base}.shared.${serviceName}" />
        </java>

        <!-- Generate Java stubs and skels, plus *.wsdd, based on the WSDL
generated above -->
        <java classname="org.apache.axis.wsdl.WSDL2Java"
classpathref="class.path" fork="true">
            <arg line="--output ${java.gen}" />
            <arg line="--deployScope Session" />
            <arg line="--server-side" />
            <arg line="--skeletonDeploy true" />
            <arg line="--package ${package.base}.shared.jaxrpc" />
            <arg line="--testCase" />
            <arg line="${conf.gen}/${serviceName}.wsdl" />
        </java>

        <!-- Delete the generated servant implementation, because we alread
have one we want to keep -->
        <delete quiet="false" verbose="true">
            <fileset dir="${java.gen}" includes="**/*Impl.java"/>
        </delete>

        <!-- Move the *.wsdd file to the conf directory -->
        <move toDir="${conf.gen}" flatten="true">
            <fileset dir="${java.gen}" includes="**/*.wsdd"/>
        </move>

        <!-- Make a copy of deploy.wsdd, so we can perform regexp
substitution on it -->
        <copy file="${conf.gen}/deploy.wsdd" tofile="${conf.gen}/deploy.txt"
overwrite="true"  />

        <!-- Extract the service section, that means remove all text outside
the <service> tag -->
        <replaceregexp flags="s" file="${conf.gen}/deploy.txt" >
            <regexp pattern="^(.*)([^a-z]service name=.+/service\>)(.*)$" />
            <substitution expression="\2" />
        </replaceregexp>

        <!-- Read in the content of the text file from above, into a local
property XXX -->
        <loadfile srcfile="${conf.gen}/deploy.txt" property="XXX"
failonerror="true" />

        <!-- Replace the token @WEBSERVICES@ with the <service> text we just
read, and put the result in conf -->
        <copy file="${conf.src}/server-config.wsdd"
tofile="${conf.gen}/server-config.wsdd" filtering="true" overwrite="true" >
            <filterset>
                <filter token="WEBSERVICES" value="${XXX}" />
            </filterset>
        </copy>

        <!-- Delete the now obsolete text file -->
        <delete file="${conf.gen}/deploy.txt" />
    </target>



    <!--
============================================================================
=========
        Target: compile
        Compiles all Java code
    -->
    <target name="compile"
            depends="init"
            description="Compiles all Java code" >
        <mkdir dir="${java.out}" />
        <javac destdir="${java.out}" deprecation="on">
            <classpath refid="class.path" />
            <src path="${java.src}" />
            <src path="${java.gen}" />
        </javac>
    </target>



    <!--
============================================================================
=========
        Target: build.war
        Creates a Web ARchive for the (Apache Axis) web application
    -->
    <target name="build.war"
        description="Creates a WebARchive for the Apache Axis web
application">
        <property name="war.file" value="${webapp.file}" />
        <delete file="${war.file}" quiet="yes" />

        <war destfile="${war.file}" webxml="${conf.src}/web.xml" >
            <webinf dir="${conf.gen}" >
                <include name="server-config.wsdd" />
            </webinf>
            <classes dir="${java.out}">
                <include name="**/*.class" />
                <exclude name="**/client/*.class" />
            </classes>
            <lib dir="${lib}" >
                <include name="**/*.jar" />
                <exclude name="**/servlet.jar"/>
                <exclude name="**/jaxrpc.jar"/>
                <exclude name="**/saaj.jar"/>
                <exclude name="**/*-ant.jar"/>
            </lib>
            <fileset dir="src/web" />
        </war>
    </target>


    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         + Target: tomcat.list
         + Lists all deployed webapps at the local tomcat server
         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <target name="tomcat.list" description="Lists all deployed webapps at
the local tomcat server">
       <echo message="Listing the applications...."/>
       <list
           url="${tomcat.manager}"
           username="${username}"
           password="${password}" />
    </target>


    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         + Target: webapp.deploy
         + Deploys the webapp (use first time, then redeploy)
         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <target name="webapp.deploy" description="Deploys the webapp (use first
time, then redeploy)">
        <deploy
            url="${tomcat.manager}"
            username="${username}"
            password="${password}"
            path="/${webapp.name}"
            war="file:${webapp.file}"
        />
    </target>


    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         + Target: webapp.undeploy
         + Undeploys the webapp
         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <target name="webapp.undeploy" description="Undeploys the webapp">
        <undeploy
            url="${tomcat.manager}"
            username="${username}"
            password="${password}"
            path="/${webapp.name}"
        />
    </target>


    <!-- ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
         + Target: webapp.redeploy
         + Undeploys and deploys the webapp
         ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ -->
    <target name="webapp.redeploy" description="Undeploys and deploys the
webapp">
        <antcall target="webapp.undeploy" />
        <antcall target="webapp.deploy" />
    </target>

</project>
=============================================

Regards / jens

-------------------------------------------------------
Jens Riboe
-------------------------------------------------------
Email : jens.riboe@ribomation.com
-------------------------------------------------------

-----Ursprungligt meddelande-----
Från: Barry Lulas [mailto:Barry.Lulas@BristolWest.com]
Skickat: den 28 oktober 2002 21:20
Till: 'axis-user@xml.apache.org'
Ämne: Complete ant script?


Does anyone have a complete ant script for building a web service with Axis?
There are small snippets out there, but if anyone has a complete script I
would love to see it.

Barry
-----Original Message-----
From: RKumar [mailto:rkumar@digev.com]
Sent: Monday, October 28, 2002 3:16 PM
To: axis-user@xml.apache.org
Subject: RE: Problem running Axis on Tomcat 4.1.12...


I have the name as Axis , but still it doesn't work.
Kumar
-----Original Message-----
From: Barry Lulas [mailto:Barry.Lulas@BristolWest.com]
Sent: Monday, October 28, 2002 12:06 PM
To: 'axis-user@xml.apache.org'
Subject: RE: Problem running Axis on Tomcat 4.1.12...


I found my own problem.  In the Axis documentation it states that you need
to create a subdirectory under the Tomcat webapps directory and you can name
it anything you want.  I named my subdirectory myws, rather than axis, and
this is what caused the exception.  I renamed it back to axis and everything
works fine.  Is this hard coded somewhere?  All my commands pointed to the
correct subdirectory...
-----Original Message-----
From: Barry Lulas [mailto:Barry.Lulas@BristolWest.com]
Sent: Monday, October 28, 2002 2:33 PM
To: 'axis-user@xml.apache.org'
Subject: Problem running Axis on Tomcat 4.1.12...


I think I have a problem with the way I have installed Axis on Tomcat
4.1.12.  All the rest of the validations checkout, but when I try to run the
AdminServlet I get the following Tomcat exception.  I checked the Tomcat
installation and the AdminServlet is NOT in the listed directory, but I
can't find it anywhere in the Axis installation.  Am I missing some
installation steps here?
HTTP Status 404 - /axis/servlet/AdminServlet
type Status report
message /axis/servlet/AdminServlet
description The requested resource (/axis/servlet/AdminServlet) is not
available.
Apache Tomcat/4.1.12


Mime
View raw message