File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Session Maintenanace in Web Services

 
Smita S. Mutha
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Amit G Piplani
Ranch Hand
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Smita S. Mutha
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 83
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well you can use SOAP message headers to store session id.
 
Vinod K Singh
Ranch Hand
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Smita S. Mutha
Greenhorn
Posts: 8
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 198
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic