I think I have finally solved the problem I have been having with WordPress and Windows Live Writer. Windows Live Writer is a free Microsoft program that allows you to write blog posts and submit them to your blog. It is a useful program if you maintain multiple blogs and don’t like the built-in text editors. Windows Live Writer uses XML-RPC, a remote procedure call protocol which uses XML to encode its calls and HTTP as a transport mechanism, to submit the blog post.
I’ve been getting the infamous “An error occurred while attempting to connect to your weblog: Invalid Server Response = The response to the blogger.getUsersBlogs method received from the weblog server was invalid: Invalid response document returned from XmlRpc server” error when my Now Reading plugin was enabled. I would have to disable that plugin before using Windows Live Writer. This required logging in to my WordPress administration and that defeats the whole purpose of using the program to avoid using the browser.
There are various solutions to this problem but eventually I found it came down to the XML response from the xmlrpc.php file. Windows Live Writer complains when the XML response cannot be parsed. In order to troubleshoot this problem you need to see the XML response. I did find a XML-RPC debugger at: http://gggeek.raprap.it/debugger/ but it is not very helpful when the XML is malformed. It can give you some insight into the methods that are available though. In order to figure out exactly what was going on, I wrote a simple VBScript to submit a POST request to the xmlrpc.php file and saved the response to a file.
My script revealed that the XML response was missing a few characters from the final closing tag. I fixed that problem by adding some newlines to the class-IXR.php file in the wp-includes directory. I added newlines just before the EOD; on line 336. Then I found that there was a BOM (Byte Order Mark) just before the first XML tag. This problem was caused by my use of Microsoft Expression Web which added the BOM to my wp-config.php file when I edited it in that crappy program.
After finally verifying that the XML response would be valid I was able to use Windows Live Writer without disabling any of my WordPress plugins. Who da man?
This blog post was written using Windows Live Writer and will serve as a test of my fix.