File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Web Services and the fly likes Web Service session maintanance Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Web Service session maintanance" Watch "Web Service session maintanance" New topic
Author

Web Service session maintanance

dhanu karnam
Greenhorn

Joined: Jun 16, 2006
Posts: 3
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: 41155
    
  45
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.


Ping & DNS - my free Android networking tools app
dhanu karnam
Greenhorn

Joined: Jun 16, 2006
Posts: 3
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: 41155
    
  45
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
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: 41155
    
  45
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
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: 41155
    
  45
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
yes

Is session handling possible in Web services ? if so how ?
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 41155
    
  45
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

Joined: Aug 19, 2005
Posts: 2922
    
    5
The following topics may be of some interest:
Lost Session at JWSP-Client
Session in web services with axis
 
 
subject: Web Service session maintanance
 
Similar Threads
For Web Service, if I have WAS and RAD, do I still need Axis ?
Deployable AXIS war
Design : transport protocol HTTP to MQ
is session management possible in webservice
IWAB0135E An unexpected error has occurred.