Open-Live-Writer : How to solve invalid response from XmlRpc server error

Open Live Writer XML-RPC Invalid Server Response Connection Problem

When writing drafts for my blog posts, I prefer to use offline blog authoring editors. First, I used Windows Live Writer, part of Windows Essential, but after it reached end of support in the 2017, I switched to forked open sourced version Open Live Writer. I also installed EasyPHP on my local machine, to publish the drafts to my local WordPress site for further processing. The problem was that the "Open Live Writer" was not letting me add a blog account. It was giving me an error message about Invalid Server Response. In this article, I will show you what I tried and what fixed the issue.

The error message I received was:

Can't connect to your blog service:

Invalid Server Response - The response to the blogger.getUsersBlogs method received from the blog server was invalid:

Invalid response document returned from XmlRpc server

Please try fixing the problem and then try again.

Note: If the blog account is already added, but you cannot login to your blog, then you get "An unexpected error has occurred while attempting to log in:" error with same invalid server response.

When adding a blog account, I also tried to choose “Other services” option, instead of “WordPress”, but received the same error message.

Next I changed the “Web address of your blog:” field to only point to localhost at 127.0.0.1:

open live writer add blog account localhost

This opened a different window “Select blog type”:

open live writer add blog account select blog type

After choosing “WordPress 2.2+” from the "Select Blog Provider" dropdown menu, the “Remote posting web address for your blog:” field was filled with the following link:

http://<hostname>/<wp_path>/xmlrpc.php

I edited this link to point to the xmlrpc.php file of my local WordPress site, but again I received the same error:

open live writer add blog account invalid response document xmlrpc error

It seemed the issue was not with the setup in Open Live Writer / OLW, but was somewhere else. Here are the different ways I tried to solve the problem:

Checking XML-RPC function in WordPress

Since the Open Live Writer error message mentioned XmlRpc and the application was giving me option to add a path to xmlrpc.php file, I first focused on XML-RPC.

XML Remote Procedure Call or XML-RPC allow you to interact remotely with your WordPress website. There are posts on the web suggesting to turn on XML-RPC in WordPress, but it turns out, this feature is turned on by default since WordPress 3.5.

To determine, if XML-RPC is enabled on WordPress, go to www.yoursite.com/xmlrpc.php which should give you the following message:

XML-RPC server accepts POST requests only.

If the XML-RPC is enabled, then running xmlrpc.php in browser will cause 405 status error (Method not allowed) and display the above message as this was GET and not POST requests.

Note: If the message you are receiving says that the requested URL was rejected, check this article on how to enable it, which might fix the "Invalid Server Response" problem.

In my case, the XML-RPC was working fine, so I kept looking.

Increasing memory limit and File Upload Limit in php.ini

Then I stumbled on some suggestions that the memory_limit or upload_max_filesize in PHP might be too low. Inside the php.ini file, I had the following settings:

They looked fine to me, but I increased the upload_max_filesize to 25M just in case. After stopping / restarting Apache server, this change didn’t do anything.

Checking Open Live Writer log file

Then I discovered that the OpenLiveWriter had a log file.

On Win10, the file is located at:
%LOCALAPPDATA%\OpenLiveWriter

if you are still using Windows Live Writer, the log file should be located at:
%LOCALAPPDATA%\Windows Live Writer

When I checked the log, I noticed the following error message:

This seemed to indicate that while WordPress XRP-RPC was expecting XML format, it instead received the PHP deprecated warning. This warning breaks the XML and causes it to complain that the XML response was invalid. So the obvious solution was to get rid of this deprecated warning.

Removing the PHP deprecated warning

The error in Open Live Writer log file mentioned $HTTP_RAW_POST_DATA being deprecated and to set always_populate_raw_post_data to -1. In php.ini, this line was commented out:

After removing the comment and restarting the server, the Open Live Writer was able to add a blog account and publish my draft to the local WordPress site without any issue.

Note: For more information about $HTTP_RAW_POST_DATA, check this official PHP page about it.

Another way to get rid of the warning

The solution in the previous section was simple, but what if you have a notice, strict or deprecated warning and you are unsure how to fix it. The quickest way would be to make sure the PHP doesn't complain about them. We achieve this by setting error_reporting in php.ini to the values below:

Conclusion

If you are using Open Live Writer or any other blog authoring editors and get an error about Invalid Server Response using XML-RPC, it might be due to php.ini configuration. Checking the Open Live Writer log file can give us a clue, on what exactly is causing the issue. In my case, it was due to PHP "deprecated" warning. Fixing this warning solved the issue.

Tags:

Share this page

Add a Comment

Back to Top