In Axis2, there are three kinds of configuration files to configure the system. The first one is to configure the whole system (global configuration), the second one is to configure a service (service configuration), and the third one is to configure a module (module configuration). This document explains the above configurations in detail.
<parameter name="name of the parameter" >parameter value </parameter>
<transportReceiver name="http" class="org.apache.axis2.transport.http.SimpleHTTPServer"> <parameter name="port" >6060</parameter> </transportReceiver>
<transportSender name="http" class="org.apache.axis2.transport.http.CommonsHTTPTransportSender"> <parameter name="PROTOCOL" locked="xsd:false">HTTP/1.0</parameter> </transportSender>name: Name of the transport (you can have HTTP and HTTP1 as the transport name) class: Implementation class of the corresponding transport. Just like the transport receivers, transport senders can have zero or more parameters, and if there are any, they can be accessed via the corresponding transport sender.
<phaseOrder type="InFlow"> <phase name="TransportIn"/> . . </phaseOrder>The most interesting thing is that you can add handlers here as well. If you want to add a handler that should go into that phase, you can directly do that by adding a handler element into it. In addition to that, there is no hard coding work for the handler chain anywhere in Axis2 (at any Axis*). So all those configurations are also done in the phase order element. The complete configurations will look as follows:
<phaseOrder type="InFlow"> <!-- Global phases --> <phase name="Transport"> <handler name="RequestURIBasedDispatcher" class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"> <order phase="Transport"/> </handler> <handler name="SOAPActionBasedDispatcher" class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"> <order phase="Transport"/> </handler> </phase> <phase name="Security"/> <phase name="PreDispatch"/> <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> <handler name="AddressingBasedDispatcher" class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"> <order phase="Dispatch"/> </handler> <handler name="SOAPMessageBodyBasedDispatcher" class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"> <order phase="Dispatch"/> </handler> <handler name="InstanceDispatcher" class="org.apache.axis2.engine.InstanceDispatcher"> <order phase="Dispatch"/> </handler> </phase> <!-- Global phases --> <!-- After the Dispatch phase module author or service author can add any phase he wants --> <phase name="OperationInPhase"/> </phaseOrder> <phaseOrder type="OutFlow"> <!-- user can add his own phases to this area --> <phase name="OperationOutPhase"/> <!-- Global phases --> <!-- these phases will run irrespective of the service --> <phase name="MessageOut"/> <phase name="PolicyDetermination"/> </phaseOrder> <phaseOrder type="InFaultFlow"> <phase name="PreDispatch"/> <phase name="Dispatch" class="org.apache.axis2.engine.DispatchPhase"> <handler name="RequestURIBasedDispatcher" class="org.apache.axis2.dispatchers.RequestURIBasedDispatcher"> <order phase="Dispatch"/> </handler> <handler name="SOAPActionBasedDispatcher" class="org.apache.axis2.dispatchers.SOAPActionBasedDispatcher"> <order phase="Dispatch"/> </handler> <handler name="AddressingBasedDispatcher" class="org.apache.axis2.dispatchers.AddressingBasedDispatcher"> <order phase="Dispatch"/> </handler> <handler name="SOAPMessageBodyBasedDispatcher" class="org.apache.axis2.dispatchers.SOAPMessageBodyBasedDispatcher"> <order phase="Dispatch"/> </handler> <handler name="InstanceDispatcher" class="org.apache.axis2.engine.InstanceDispatcher"> <order phase="Dispatch"/> </handler> </phase> <!-- user can add his own phases to this area --> <phase name="OperationInFaultPhase"/> </phaseOrder> <phaseOrder type="OutFaultFlow"> <!-- user can add his own phases to this area --> <phase name="OperationOutFaultPhase"/> <phase name="PolicyDetermination"/> <phase name="MessageOut"/> </phaseOrder>
<phase name="Transport"/>
<module ref="addressing"/>
<listener class="org.apache.axis2.ObserverIMPL"> <parameter name="RSS_URL" >http://127.0.0.1/rss</parameter> </listener>
<service name="name of the service" scope="name of the scope" class="full qualifide name the service lifecycle class" targetNamespace="target namespase for the service"> <description> The description of the service </description> <transports> <transport>HTTP</transport> </transports> <schema schemaNamespace="schema namespace"/> <messageReceivers> <messageReceiver mep="http://www.w3.org/2004/08/wsdl/in-out" class="org.apache.axis2.rpc.receivers.RPCMessageReceiver"/> </messageReceivers> <parameter name="ServiceClass" locked="xsd:false">org.apache.axis2.sample.echo.EchoImpl</parameter> <operation name="echoString" mep="operation MEP"> <actionMapping>Mapping to action</actionMapping> <module ref=" a module name "/> <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> </operation> </service>
targetNamespace: (Optional Attribute) Target name space of the service. This value will be used when generating the WSDL. If you do not specify this value, the value will be calculated from the package name of the service impl class.
description: (Optional) If you want to display any description about the service via Axis2 web-admin module, then the description can be specified here.
transports : (Optional) The transports to which the service is going to be exposed. If the transport element is not present, then the service will be exposed in all the transports available in the system. The transport child element specifies the transport prefix (the name of the transport specified in axis2.xml).
parameters: A services.xml can have any number of top level parameters and all the specified parameters will be transformed into service properties in the corresponding AxisService. There is a compulsory parameter in services.xml called ServiceClass that specifies the Java class, which performs the above transformation. This class is loaded by the MessageReceiver.
operations : If the service impl class is Java, then all the public methods in that service will be exposed. If the user wants to override it, he has to add the "operation" tag and override it. In a non-Java scenario or if you do not have a service class, then all the operations the user wants to expose by the service has to be indicated in the services.xml. It is specified as follows:
<operation name="echoString"> <module ref=" a module name "/> <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> </operation>
The only compulsory attribute here is "name", which represents the
operation name that is going to be exposed. Any operation can contain module
references as well as any number of parameters. The most interesting thing is
that you can register custom message receivers per operation. Then the
registered message receiver will be the message receiver for the
corresponding operation. If you do not specify the message receiver, then the
default message receiver will perform the operation.
A very simple module.xml is shown below:
<module class="org.apache.module.Module1Impl"> <InFlow> . . </InFlow> <OutFlow> . . </OutFlow> <OutFaultFlow> . . </OutFaultFlow> <InFaultFlow> . . </InFaultFlow> <operation name="creatSeq" mep="MEP_URI_IN_OUT"> <messageReceiver class="org.apache.axis2.receivers.RawXMLINOutMessageReceiver"/> <parameter name="para1" locked="xsd:true">10</parameter> </operation> </module>
class: (Optional attribute) Indicates the module
implementation class. A module may or may not contain a module implementation
class since the module can also be a collection of handlers. If a module
contains an implementation class that implements the
org.apache.axis2.modules.Module interface at deployment, its
init();
method will be called.
parameter: A module can contain any number of parameters and all the listed parameters in the module.xml will be transformed into the corresponding AxisModule of the module.
flow: Defining of handlers in a module has to be done inside flows. There are four types of flows as listed below.
You can add any number of handlers into a flow, and those handlers will be available in the corresponding chains at runtime, when they are engaged.
<handler name="handler1" class="handlerClass "> <order phase="userphase1" /> </handler>