Using modules in Axis2

Source: Internet
Author: User

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;
   }
}

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.