Recently I have started working with WSO2 ESB, which is a high performing and opensource. It has many advantages over other ESBs and support to users by WSO2. It is build on top of Carbon platform, ans Carbon energize WSO2 ESB to out shine among other competitive ESBs. In this article I’m going to tell you how to send a message from a client to a server through ESB.
You need to download the following stuffs before proceeding further.
- Java SDK 1.6 is preferred
- WSO2 ESB Binary
For Installing Java and Ant, please refer to their websites. Unzip the downloaded WSO2ESB file.
Starting WSO2 ESB
First you need to access in to bin folder using command line. Then type ./wso2server.bat (in Windows) or ./wso2server.sh (in Linux). you can access to the web interface of WSO2 ESB by typing “localhost:9443” in the address bar of your favorite web browser. You can access to it by using “admin” for both username and password.
WSO2 ESB ships with large number of examples that is very helpful to new comers. For example following command can be used to start sample 0, which I’ll use through out the rest of this article.
./wso2server.bat -sn 0 (in Windows) or ./wso2server.sh -sn 0 (in Linux)
Actually what happens at there was WSO2 ESB started with the configuration belongs to sample 0.
Let the ESB running on command line and do rest of work on another command line window.
Build and Run back-end service
Back-end service could be any type of web service. You can also create your own back-end web service using Axis2 as a tool. Currently WSO2 ESB ships with a sample service called SimpleStockQuoteService. First you have to build that service by going to /samples/axis2Server/src/SimpleStockQuoteService using command line and type ant (for this Ant should be configured using ANT_HOME variable). After building successfully you can get the service running by starting axis2server.sh or axis2server.bat inside /samples/axis2Server/ folder.
Build and Run client
Client also can be implemented using different ways but client should be able to send messages to service as the service expects, to get the job done. For the SimpleStockQuoteService WSO2 ESB ships a client too. You can build and send a request to SimpleStockQuoteService through ESB by executing the following command inside /samples/axis2Client directory.
ant stockquote -Daddurl=http://localhost:9000/services/SimpleStockQuoteService -Dtrpurl=http://localhost:8280 -Dsymbol=WSO2
(The above statement is a single command)
After that you will get a response similar to following:
Standard :: Stock price = $67.70939946622869
So that’s the response for the request made by client.
Throughout this article I ;
1. Started WSO2 ESB with a sample configuartion
2. Started Axis2server with SimpleStockQuoteService
3. Send a request to SimpleStockQuoteService using a client.
My intention was to guide a new user through working sample in WSO2 ESB. But there’s lot more you can do with an ESB to ease your work with enterprise applications. WOS2 ESB sample guide will help you to do more with WSO2 ESB.
1. WSO2 ESB – http://wso2.com/products/enterprise-service-bus/
2. Installation guide – http://docs.wso2.org/wiki/display/ESB450/The+Product+Installation+Guide
3. More descriptive quick start guide – http://docs.wso2.org/wiki/display/ESB450/Quick+Start+Guide
4. More on sample 0 – http://docs.wso2.org/wiki/display/ESB450/Sample+0%3A+Introduction+to+ESB
5. More on axis2 clients and services that ships with WSO2 ESB – http://docs.wso2.org/wiki/display/ESB450/ESB+Samples+Setup
6. ESB Comparison – http://java.dzone.com/articles/esb-comparison