Wednesday, October 15, 2008

How Axis2 Engine works

Axis2 Engine is one of the most important parts of Axis2 message processing. Axis2 Engine is responsible for invoking the Phases (Phase is a collection of handlers) which are supposed to invoke for a given message context object. Once Axis2 Engine invokes a Phase, then the Phase invokes the handlers for that phase in a similar a manner. Axis2 Engine uses currentHandlerIndex variable which is stored in messageContext to keep a track of executed phases.
Axis2 supports mainly two flows of message processing, namely Out flow and In flow. To support these two flows Axis2 has two methods called send() and receive() respectively.
Before calling to the send() method, Axis2 assume that the AxisService and AxisOperation has already been set to the messageContext. Normally Axis2 client calls the send() method. Therefore at the send() method it creates the handler chain by getting the Operation specific handler chain and global handler chain. Then it invokes the each phase as mentioned earlier.
Unlike in the send() method, when calling to the receive() method most of the time by the transport receiver, both AxisOperation and AxisService has not been found in the messageContext. Therefore at the receive method first it invoke the Global phases or Inflow chain which is stored in the AxisConfiguration. The main idea of this global phases is to dispatch the message (i.e. finding the AxisService and AxisOperation according to the parameters of the messageContext). Distpatch phase is the last phase of this chain. After Dispatch phase AxisService and AxisOperation should have been found. This is checked at the checkPostConditions method of the DispatchPhase class. If the dispatch information is found handler chain is populated with the operation specific handlers and continue the execution. Otherwise it throws an exception.

2 comments:

Chatree Srichart said...

How Axis2 send Map object?

Amila Suriarachchi said...

Axis2 engine does not handle databinding. Databinding happens at the message receiver level.
I think your question is how axis2 handles Map object in a POJO class. IFAIK Axis2 rpc message receiver does not support maps.