Flow is the collection of phases in the Axis2 architecture. There are two flows Axis2 engine has two flows based on the message invocation patterns,
- In-Flow – which is invoked when the engine receives a message
- Out-Flow – which is invoked on engine sends the message.
These flows are not in object or structure on real implementations. The order in which the phases should be put together to form a flow can be configured in axis2.xml configuration.
Axis2 engine invokes in the phases which they are placed in flow.
Axis2 have predefined phases . They also configured in the configuration file axis2.xml
The Phases are deined on the element in axis2.xml
https://gist.github.com/anonymous/03fae396998f6683b3ef3b20abc73e02.js User also can add user defined pahses on axis2.xml , but it should be after the post dispatch phase. The example user defined configuration is as follows,
The main idea of phase rules is to correctly locate a handler relatively to one another inside a phase.
Characterizing a phase rule can be based on one more of the following properties that will be discussed below:
- Phase name: Name of the phase that the handler must place
- Phase first (phaseFirst): The first handler of the phase
- Phase Last (phaseLast): The last handler of the phase
- Before (before): Should be positioned before a given handler
- After (after): Should be positioned after a given handler
- Before and after: Should placed between given two handlers
They are small unit invocations , when the phases is invoked. Each handlers within the phase will be invoked.
An example for handler is :
AddressingInHandler is places in the predispatch phase in in-flow – it deals with the incoming addressing headers in request.
AddressingOutHeader is places in the message out phase in out-flow and it prepare out going response message headers and addresses.
Collection of handlers with its configurations are so called modules. Modules enable the user of Axis2 to adding new handlers and phases on their desire.
when configuring the module user add the module to the pedefined phase of Axis2 Engine.
First for the all handlers axis2_handler interface needs to be implemented. This means the following signature need to be implemented.
Once the handler is implemented, the module need to implement to API calls as follows
engine looking the above implemented functions when loading and unloading the module. Once the above works are ready then they are compiled with the shared library. In order to use the module configuration file is also required. The following is the sample configuration file WS-Addressing scenario.