Learning Apache Axis2 from level zero – Part II

Today I am going to discuss about what happens to a message come in to an axis2 engine. Here is a pictorial representation of what is happening inside an axis2 engine.

The key functionality of any given web service framework is processing an incoming message and delivering it to the targeted application (service), and once the result is produced, delivering it to the client. Today, for business critical applications, we need a lot more than just processing the messages. Thus, support, for example reliability, security, transactions, and throttling is required. In addition, a framework should also be easily extensible to support new customer requirements and other quality services. To provide those features, most of the SOAP processing frameworks utilize the concept of pipes, where any incoming or outgoing message goes through the pipe and the extensible pipe is divided into small pieces. Such a piece is known as an interceptor. One can add new interceptors, change them, or delete them, to cope with the requirements.

Let’s see what each of the above components do inside an axis2 engine.

  • Handlers

Handler is the message interceptor. In any messaging system, the interceptor has its factual meaning in the context of messaging too, which intercepts the messaging flow and does whatever task it is assigned to do. In fact, the interceptor is the smallest execution unit in a messaging system.

Handlers, in Axis, are stateless, meaning they do not keep their past execution states in memory. A handler can be considered as a logic invoker with the input for the logic evaluation taken only from the MessageContext. Handler has both read and write access to MessageContext (MC) and to incoming SOAP messages. Thus, a handler can read SOAP messages, remove elements from the message (mostly headers), add new elements (headers), or modify elements as well as add, delete,
or modify content from the MessageContext.

  • Phases

The concept of a phase is introduced by Axis2 and it was mainly to support the dynamic ordering of handlers to provide better extensibility, and better flexibility of the handler chain. A phase can be defined in various ways:
•  It can be considered as a logical collection of handlers
•  It can be considered as a specific time interval in the message execution
•  It can be considered as a bucket into which one can put his/her handler
•  One can consider a phase as a handler too

  • Pipe (Flow)

A flow is the message pipe where the message enters from one end of the flow and leaves from the other end of the flow. A flow or execution chain can be considered as a collection of phases. Although it has been mentioned earlier that the Axis engine will call the invoke method of a handler. That is not totally correct. At a very high level, what the engine really does is call the invoke method of each phase in a given flow, and then the phase will sequentially invoke all the handlers in it (the following figure illustrates how an engine calls a phase and then a phase calls handlers).


In the above figure, P – Phase, H – Handler
This blog post is prepared with the help of the book “Apache Axis2 Web Services 02nd Edition” by Afkham Azeez and Deepal Jayasinghe.

One thought on “Learning Apache Axis2 from level zero – Part II

  1. Pingback: Beginner’s Guide to Apache Axis2 | Geek Detected

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s