Hi friends, I have designing a system where i have one issue where i need to handle the session for the incoming web service requests. I am using AXIS for web service. If i use axis servlet then the web service request directly comes to the service class (it is a pure java class). So where do i need to have session maintanance code and how to do that.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Using HTTP sessions is not a good idea with WS, which should be stateless. Using Axis, you can get at the HTTp request like this:
Originally posted by Ulf Dittmer: Using HTTP sessions is not a good idea with WS, which should be stateless. Using Axis, you can get at the HTTp request like this:
That allows you to do the session stuff.
Hi Is there any way to handle the sessions in WS, Because our project is a B2B application and 1000 of messages come from same user, my idea is why to validate the user for every request. Please let me know if there is any alternative solution for this.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Ummm, isn't that the same question you asked earlier? If you want to use HTTP sessions, this is the way to do it using Axis. Or are you talking about creating your own session handling mechanism (which would mean reinventing the wheel) ?
dhanu karnam
Greenhorn
Joined: Jun 16, 2006
Posts: 3
posted
0
Originally posted by Ulf Dittmer: Ummm, isn't that the same question you asked earlier? If you want to use HTTP sessions, this is the way to do it using Axis. Or are you talking about creating your own session handling mechanism (which would mean reinventing the wheel) ?
When you said this statement "Using HTTP sessions is not a good idea with WS", then i thought there may be other ways, thats why i asked. Hey thanks for the quick response which is helping me to proceed further.
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Right, I should have said "using sessions is not a good idea", not just "HTTP sessions". Any information needed to process a WS call should be passed in by the client, not stored in a session. Architecting a WS infrastructure is different than architecting a web app infrastructure, where there may be lots of stuff in a session, depending on the circumstances.
naveen gupta
Ranch Hand
Joined: Apr 12, 2006
Posts: 129
posted
0
I really wanted to know if we can really do session management while implementing web services
If anybody has done so, please reply to this thread
thanks in advance
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Naveen,
after reading through the thread, what are you unclear about whether or not session handling is possible in WS?
naveen gupta
Ranch Hand
Joined: Apr 12, 2006
Posts: 129
posted
0
yes
Is session handling possible in Web services ? if so how ?
Ulf Dittmer
Marshal
Joined: Mar 22, 2005
Posts: 35224
7
posted
0
Yes, session handling in WS is possible. Using Axis you have access to the HTTP session, see above. Other servers presumably also provide access, check the documentation of the server. And you can always implement your own scheme that sends session IDs as part of the request, and uses those to look up stuff in a HashMap on the server.