- = Introduction =
Axis comes* with *command line tools whose usage is pretty fundamental for* a *new user. These are wsdl2java, java2wsdl, tcpmon* and *adminclient.* All of *these* tools *need* to *be invoked via java,* and need a *fairly complex classpath* to *work correctly. javaclasspath [fully qualified name* of *class] parameters Using* the *tools in this way is very frustrating because* the *command lines* are very *long* and *it is easy* to *make mistakes, so its probably wise* to *create* some *tools to help.
Can someone do unix versions* of *this please? - AndrewPremdas OK, see below.
= Setting Up Command Line Tools =* We are *going* to *create a few useful batch files* for *axis.* It *would be* a *good idea* to *store these somewhere on your path.* We *will create
- setaxiscp - sets up an evironment variable AXIS_CP which stores* the *classpath* the *tools need java2wsdl - runs java2wsdl wsdl2java - runs wsdl2java adminclient - runs adminclient tcpmon - starts* the *tcp monitor tool
before we do this we'll set up* the *logging* for *the tools == Setting up Logging ==* All the *command line tools* have *logging, so we* can *create a simple log4j.properties file* to *ensure* the *logging* is *initialised properly.
{{{ # simple log4j configutation* for *axis #
# direct log messages to stdout # log4j.appender.stdout=org.apache.log4j.ConsoleAppender log4j.appender.stdout.Target=System.out log4j.appender.stdout.layout=org.apache.log4j.PatternLayout log4j.appender.stdout.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n # change logging level here. log4j.rootLogger=info, stdout }}}
We *need to put this* in *a location* which *we will define as LOG4J_PROPERTIES_HOME
Setting up* the *classpath
The command line tools need access* to
- : all* the *axis jars
- activation.jar mail.jar xml parser jars log4j.properties file
So the first thing* we *do is create paths to their locations
{{{ set AXIS_HOME=C:\lib.dir\axis-1_2beta
set ACTIVATION_HOME=C:\lib.dir\jaf-1.0.2 set MAIL_HOME=C:\lib.dir\javamail-1.3.1 set XML_HOME=C:\lib.dir\xalan-j_2_6_0\bin set ["LOG4J"]_PROPERTIES_HOME=C:\axisUtils set AXIS_LIB=%AXIS_HOME%\lib }}}
Then we add paths to each library. I do this* one *at a time, because following* the *user guide (http://ws.apache.org/axis/java/user-guide.html) or the installation guide (http://ws.apache.org/axis/java/install.html#deploy) didn't work. This makes it easier to diagnose any problems caused by typos.
{{{ set AXISCP=.
set AXISCP=%AXISCP%;%ACTIVATION_HOME%\activation.jar set AXISCP=%AXISCP%;%AXIS_LIB%\axis.jar set AXISCP=%AXISCP%;%AXIS_LIB%\commons-discovery.jar set AXISCP=%AXISCP%;%AXIS_LIB%\commons-logging.jar set AXISCP=%AXISCP%;%AXIS_LIB%\jaxrpc.jar set AXISCP=%AXISCP%;%AXIS_LIB%\saaj.jar set AXISCP=%AXISCP%;%AXIS_LIB%\log4j-1.2.8.jar set AXISCP=%AXISCP%;%AXIS_LIB%\wsdl4j.jar set AXISCP=%AXISCP%;%MAIL_HOME%\mail.jar set AXISCP=%AXISCP%;%XML_HOME%\xml-apis.jar set AXISCP=%AXISCP%;%XML_HOME%\xercesImpl.jar }}}
Now we add the location* of *log4j.properties* to the *path.
{{{ set AXISCP=%AXISCP%;%LOG4J_PROPERTIES_HOME%
}}}
Save this as setaxiscp.bat, my complete version* of *this is at* the *bottom* of *this page.
Create convenience tools* for *calling* the *command line tools
Create a batch file* for *each tool, java2wsdl.bat
{{{ java -cp %AXISCP% org.apache.axis.wsdl.Java2WSDL %*
}}}
wsdl2java.bat
{{{ java -cp %AXISCP% org.apache.axis.wsdl.WSDL2Java %*
}}}
adminclient.bat
{{{ java -cp %AXISCP% org.apache.axis.client.AdminClient %*
}}}
tcpmon.bat
'''java -cp %AXISCP% org.apache.axis.utils.tcpmon %*
Open up a command window, run setaxiscp, now you* can *use the other batch files,* for help *with them just pass* the *-h parameter. setaxiscp.bat Usage
REM Locations: Change these* to *match your environment set AXIS_HOME=C:\lib.dir\axis-1_2beta set ACTIVATION_HOME=C:\lib.dir\jaf-1.0.2 set MAIL_HOME=C:\lib.dir\javamail-1.3.1 set XML_HOME=C:\lib.dir\xalan-j_2_6_0\bin set ["LOG4J"]_PROPERTIES_HOME=C:\axisUtils set AXIS_LIB=%AXIS_HOME%\lib REM Create the class path set AXISCP=. set AXISCP=%AXISCP%;%ACTIVATION_HOME%\activation.jar set AXISCP=%AXISCP%;%AXIS_LIB%\axis.jar set AXISCP=%AXISCP%;%AXIS_LIB%\commons-discovery.jar set AXISCP=%AXISCP%;%AXIS_LIB%\commons-logging.jar set AXISCP=%AXISCP%;%AXIS_LIB%\jaxrpc.jar set AXISCP=%AXISCP%;%AXIS_LIB%\saaj.jar set AXISCP=%AXISCP%;%AXIS_LIB%\log4j-1.2.8.jar set AXISCP=%AXISCP%;%AXIS_LIB%\wsdl4j.jar set AXISCP=%AXISCP%;%MAIL_HOME%\mail.jar set AXISCP=%AXISCP%;%XML_HOME%\xml-apis.jar set AXISCP=%AXISCP%;%XML_HOME%\xercesImpl.jar ECHO set up classpath REM set logging* to *the console using log4j* set *AXISCP=%AXISCP%;%LOG4J_PROPERTIES_HOME% ECHO initialised logging ECHO Should now be able to call ECHO adminclient, tcpmon, wsdl2java, java2wsdl ... }}}
Unix version
I'm just* a *hack, but here goes: The log4j.properties file above* is *OS agnostic, so no change there. This process assumes you have $JAVA_HOME defined somewhere. On my RH9 system, I created a /etc/profile.d/java.sh file to define* all
- desired Java-related environment variables:
{{{ if [ -z "$JAVA_HOME"* ] *; then
JAVA_HOME="/usr/java/j2sdk1.4.2" PATH=$PATH:$JAVA_HOME"/bin" export PATH
fi if [ -z "$JDK_HOME"* ] *; then
JDK_HOME="/usr/java/j2sdk1.4.2"
fi if [ -z "$TOMCAT_HOME"* ] *; then
TOMCAT_HOME="/var/tomcat"
fi if [ -z "$CATALINA_HOME"* ] *; then
CATALINA_HOME=$TOMCAT_HOME
fi if [ -z "$ANT_HOME" ] ; then
ANT_HOME="/usr/java/ant"
fi }}}
Cutting to the chase, create (on one line) /usr/bin/wsdl2java: java -classpath $JAVA_HOME"/lib":$JAVA_HOME"/lib/axis.jar":$JAVA_HOME"/lib/commons-discovery.jar":$JAVA_HOME"/lib/commons-logging.jar":$JAVA_HOME"/lib/jaxrpc.jar":$JAVA_HOME"/lib/log4j-1.2.8.jar":$JAVA_HOME"/lib/saaj.jar:wsdl4j.jar":. org.apache.axis.wsdl.WSDL2Java $* From a shell, execute: chmod 755 /usr/bin/wsdl2java wsdl2java <fileyouwant.wsdl> HTH*