Is it possible to make a persistent connection between a Python web service and a .Net WCF Client?

Posted by Ad Hock on Stack Overflow See other posts from Stack Overflow or by Ad Hock
Published on 2010-03-11T19:46:19Z Indexed on 2010/03/11 19:49 UTC
Read the original article Hit count: 346

Filed under:
|
|
|
|

I have a .Net 3.5 SOAP client written in C# using the WCF. It's expecting basicHTTPBinding and a persistent connection with HTTP/1.1.

I'm trying to create a Python 2.6 application that will act as a web-service for the client. My problem is that the client keeps closing the connection and opening a new one for every command to the web service.

How does the .Net WCF client know to stay open when connecting with a .Net Service?

When I create a dummy .Net web service the client connects fine and the connection remains persistent. From what I can tell, when connected to a .Net server, there are no special HTTP headers being sent, that makes sense since HTTP/1.1 assumes a persistent connection unless otherwise specified (right?).

However, with the python web service I accept/open a connection and eventually the client will send a TCP FIN and the connection will close (the client never sends a FIN or RST when connecting to a .Net service).

The communication goes something like this:

Incoming -- HTTP Header for SOAP Command #1
Outgoing -- HTTP Header with a Continue
Incoming -- Body of Command #1
Outgoing -- ACK Command #1 (HTTP headers and body)
Incoming -- HTTP Header for SOAP Command #2
Outgoing -- HTTP Header with a Continue
Incoming -- TCP FIN
<Connection closes>
<New connection opens and SOAP command #2 (with full HTTP headers) is sent>

I'm using a SocketServer.ThreadingTCPServer as the server and a BaseHTTPServer.BaseHTTPRequestHandler for any requests. The handler is actually a derived class of that with a do_POST method to handle the HTTP headers.

I've looked at WireShark captures and I'm stumped. I've tried setting socket options to SO_KEEPALIVE and SO_REUSEADDR in the server but that didn't seem to change anything.

What am I missing?

© Stack Overflow or respective owner

Related posts about python

Related posts about .NET