Hi,
I have a (stupid) question on why web service class needs an instance.
Everybody knows its stateless then why cant it can be standardized that all
methos in web service class should be static. For eg I create an instance
websrv.
I have 2(set/get) methods and a private variable 'name'.
websrv.setName("Hello"); and in next line if I call
websrv.getName() obviously it wont work. then why cant we make it static.
Jon Skeet [C# MVP] - 27 Jun 2005 07:04 GMT
> I have a (stupid) question on why web service class needs an instance.
> Everybody knows its stateless then why cant it can be standardized that all
[quoted text clipped - 3 lines]
> websrv.setName("Hello"); and in next line if I call
> websrv.getName() obviously it wont work. then why cant we make it static.
Actually, I think it *might* work, depending on how the web service
deals with sessions.
More importantly though, the methods can't be static because of the
various instance properties to do with the web service class which are
needed to know what server to contact etc - things like the url, the
proxy etc.

Signature
Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet
If replying to the group, please do not mail me too
jabailo@texeme.com - 27 Jun 2005 07:44 GMT
> Hi,
> I have a (stupid) question on why web service class needs an
[quoted text clipped - 5 lines]
> websrv.setName("Hello"); and in next line if I call
> websrv.getName() obviously it wont work. then why cant we make it static.
You should use remoting.

Signature
Texeme Textcasting Technology
http://www.texeme.com
Cor Ligthert - 27 Jun 2005 08:49 GMT
Ravi,
In addition what Jon wrote.
I am not sure about a webservice, however I would not know why it would
works different.
In any webapplication does the serverside application belongs to all active
clients.
For me it is a multitier especially if you use static/shared classes.
The application running in the Client inside IE is the client (it is a real
application running in IE, even if you don't think in it in that way)
The Dll on the serversides gives requested data (even if it is the first
time nothing) to the clients and processes returned data.
The database (whatever it is) holds the data.
When there are no more sessions active, than the program ends and you have
to initialize everything new.
I hope this gives an idea
Cor
Ravi - 27 Jun 2005 14:40 GMT
Thanks for that. Yes what you said makes sense if its happening in web
applications then web service is no different.
> Ravi,
>
[quoted text clipped - 22 lines]
>
> Cor