Skip to main content

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.

Comments

  1. How to Earn More cash from Google adsense by adding keywords... ( Top 500+ High Paying Google Adsense Keywords 2017 )
    http://rottary.blogspot.com/2017/02/how-to-earn-more-cash-from-google.html

    ReplyDelete

  2. It is amazing to visit your site. Thanks for sharing this information, this is useful to me...
    Microservices Online Training
    Microservices Training in Hyderabad

    ReplyDelete

Post a Comment

Popular posts from this blog

How to protect your APIs with self contained access token (JWT) using WSO2 API Manager and WSO2 Identity Server

In a typical enterprise information system, there is a high chance that people will use different types of systems built by different vendors to implement certain types of functionalities. The APIs might be hosted in an API Manager developed by vendor A and the user management can be implemented using a different vendor (vendor B). In this type of a situation, one system will not be able to directly contact the other system but they want to use both systems in tandem. Self-contained access tokens are used in these types of situations where applications can get the token from one system and use that in another system to access protected resources. In this scenario, the second system does not need to make a contact to the first system over the network to validate the user information since the token is self-contained and it has relevant details about the user. This will improve the token processing time significantly since it completely removes the network interaction. The below fig...

WSO2 ESB creating a response for a "GET" request

When you are creating REST APIs with WSO2 ESB, you may need to send some response message back to the user when something goes wrong. In this kind of scenario, you can create a payload inside the ESB and send it back. For doing this, you can use the below configuration. <api xmlns=" http://ws.apache.org/ ns/synapse " name="LoopBackProxy" context="/loopback">    <resource methods="POST GET">       <inSequence>          <property name="NO_ENTITY_BODY" scope="axis2" action="remove"></property>          <log level="full"></log>          <payloadFactory media-type="xml">             <format>                <m:messageBeforeLoopBack xmlns:m=" http://services...

WSO2 ESB tuning performance with threads

I have written several blog posts explaining the internal behavior of the ESB and the threads created inside ESB. With this post, I am talking about the effect of threads in the WSO2 ESB and how to tune up threads for optimal performance. You can refer [1] and [2] to understand the threads created within the ESB. [1] http://soatutorials.blogspot.com/2015/05/understanding-threads-created-in-wso2.html [2] http://wso2.com/library/articles/2012/03/importance-performance-wso2-esb-handles-nonobvious/ Within this blog post, I am discussing about the "worker threads" which are used for processing the data within the WSO2 ESB. There are 2 types of worker threads created when you start sending the requests to the server 1) Server Worker/Client Worker Threads 2) Mediator Worker (Synapse-Worker) Threads Server Worker/Client Worker Threads These set of threads will be used to process all the requests/responses coming to the ESB server. ServerWorker Threads will be used to pr...