Can I force my SOAP client to re-use an existing connection on subsequent calls to a service?
Posted on 2006-06-05
I'm writing a SOAP client in C#. It uses a WSDL-generated class that's derived from SoapHttpClientProtocol -- pretty standard stuff. The service that I'm querying uses SSL, and I'd like to avoid the overhead of the SSL handshake in those situations where I have to make several calls to the service back-to-back. I've been looking at the .NET documentation on MSDN, but haven't found any way to prevent my client from opening a new TCP connection to the service every time I invoke the main SOAP method.
I know that the client is opening a new connection each time, because I've watched the TCP traffic in Ethereal as the client runs. In my particular situation, I'm calling the same SOAP method repeatedly from within a tight foreach() loop, so there's no reason why the client couldn't re-use the original connection -- I just don't know how to specify that it should. Is this possible?
I've labelled this question "easy" because I'm guessing that there's a simple boolean property that I need to set somewhere, that I just don't know about. If the implementation is more in-depth, I will upgrade the point-value accordingly.