Web Services are Stateless
Web service objects created by client code look like normal
objects, but they don't act the same as local objects. Class
constructors work a little differently. If
I write:
localhost.Service1 webSvc = new
WindowsApplication2.localhost.Service1();
string s = webSvc.HelloWorld1();
string t = webSvc.HelloWorld2();
The XML web service object on the web server will not be instantiated with the first line
(contrary to what it seems--that line only instantiates a proxy on the client
machine). The XML web service object will be instantiated twice, once for
each of the next two
lines. This is important, because it
means that information within the web service ‘object’
will not be retained between calls.