Axis2/C Installation Guide

This document will guide you on how to install Axis2/C and run the server and client samples on Linux and Microsoft Windows operating systems.

This release comes in two forms, source and binary. Instructions are given below to install using any of those two forms.

Please send your feedback to the developer mailing list: axis-c-dev@ws.apache.org (please remember to prefix the subject with [Axis2]). To subscribe to developer mailing list see here

Installing and running on Linux

This can be done using binary or source distributions

To get both the binary and source distributions working, you need libxml2, which can be downloaded from here.

(NOTE: most Linux systems has libxml2 by default.)

1. Using binary release

The following steps need to be taken to install and run Axis2/C using binary distribution on Linux

1. Extract the binary tar package to a folder.

  • Set AXIS2C_HOME environment variable pointing to the location where you have extracted Axis2C
  • AXIS2C_HOME='/your_path_to_axis2c'
  • export AXIS2C_HOME

    Note: You will need to set AXIS2C_HOME only if you need to run axis2c samples or tests. The reason is

    that the samples and tests use the AXIS2C_HOME envioronment variable to locate the repository path. To write your own

    services or clients this would not be neccessary.

2. Run the simple axis server:

  • To start the simple axis server on default port 9090, run the following commands.
    • cd /your_path_to_axis2c/bin
    • ./axis2_http_server
  • To see the possible command line options run ./axis2_http_server -h
  • NOTE: If you run into shared lib problems, try setting the LD_LIBRARY_PATH
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_path_to_axis2c/lib

3. Run the sample clients in a new shell

  • cd /your_path_to_axis2c/bin/samples
  • to run client for echo service
    • ./echo
  • to run client for math service
    • ./math
  • To see the possible command line options for sample clients run them with '-h' option
  • NOTE: If you run into shared lib problems, try setting the LD_LIBRARY_PATH
    • export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/your_path_to_axis2c/lib

2. Using source release

The following steps need to be taken to install and run Axis2/C using source distribution on Linux

  1. Extract the source tar package to a folder.
  2. Set AXIS2C_HOME environment variable pointing to the location where you want to install Axis2C.
    • AXIS2C_HOME='/your_desired_path_to_axis2c_installation'
    • export AXIS2C_HOME
  3. Then go to the folder where you extracted the source
    • cd /your_path_to_axis2c_source
  4. Set parser location

    Include path and library path to parser should be set. For libxml2 this is automatically resolved by configure script.

  5. Build the source
    • This can be done using the following command sequence:
      • ./configure
      • make
      • make install
    • use './configure --help' for possible command line options.
    • NOTE: If you don't provide a --prefix configure option, it will by defaul install into /usr/local/axis2c folder.
    • If you need to get the samples working, you also need to build the samples.

      To build samples:

      • cd samples
      • ./configure --prefix=${AXIS2C_HOME}
      • make
      • make install
  6. Go to where you installed axis2c.
  7. Start simple axis server
    • To start the simple axis server on port 9090 run the following command lines
      • cd axis2c/bin
      • ./axis2_http_server
    • To see the possible command line options run ./axis2_http_server -h
  8. Run the sample clients in a new shell using the following command lines
    • cd bin/samples
    • to run client for echo service
      • ./echo
    • to run client for math service
      • ./math
    • To see the possible command line options for sample clients run them with '-h' option

Installing and running on Microsoft Windows (win32)

This too can be done using either binary or source distributions

For both the binary and source distributions, you need libxml2 from here.

(NOTE: most Linux systems has libxml2 by default. On Windows you need to download and install libxml2)

1. Using binary release

Requirements

  • The binaries shipped with this version is compiled with Microsoft visual studio compiler (cl)
  • (Note: you can download Microsoft VSExpress2005 edition from Microsoft web site and install it to run these binaries)

  • You also need the following dlls
    • libxml2.dll [http://www.xmlsoft.org - download the version >= libxml2-2.6.20.win32]
    • iconv.dll [http://www.xmlsoft.org - download the version >= iconv-1.9.1.win32]
    • zlib1.dll [http://www.xmlsoft.org - download the version >= zlib-1.2.3.win32]

Binaries in the release

  • Extract the binary distribution to a folder of your choice. (example: C:\axis2c)
  • The C:\axis2c folder structure is as follows:
  • Figure: c:\axis2c Folder Structure

    The above folders contain the following files:

    • bin - server and other executables
    • bin\samples - client samples go here
    • lib - library modules
    • services - deployed services
    • modules - deployed modules
    • include - all include files of Axis2 C
    • logs - system and client logs are written to this folder
  • Copy libxml2.dll, iconv.dll and zlib1.dll downloaded to C:\axis2c\lib

Running the binaries

  • First you need to set couple of environment variables before you can run the server and samples.
    • Set the varibale AXIS2C_HOME to the deploy folder (C:\axis2c)
    • Add the path to lib directory to PATH variable (%AXIS2C_HOME%\lib)
  • Now everything is set to run the server (C:\axis2c\bin\> axis2_http_server.exe)
  • If the server is running successfully you should see the message "Started Simple Axis2 HTTP Server..."
  • The log is by default created in %AXIS2C_HOME%\logs folder with the name axis2.log.
  • (Note: you may provide command line options to change the default behaviour. Use the command "axis2_http_server.exe -h" to learn about the usage)
  • Now you can run any sample client located in %AXIS2C_HOME%\bin\samples\
    • Example: C:\axis2c\bin\samples\> echo.exe

2. Using the source release.

Requirements

  • The makefile shipped with this version needs Microsoft visual studio compiler (cl) and nmake build tool
  • (Note: you can download Microsoft VSExpress2005 edition and Platform SDK from Microsoft web site. You will need to add the path to Platform SDK Include and Lib folders to makefile)

  • You also need
    • libxml2 [http://www.xmlsoft.org - download the version >= libxml2-2.6.20.win32]
    • iconv [http://www.xmlsoft.org - download the version >= iconv-1.9.1.win32]
    • zlib [http://www.xmlsoft.org - download the version >= zlib-1.2.3.win32]

Editing configure.in file

  • The default paths for libxml2 and iconv are speceficed in configure.in.
    • Example:Default location for libxml2 is C:\libxml2
  • You can either extract libxml2 to this folder, in which case folder structure for C:\libxml2 should look like the following.
  • Figure: C:\libxml2 Folder Structure

    Or extract to whatever place of your choice and edit the configure.in accordingly.

  • You need to have zlib1.dll in a library path. You may copy this dll to libxml2/lib.

Compiling the source.

The following steps will take you through the source compilation

  • Extract the source distribution to a folder of your choice. (Example: C:\axis2c)
  • Open a DOS shell
  • cd C:\axis2c\build\win32
  • to access .Net tools, run
    • C:\axis2c\build\win32> vcvars32.bat

    (Note: You may need to set the PATH environment variable to vcvars32.bat if windows complaints that it cannot find this bat)

  • build the system and create a directory named deploy under build directory:
    • C:\axis2c\build\win32>nmake install
  • The deploy folder structure is as follows:
  • Figure: deploy Folder Structure

    The above folders contain the following files:

    • bin - server and other executables
    • bin\samples - client samples
    • lib - library modules
    • services - deployed services
    • modules - deployed modules
    • include - all include files of Axis2 C
    • logs - system and client logs are written to this folder

Running the binaries

  • You need to set couple of environment variables before you can run the server and samples.
    • Set the variable AXIS2C_HOME to the deploy folder (C:\axis2c\build\deploy)
    • Add the path to lib directory to PATH variable (%AXIS2C_HOME%\lib)
    • Copy libxml2.dll, iconv.dll and zlib1.dll to axis2c lib folder (%AXIS2C_HOME%\lib)
  • Now run the server - C:\axis2c\build\deploy\bin> axis2_http_server.exe
  • If server is running successfully you should see the message "Started Simple Axis2 HTTP Server..."
  • The log is by default created under %AXIS2C_HOME%\logs folder with the name axis2.log.
  • (Note: you may provide command line options to change the default behaviour. Use the command "axis2_http_server.exe -h" to learn about the usage)
  • Now you can run any sample client deployed under %AXIS2C_HOME%\bin\samples\
    • Example: C:\axis2c\build\deploy\bin\samples> echo.exe

3. Installing Apache2 Web Server integration module (mod_axis2).

3.1 Building mod_axis2 from source tree

3.1.1 On Linux Platform

  • Provide the apache2 include files location as configure option ./configure --with-apache2="<apache2 include files location>" [other configure options] - Some apache2 distributions install APR (Apache Portable Runtime) include files in a seperate location which is requred to build mod_axis2. In that case use

    ./configure --with-apache2="<apache2 include files location>" --with-apr="<apr include files location>" [other configure options]

  • Then build the source tree

    make

    make install

    - This will install mod_axis2.so into your "<your_path_to_axis2c>/lib"

3.1.2 On Win32 platform

  • Provide the apache2 location in configure.in file in APACHE_INSTALL_DIR

    eg : APACHE_INSTALL_DIR = E:\Apache
  • After compiling the sources (as described in section 2) build the mod_axis2.dll by issuing the command "nmake axis2_apache_module".
  • This will build the mod_axis2.dll and copy it to %AXIS2C_HOME%\lib directory.

    eg: C:\axis2c\build\deploy\lib

3.2 Deploying in Apache2 Web Server

Note: To do the following tasks you might need super user privileges in your machine.

  • Copy the mod_axis2 (libmod_axis2.so.0.0.0 on Linux and mod_axis2.dll in Windows) to "<apache2 modules directory>" (eg: /usr/lib/apache2/modules in Linux or C:\Apache2\modules in Windows) as mod_axis2.so

    eg: cp $AXIS2C_HOME/lib/libmod_axis2.so.0.0.0 /usr/lib/apache2/modules/mod_axis2.so

    copy C:\axis2c\build\deploy\lib\mod_axis2.dll C:\Apache2\modules\mod_axis2.so

  • Edit the Apache2's configuration file (generally httpd.conf) and add the following directive
        LoadModule axis2_module <apache2 modules directory>/mod_axis2.so
        <Location /axis2>
            SetHandler axis2_module
            RepoPath <axis2 repository path>
            LogFile <axis2 log file path>
            Axis2LogLevel LOG_LEVEL
        </Location>    
        

    LOG_LEVEL can be one of following

    AXIS2_LOG_LEVEL_CRITICAL - Log critical errors only

    AXIS2_LOG_LEVEL_ERROR - Log errors critical errors

    AXIS2_LOG_LEVEL_WARNING - Log warnings and above

    AXIS2_LOG_LEVEL_INFO - Log info and above

    AXIS2_LOG_LEVEL_DEBUG - Log debug and above (default)

    AXIS2_LOG_LEVEL_TRACE - Log trace messages

  • Use forward slashes "/" for path seperators in <apache2 modules directory>, <axis2 repository path> and <axis2 log file path>
  • Make sure that the apache2 user has correct permissions to above paths

    - Read permission to the repository

    - Write permission to the log file
  • Restart apache2 and test whether mod_axis2 module is loaded by typing the URL http://localhost/axis2/services