Kannan's Jumbled Thoughts Rotating Header Image

Windows Live Writer problems with WordPress – How To fix?

Though WordPress provides TinyMCE and the code editor, which are more than enough for me, I decided to check out the offline/desktop posting utilities available out there. I used to use w.blogger, but a quick check showed that it was not currently being updated (or probably, I was looking at the wrong place). So, I decided to check out the Windows Live Writer, which everyone was writing so much about. Windows Live Writer promises integration with WordPress.com and custom hosted WordPress sites too. “Great!”, I thought and downloaded/installed the tool in my WinXP Sp2 box. I don’t know about WordPress.com integration, which I doubt will have any problems. But, custom WordPress integration needs certain tweakings from your side.

Error message (Click to enlarge)When I tried setting up the Live Writer with my WordPress it gave the following error – “Invalid Server Response – The response to the blogger.getUsersBlogs method received from the weblog server was invalid“. A quick Google search brought up this link. I also found another post in WordPress forums, suggesting disabling all the plugins. After lots of trial and error, I hit upon a solution that solved my problem.

Live Writer makes use of XML RPC protocol to talk with WordPress. XML RPC makes use of XML for encoding the communication part. So, if the XML parser at Live Writer end is not able to make sense out of the XML response from WordPress (xmlrpc.php), it complains. This is what happened in my case, as the XML response from my WordPress site started with TWO newline characters followed by the XML starting tag. I don’t know why, but these characters at the beginning of the XML stream choke most XML parsers out there. I have seen this problem with Firefox 2.0/1.5, Feedburner etc.,. Here is a BKM of what I learnt regarding this.

How to fix the error – “Invalid Server Response – The response to the blogger.getUsersBlogs method received from the weblog server was invalid

  1. First step is to check the security part. Make sure your xmlrpc.php in the WordPress root directory is given Read and Execute instructions for you. Check with your hosting service people to see if this is properly set. Most probably your host should have given you a control panel for managing your webspace, you should be able to do this from there. For WordPress.com hosted websites, I guess this should have been already taken care of.
  2. Go to your WordPress root directory. Open your wp-blog-header.php. Remove the NEWLINE characters (Enter’s) at the start of the file, before <?php tag, and from the end, after the closing ?> tag. Now save this. Make sure you remove the newlines from the following files too.
    • wp-blog-header.php
    • wp-config.php
    • wp-settings.php
  3. Check if step (2) has solved your problem. If not, do step (2) for the theme files of your site, located under $WORDPRESS_ROOT/wp-content/themes/.
    • For example, if I am using Misty Look theme, I’d be checking under $WORDPRESS_ROOT/wp-content/themes/MistyLook
  4. Try connecting now. If still you have problems, don’t worry yet, let us try one more thing. Sometime the plugins do cause extra output. This may be the cause. Try disabling all the plugins in your WordPress installation and try. If it works, great! Now, enable the plugins one by one and check to find out the culprit.

If you are not able to connect to your WP still or you have found another solution that I missed here, do let me know. BTW, I am using WordPress 2.1 / PHP 5.2.0

26 Comments

  1. hi
    thanks for ur help but to no avail none of this works for me
    am not able to post

    :-(

    plz help

  2. kannanmr says:

    Problem with connecting to your WP blog itself? Please post more info.

  3. i get the error as u have written above when i use windows live writer to post .
    it used to work fine earlier but now it doesn
    have tried everything but it still gives me the same error

  4. kannanmr says:

    Naven, most of these problems could be tracked down to the XML RPC responses you get from your site. Try snooping for the query/responses and check if there are any extra CR/LF or malformed tags (which I doubt!) from your site, when you connect using Windows Live Writer.

    I just checked your site and it shows a number at the beginning of the XHTML before the DOCTYPE tag. You need to remove the code/plugin, whatever is causing this to be there. I think your host, Phpnet, is injecting this. Better confirm with them also.

  5. i just opened my site and saw the sourece i couldnt see any number u are talking about . anyways i have written to the hosts

    in the mean time it would be great if u could suggest me some gud php mysql supported free wen host . i used phpnet but they have now forced ads and also this posting problem .
    thanks

  6. [...] courtesy of Kannan Ramanathan on Jumbled Thoughts (via Johnny’s Thoughts ) who gives a great walk through on similar issues with other files [...]

  7. MT says:

    Hi Kannan.. great explanations and walk through.

    I wanted to comment here that my xmlrpc.php file *itself* had both a trailing space and a new line. I checked the install files for both versions (2.0.5 versions and 2.1.3) I have handy, and both had the extra characters, which would explain why it’s so widespread. I have no idea, though, why it can take weeks to show up.

  8. Glad it helped. I checked my 2.1.3 xmrpc file, I didnt find any trailing white CR/LFs or White spaces…I guess, WP.org loves inserting these randomly :)

  9. Will says:

    Thanks for putting this together. I’m afraid it doesn’t help me yet, though. I have just moved my WP installation to a remote server and upgraded from 2.1 to 2.1.3. The site runs fine, but I’m having the dreaded WLW problem which I never had before. All of my PHP files including xmlrpc are clean with respect to newlines – the only thing I changed was a newline at the end of xmlrpc. I’m willing to bet it’s a security issue. Running Windows 2003 with IIS for the installation. I’ve given EVERYONE full control of the file. I still have the problem.

    Any ideas/thoughts?

    TIA.

  10. kannanmr says:

    Will, I am not sure what it could be. I am running my WP on a hosted IIS too, but havent faced any security problems. Since you are running your own box, my wild guess would be wrong NTFS permissions, assuming NTFS is what you are using. Note that the file permissions at NTFS level are different from the “Web sharing” permissions. Please check that you have proper permissions set for “Everyone” under the “Security” tab.

  11. anson says:

    Type your comCool…i am very interest in it…
    you might interest my site too..
    http://www.highvisit.comment here.

  12. [...] החדש, ופשוט סירב להתחבר. אחרי הרבה שיטוט ברשת (ראו כאן, כאן ובעוד כמה מקומות) מצאתי שהבעיה אצלי היתה זהה, [...]

  13. Hi Kannan,

    I tried all your remedies but the problem persisted. In suspected my plugins.

    I deactivated all plugins and activated them one at a time, posting with Live Writer after each activation.

    I found the culprit: the “Google Sitemaps” plugin.

    My advice: implement all your remedies + check your plugins.

    Regards,

    Lucky

    //////////////

  14. [...] Windows Live Writer problems with WordPress – How To fix? [...]

  15. barandiaran says:

    Just so simple like removing blank lines in wp-settings.php
    Thankyou!!! i was getting crazy about this!!!!!
    Thanks, thanks, a lot

  16. Kannan R says:

    barandiaran, glad it helped! I can relate to ur “crazyness”..I was feeling that too before I found this fix!

  17. [...] of Google Desktop, that summons search bar) and pasted the error text there. First, I came across this article. I followed every step in it (some of them twice ), but it didn’t help. So I kept [...]

  18. Sergei says:

    Hi,
    I had encountered alternate problem.
    Here it is with a solution :-)

  19. [...] I find another post on here: 1. First step is to check the security part. Make sure your xmlrpc.php in the WordPress root [...]

  20. chris says:

    Sadly none of this works for me.

    - I’m running IIS6/Win2k3
    - I confirmed Read/Execute permissions for everyone/IUSR on xmlrpc.php
    - I removed all blank lines from top/bottom of xmlrpc.php and other files.
    - I confirmed wordpress is setup for both ATOM and XMLRPC publishing
    - I disabled all plugins (still didnt work)

    Help! :(

  21. smrtinker says:

    has similar issue connecting from the live writer to wordpress – tried removing the preceding and trailing white spaces in several files, changing the paths names in the xmlrpc and reloading into the root folder, as mentioned by many people on numerous blogs. None of that really helped.

    For a few hours, I banged my head on to my laptop, pulled my hair till I almost lost all of it, and then suddenly – bang! found the solution…it’s actually very simple and I don’t the reason why. Anyways, here’s what I did.

    Just for the heck of it, to give it a try, simply created a new user id with admin rights, that’s it, it started working. But, there’s another error which I’m getting now i.e.,
    “The response to the metaWeblog.editPost method received from the blog server was invalid:Invalid response document returned from XmlRpc server”. Haven’t yet tried any of the tips/tricks out there…Hope this works!

  22. if you look for another good webhosting that you can host you’r blog, you can write me an e-mail and i will give you a very fast and reliable webhosting package… have you any newsletter that i can get?
    thanks for an answer
    rocco

  23. [...] החדש, ופשוט סירב להתחבר. אחרי הרבה שיטוט ברשת (ראו כאן, כאן ובעוד כמה מקומות) מצאתי שהבעיה אצלי היתה זהה, [...]

  24. Sylvain says:

    Well, it looks like that even in 2010, there are still a lot of potential communication problems between Windows Live Writer (WLW) and a PHP based XML-RPC blog server.

    On my blog, I’ve recently posted an article on how to solve many of these problems by first identifying them precisely using either the log file of WLW and/or an HTML traffic capturing tool such as Fiddler. Beside the log file and Fiddler, this article also covers in detail some of the most common problems such a the presence of an UTF-8 BOM at the beginning of one of the PHP script files or the presence of extraneous characters at either the beginning (before the opening tag ) of one of those PHP script files.

    You can find this article there:

    http://coding-paparazzi.sylvainlafontaine.com/2010/02/solving-connection-problems-wlw.html

    In the second part (soon to be published), I will cover the problem of the presence of Warning and of Fatal PHP error messages in the XML-RPC response file. Fatal errors are usually the result of some kind of error in the PHP code but you can get a Warning error message simply by having a badly set php.ini file; so it’s often simply a local configuration problem of PHP.

Leave a Reply