Cook Computing

Syndic8 XML-RPC Problem

June 21, 2006 Written by Charles Cook

I've investigated a report of problems with the Syndic8 XML-RPC API where requests from XML-RPC.NET were failing with "The server committed a protocol violation. Section=ResponseStatusLine". It looks like the Syndic8 server is returning a spurious linefeed after the body of the response, i.e. if the Content-Length header has a value of 854 then there is a linefeed in the HTTP response at offset 854 from the start of the content.

This may not cause a problem if your client uses a separate connection for each request, but XML-RPC.NET uses the default KeepAlive setting of the underlying WebRequest object which means that a single connection is used for multiple requests. Presumably that spurious byte messes up the parsing of the status line at the start of the following HTTP response and causes the above error.

The workaround is to switch off KeepAlive:

ISyndic8 syndic8 = (ISyndic8)XmlRpcProxyGen.Create(typeof(ISyndic8));
(syndic8 as XmlRpcClientProtocol).KeepAlive = false;