What is an Axis2 Repository?
By Eran Chinthaka
- 29 Dec, 2008
Axis2 is a Web services engine that has various tools and features needed to work effectively with Web services. To carry out all these tasks, it needs a place to store all its static configurations, deployed services, modules, etc. The Axis2 repository is the place it keeps all the important files for consumption. You can also access the repository to manually deploy by copying your service and modules to the proper location, so that Axis2 will pick them up. In this tutorial we will look at what is kept inside the repository, and how to create and use a custom repository.
|Version||1.3 or later|
Table of Contents
The Axis2 repository contains primarily Web service archive files, module archive files and Axis2 configuration files.
Service Archive Files
As a Web service engine, Axis2 provides a way to support the deployment of Web services, which can be packaged into a service archive for easier deployment. Axis2 will put all the services that are deployed inside its repository, with service archive files being kept within the services folder.
Axis2 supports hot deployment of Axis2 services (unless you explicitly turn this feature off). You just need to copy the new service archive file into $REPOSITORY_LOCATION\services and it will automatically deployed to Axis2.
Module Archive Files
Axis2 supports extensions to message processing using Axis2 modules. These modules are also used to implement WS-* specifications such as WS-Addressing, WS-Security, etc. The archive files for these modules, also known as .mar files, are kept inside the Axis2 repository, under the modules folder.
If you engage a module during any of your invocations, Axis2 will look for a module file within the repository with the same name you used to engage the module. If you want to use any of the modules, make sure the relevant module is available inside your module folder in the repository.
The most important system level, static configurations are kept inside the axis2.xml. Axis2 will read this file to get its initial configuration when it starts up. This configuration file is normally kept inside the Axis2 repository, under the conf folder.
You can create a repository without a conf\axis2.xml file. In that case, Axis2 will use the default axis2.xml as the configuration file.
If you are using Axis2 as a web application deployed inside a servlet container, you should be able to see it inside axis2 web application. This might change depending on the servlet container you use. If you are using Apache Tomcat, it will be inside $TOMCAT_HOME\webapps\axis2\WEB-INF folder. But if you are using Axis2 as a client, then by default there is not an Axis2 repository. If you want to use custom modules, you first need to create a custom Axis2 repository and pass its location to Axis2. This process is described in the next section.
To use your own Axis2 repository, you first need to setup a folder structure like the following:
$REPOSITORY_ROOT | |-- services | |-- (services archive files here) |-- modules | |-- (module archive files here) |-- conf | |-- axis2.xml
Once you do this, you need to inform Axis2 of the location of the repository. There are three ways you can do this:
- Set "axis2.repo" system property with the location of your repository ($REPOSITORY_ROOT) - Once you set this property and start or use Axis2, Axis2 will consider this to be your repository.
- Create an instance of ConfigurationContext object with a reference to the repository and use it. The location of the repository can be a file location or a URI. You can use either
Note: If you use a remote repository, hot deployment will not work and you will have to maintain services.list file listing the services in it and a modules.list file listing the modules in it. For more information on using remote repositories, read the article "Starting Axis2 Using a Remote Repository".
- Add a parameter to axis2.xml and pass the location of the axis2.xml - You can create a pointer to Axis2 repository inside axis2.xml by placing the following parameter inside it.
<parameter name="repository">location of the repository</parameter>
In this article we examined the importance of the Axis2 repository. We looked at what can be found inside the repository and, more importantly, how we can create our own repository for use it within our applications.
- Starting Axis2 Using a Remote Repository
- To understand different ways of creating ConfigurationContext object, read "Different Ways of Creating a ConfigurationContext in Axis2"
About the Author
Eran Chinthaka is a pioneering contributor to Apache Axis2, Apache Axiom, and Apache Synapse projects as well as WSO2 WSAS. He is a member of ASF and a PMC Member of the Apache WS project. He also serves on the WS-Addressing and WSDL 2.0 working groups of W3C. Eran is currently at Indiana University reading for his PhD.