The moose likes Web Services and the fly likes web service vs HTTP session Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark "web service vs HTTP session" Watch "web service vs HTTP session" New topic

web service vs HTTP session

Greg Parker

Joined: Aug 13, 2010
Posts: 10
How correct am I when I use HTTP session information in a web based web service endpoint code (say Axis)? Does the specification block me from doing it? Is the web service supposed to be a piece of business functionality exposed regardless of the medium it is communicated through? Context : when i am trying to expose a web service to a javascript soap client i have the capability to use the session info but is it correct to do so? What are the tradeoffs. Thanks in advance for the answers..
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13037
SOAP specifically does not say anything about persistence via sessions or any other mechanism so it is up to you, the programmer. The HttpSession mechanism gets activated before your SOAP service sees the request.

If your service is only going to be accessed by browsers implementing cookies, sure you can use sessions. Of course some potential users may have cookies turned off so that could be a problem.

Greg Parker

Joined: Aug 13, 2010
Posts: 10
Thanks William..
I agree. Here's the link:
subject: web service vs HTTP session
It's not a secret anymore!