1. Module
AXIS2 provides an extended support for the module. We now customize a module and deploy it to the myservice we created earlier. Deploy a custom module for a given Web service with the following steps:
1) To establish module implementation.
2) Create handlers.
3) Modify "Axis2.xml".
4 Modify "Services.xml" to make your module effective during the deployment period.
5 Package it as a ". Mar" (Module Archive).
6 Deploy this module on the Axis2.
2. Add a log module for MyService
Now we add a log module to our example program. This module contains a handle to record all the information passed to it. Axis2 use ". Mar "(module Archive) to deploy modules. The following illustration shows a file structure that needs to be packaged as a ". Mar" document.
Step One: Log Module class
The log module is the implementation class of the Axis2 module. The Axis2 module should implement the following methods in the "Org.apache.axis2.modules.Module" interface.
public void init(ConfigurationContext configContext, AxisModule module)
throws AxisFault;//Initialize the module
public void shutdown(AxisConfiguration axisSystem)
throws AxisFault;//End of module processing
public void engageNotify(AxisDescription axisDescription) throws AxisFault;
These methods can be used to control initialization and termination of the module. Through the parameter axisconfiguration, can provide the complete configuration level to the user. The module designer can use it to well control all possible operations of the module. In the case of this simple log service, we can implement these classes in space.
Loggingmodule.java
package userguide.loggingmodule;
import org.apache.axis2.AxisFault;
import org.apache.axis2.context.ConfigurationContext;
import org.apache.axis2.description.AxisDescription;
import org.apache.axis2.description.AxisModule;
import org.apache.axis2.modules.Module;
public class LoggingModule implements Module {
// initialize the module
public void init(ConfigurationContext configContext, AxisModule module) throws AxisFault {}
public void engageNotify(AxisDescription axisDescription) throws AxisFault {}
// shutdown the module
public void shutdown(ConfigurationContext configurationContext) throws AxisFault {}
public String[] getPolicyNamespaces() {
return null;
}
}