Session Management in Axis2 : Enabling Sessions on Client Side
- By Deepal Jayasingha
- 5 Dec, 2006
- Reads: 8932
Session management is very useful feature when it comes to enterprise level applications. However, few years ago there was not a single notion on session management in Web services . Now the situation is different. There is a trend towards managing sessions in Web services as it is not that easy to implement complex scenarios without the support of session management. Therefore Apache Axis2 has an inbuilt support for session management for both client side and server side. Not only this, it also has different levels of session scopes as well.
It's common knowledge that if we want to participate in an existing session, then we need to send some ID back to the server. In Axis2, if we want to be in the same SOAP session, then we need to send the Axis2 specific SOAP header parameter called "ServiceGroupID" back to the server. Similarly, if we want to be in the same transport session then we need to send the HTTP cookie back to the server. As a client it is a bit difficult to do all those manually. To solve this problem Axis2 client side has a very interesting flag.
If we want to interact with the server in a session-full manner, then we can turn the flag on, which will enable Axis2 to automatically send the required IDs back.
To turn the flag on, please add the following line(s) to your client code:
ServiceClient client = new ServiceClient();