Fog Creek Software
Discussion Board




Welcome! and rules

Joel on Software

Web Service connections

Does a WS connection persist before/after a service method invocation?

i.e. If the client app holds a reference to a WS all the time, but only intermittently calls MyWS.Invoke("MyWebMethod"), is there any traffic on the wire after the Invoke has completed?

Is it bad practice to hold a reference for the life of the client app?

Thanks in advance
Rich

Rich Lee
Thursday, April 07, 2005

This article explains that web services have access to the Session object just like regular ASP.NET web pages:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconstatemanagementinaspnetwebservices.asp?frame=true

So, the answer to your first question is yes.

Your second question is not so easy to answer. I close web service connections as soon as I am done with them, but I have no evidence that this is a "best practice". In fact, the MSDN best practices document for web service design does not mention connection persistence at all:

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpguide/html/cpconaspnetwebservicedesignguidelines.asp?frame=true

I believe that the other issues mentioned on that page (caching and chunky method calls) are more relevant than connection state.

It's worth remembering that connection state is an artifact of HTTP - not web services or SOAP - and Indigo may not have support for session or application state.

Jeff Mastry
Sunday, April 10, 2005

Jeff thanks - very helpful links.

Rich

Rich Lee
Monday, April 11, 2005

*  Recent Topics

*  Fog Creek Home