[Twisted-web] XML-RPC server returns text/html on fault

Remi Cool mailinglists at smartology.nl
Thu Dec 28 03:02:49 CST 2006


I've run into a problem with a twisted XML-RPC server.

When you request a (xml-rpc) function that doesn't exist, the response
from the twisted server has the wrong content type so that the xml-rpc
client can't handle it properly.

(using a simple python xml-rpc client - verbose=True)

reply: 'HTTP/1.0 200 OK\r\n'
header: Date: Thu, 28 Dec 2006 08:50:36 GMT
header: Content-length: 282
header: Content-type: text/html; charset=UTF-8
header: Server: TwistedWeb/2.2.0
body: "<?xml
version='1.0'?>\n<methodResponse>\n<fault>\n<value><struct>\n<member>\n<name>faultCode</name>\n<value><int>8001</int></value>\n</member>\n<member>\n<name>faultString</name>\n<value><string>function
echos not
found</string></value>\n</member>\n</struct></value>\n</fault>\n</methodResponse>\n"
ERROR <Fault 8001: 'function echos not found'>

How can I change this behaviour so that it returns a proper xml-rpc
response with a text/xml content-type header?

- Remi -



More information about the Twisted-web mailing list