I have created a simple webservice using C#. Now I want to consume it
from a windows application.The problem is that the information saved in
Session object do not persist across calls of different methods from the
same instance of application.All of them have the
[WebMethod(EnabledSession = true)] specified. Any hints? Am I missing
something?
Victor,
Web service calls are just like web page calls and are inheritly stateless
in nature. If you're connecting with a thick client, you should look at
saving your state there and NOT persisting it on the web server itself.
Using sessions, in general, will reduce scaleability and also cause problems
for the users when their sessions timeout. For example, what happens when
the user is in a multi-step process and walks away from their machine for 30
minutes, causing the session to timeout?
I would suggest that you look into an alternative method other than storing
session state information and trying to persist data over multiple calls to
the web service. Sending xml strings with the data that you need is a great
way to send in large amounts of information.
Since I tend to follow that practice and have never used sessions with web
services, I can't give you much advice on actually using sessions with
WebServices. :)
Good Luck,
Robert
>I have created a simple webservice using C#. Now I want to consume it from
>a windows application.The problem is that the information saved in Session
>object do not persist across calls of different methods from the same
>instance of application.All of them have the [WebMethod(EnabledSession =
>true)] specified. Any hints? Am I missing something?
vincent - 10 Apr 2006 20:20 GMT
Hello,
I agree WebServices should be stateless.
But sometimes, for example when you need to store a security context for
an user, you can't do it on client side.
I know you can use Sessions with some tricks like using a CookieContainer
on client side...
Good luck
> Victor,
>
[quoted text clipped - 26 lines]
>> [WebMethod(EnabledSession = true)] specified. Any hints? Am I missing
>> something?
Victor Paraschiv - 11 Apr 2006 14:02 GMT
Thanks for your answers and advices.I think I'll try to figure out how
to deal with a webservice without using Sessions.
> Hello,
>
[quoted text clipped - 36 lines]
>>> [WebMethod(EnabledSession = true)] specified. Any hints? Am I missing
>>> something?