Win a copy of Mesos in Action this week in the Cloud/Virtualizaton forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Web Service session maintanance

 
dhanu karnam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
dhanu karnam
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Naveen,

after reading through the thread, what are you unclear about whether or not session handling is possible in WS?
 
naveen gupta
Ranch Hand
Posts: 129
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yes

Is session handling possible in Web services ? if so how ?
 
Ulf Dittmer
Rancher
Posts: 42967
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Peer Reynders
Bartender
Posts: 2968
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The following topics may be of some interest:
Lost Session at JWSP-Client
Session in web services with axis
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic