Sunday, February 22, 2009

Cloud Computing infrastructure using Axis2

Utility computing or the cloud computing is becoming the next generating computing platform, which reduces the time and cost. So when we want the resource we go and rent depending on the time we want and depending on the money we have. According to my understanding Amazon EC2 plays a big role in Cloud computing, and of course they use Web Services for almost everything.

Apart from commercial cloud infrastructure, there is on good open source cloud infrastructure as well, which is called EUCALYPTUS (a research project). I knew about this for a few months, but I did not know that they use Axis2 as the Web Service framework until today (Thanks Deep for letting me know that). One of the cool thing about EUCALYPTUS is that is functionally equal to Amazon EC2. So if you want to do the testing on your system before you move into Amazon EC2, then I think this is a good way of doing that.

Monday, February 16, 2009

Writing an Axis2 module

One of the interesting feature of Axis2 is its nature of extensibility, there are a number of way to extend Axis2 functionality. Here I am going to discuss how to extend its core functionality, that is invoking customer code when a message is received to the system. All the WS* features (Reliability, Security etc..), implemented in this way. Here I am going to discuss how to write a very simple Axis2 module to count the number of incoming messages and outgoing messages.

For this module we need three main components,
- Incoming message handler
- Outgoing message handler
- Module configuration

Incoming message counter has a global counter, which will be incremented for each request, and the same way outgoing message counter also has a global counter which also incremented for each outgoing messages. Then finally Module configuration which specify the ordering of handler in the execution chain [Axis2 execution chain].

you can find the source code of all those components as well as executable module.

How to use the module?
To use the module, first you need to download the "counter-module.mar" and need to drop into "modules" directory in Axis2 [Axis2 deployment]. Then you need to engage the module, for that you can either
- Do that using axis2.xml <module ref="counter-module"/>
- Or you can do that using Axis2 management console
(login to the admin console, then go to the engage module menu bar at the left hand side).

How to see that working?
To see that working you can do any of the Axis2 service invocation [Axis2 client API], the simplest way is to invoke the version service. For that type the following in the browser.
http://localhost:8080/axis2/services/Version/getVersion

Then if you look at the server console (Tomcat console), you can see our module prints request and response count. If you invoke the service again you will see the number is getting incremented.

Resource
- Source code
- Binary file

Friday, February 06, 2009

What is WSO2 and WSO2 Carbon

Reacently WSO2 relaased its company overview or the elivator pitch, check it out. What it is, who they are, what they do ....




One of my SOA teacher, Paul Fremantle (CTO, WSO2) has written a nice blog about WSO2 Carbon as well as his thought on SOA composition. I think that blog is very useful to get an understanding about what is going to happen in the future of SOA, how the component oriented architecture going to be used in SOA.

Monday, February 02, 2009

C is so powerful but not nice as Java

I am doing Java programming more than 6 years now, and I think I had a chance to most of the J2SE components. And specially from Axis2 I learn a lot about Java. I always found Java is so nice, due to various reason, first it is easy to program, second it has number of tools support. If you have some problem, there is a high probability that someone has already found and written code for that, so that make your job so easier. Another most important factor is debugging support for Java, it is so easy to debug Java programs, including remote debugging. Additionally most of the IDEs written for Java has better support for debugging.

Anyway recently I got a chance to work on some of the cool C stuff, I remember I have done some C program for my undergraduate. There I did not do much work other than implementing some of the data structures and few sorting algorithms. So I believe my knowledge on C so little compared to Java. So the recent work involved a lot of low level C, concurrency, load balancing. I think that is a cool experience someone should have with C.

While doing so I faced some strange problem sometime took days figure out the issues, one of the main reason was my lack of knowledge on C program debugging. I tried to use “gdb” but that did not work for most of the cases. Other problem I faced was getting negative time, basically I got the time before starting my execution and got the time again after execution, and when I deduct end-start I got negative values. I found that a known problem and I even tried some of the workarounds sometimes. Anyway finally I got everything working fine, now I think now I am comfortable of reading any kind of C program at least understand that correctly, and may be modify that.