Sample application to demonstrate the functionality of service groups

Service Groups are a brand new concept introduced by Axis2. With Service Groups, users can group several services together. This concept gives two main advantages to users.

  1. Several related services can be easily managed and deployed.

  2. Can share information between different services of the same Service Group at run time.

This sample application demonstrate how you can create a service group and how you can use the functionalities offered by axis2 to share information between services of the same group at runtime.



The idea

The ides behind the sample is pretty simple. We have developed a Calculator service group with three services AddService, SubstractService and MultiplyService. Each service has two operations. For e.g. AddServices has a 'add' operation and a 'addPrevious' operation.

The 'add' operation is used to add two integers and produce a result. When a operation is run the result will be saved in the current ServiceGroupContext which is the Context that has to be used to share information between services of the same service group.

When the addPrevious operation is run (which takes a single integer as the parameter) the saved value of the last operation will be added to the integer values that comes as a parameter.

You can even call operations of the other two services. These services can also use the value saved from the previous operation.

You can use the client class provided to run this in a interactive manner.

How to run the sample

Please run axis2 and deploy the provided Calculator.aar service by simply dropping it to the Axis2_webapp/WEB-INF/services directory (see axis user guide for more details).

Run the run.bat file.

You will see the following screen.






Select 'n' to start a new round.






Now select the service. + for AddService, - for SubstractService, * for MultiplyService. And press enter.

Enter the two parameters.

You will see the result.






Now select the option 'c' to continue the round. Select the operation. You have to give a single parameter and press enter.

The result will be generated using the entered valus and the result of the previous operation (which is obtained from the ServiceGroupContext).






You can continue this interactively any number of times.