This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Web Services and the fly likes Session Maintenanace in Web Services Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "Session Maintenanace in Web Services" Watch "Session Maintenanace in Web Services" New topic
Author

Session Maintenanace in Web Services

Smita S. Mutha
Greenhorn

Joined: Aug 05, 2008
Posts: 8
Hi,

I have to write a web service with 3 methods. The requirement is data receieved in first method is required/processed in second method.

How can I store the data in first method so that it is avaialable in the call for second method from the same client.

How can I maintain in session in web service.

Please help.


--------------------------------<br />SCJP (91%), SCWCD(89%)<br />ON the way to SCDJWS...
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Hi,

Although it doesn't like correct forum for this question.

You can save sessionIdentifier in Message header for subsequent calls or you can use of appropriate WS specificiations like WS-Context.


SCJP,SCWCD,SCBCD,SCDJWS1.4, SCDJWS1.5
Smita S. Mutha
Greenhorn

Joined: Aug 05, 2008
Posts: 8
Thanks Amit.

That would help me identify message from same sender. But,
where and how can I store the data in first function call that will be avaialable in second function call.

Is there anything equivalent to session.setAttribute();
Amit G Piplani
Ranch Hand

Joined: Jul 21, 2004
Posts: 83
Well you can use SOAP message headers to store session id.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
If you have exposed web services as Servlet then you can append the session id to the web service URL and get handle to HttpSession from MessageContext.


My Blog
Smita S. Mutha
Greenhorn

Joined: Aug 05, 2008
Posts: 8
Thanks Vinod.

But, can exposing servlet as service allow me to have multiple methods in service.

As per my understanding, we need to write service logic in service method of servlet to implement as Web Service.

Is there any other way I can write mulitple methods in servlet and expose them as web service operations.

Please suggest.
Vinod K Singh
Ranch Hand

Joined: Sep 30, 2008
Posts: 198
Yes, you can write as many methods as you want in your web service servlet. I would recommend you to have a look at this post http://blog.vinodsingh.com/2008/09/building-jax-ws-web-service.html to have a better understanding.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Session Maintenanace in Web Services