Fix For Problems between Windows Live Writer and Wordpress

by ToriDeaux on May 9, 2007


UPDATE 2: WLW Image Issue Update Workarounds for large image problems

UPDATE 1: WLW version Beta 2 Solves several issues.


There have been reports of intermittent problems between MS Windows Live Writer and WordPress installations for a while. I’d been glitch free until sometime last week, when the problems hit me out of the blue. After a lot of fussing, an upgrade and even more fussing, I’ve found the problem and the solution. Yay for geek-girl!

First The Fix:

  1. Remove any trailing spaces in the xmlrpc.php file.
  2. Be happy.

Now The Explanation:

The Problem: The first hint of trouble is usually errors returned from WLW image publishing features. Next, publishing posts even without images returns errors. Then nothing works anymore - It reached a point that couldn’t edit the settings for the web-log, couldn’t retrieve old posts, etc.

WLW was reporting a number of errors, including:

  • An error occurred while attempting to connect to your web-log: Invalid Server Response - The response to the blogger.getUsersBlogs method received from the web-log server was invalid. You must correct this error before proceeding.
  • The response to the metaWeblog.newPost method received from the web-log server was invalid.
  • The response to the metaWeblog.getRecentPosts method received from the web-log server was invalid

The Search for a Solution: Like any good pseudo-geek girl, I hit Google looking for answers. I found a few. None worked for me (I’ll share them at the end of this post though, just in case) I finally found my problem thanks to a hint about trailing spaces I got from Johnny’s Thoughts and playing around with Fiddler as he did.

I finally found the issue:

The xmlrpc.php bundled with WordPress 2.1.3 (and 2.0.5, and probably many other versions) contains trailing spaces.

That means there are space characters after the closing tag. (The closing tag looks like this: ? > )

This can cause problems for WLW and other XML stuff, as well. I deleted the trailing spaces, new lines, and anything else after that close tag… and tada, everything worked again.

Longer Version Of The Fix (for the technologically intimidated):

  1. Using either FTP or CPanel, navigate to your WordPress root directory.
  2. You should find the file “xmlrpc.php” there. Make a back up copy of it, just in case.
  3. Open xmlrpc.php in an editor
  4. Go to the end of the file.
  5. Put your cursor after the final ?>
  6. Delete anything there, including spaces, or blank lines.
  7. Save the edited xmlrpc.php back to your WordPress root directory.

8. Tada.

No more errors.

ALSO CHECK:

wp-blog-header.php, wp-config.php, wp-settings.php

Info courtesy of Kannan Ramanathan on Jumbled Thoughts (via Johnny’s Thoughts ) who gives a great walk through on similar issues with other files that can cause errors with WLW. I found his post while getting Johnny’s URL for this post…I should have read better in the first place!

Other Possible Solutions:

If you’re still having troubles after fixing the trailing spaces/lines here are a variety of other solutions I ran across in various places on the web:

  • Add the following code to .htaccess :
    <Files xmlrpc.php>
    SecFilterInheritance Off
    </Files>
  • Ask your web/blog host if they’re blocking xmlrpc.php via mod_security
  • Switch to the WP default theme, and try WLW again. If it works, there may be issues in your theme. (most likely the trailing spaces issue again)
  • Deactivate all plugins, and try WLW again. If it works, reactivate the plugins one by one, checking WLW at each step to find the culprit.
  • Reinstall Wordpress in case you’ve somehow corrupted your copy — but if you do, be sure and check the xlmrpc.php for trailing spaces!

And a hat tip to Windows Live Writer Plugins for the simple advice on the security issues, and a big a thank you to HostDime’s Support Team, who are always happy to help.


MindTWEAK: Code *is* Poetry. But it’s bad poetry when it doesn’t parse.




More Posts In This Series:
  1. Fix For Problems between Windows Live Writer and Wordpress
  2. The Latest, Greatest Windows Live Writer: Beta 2
  3. Update: Windows Live Writer Image Upload Issues



{ 42 comments… read them below or add one }

1 Windows Live Writer and Wordpress 2.x - problems? Yup! at Samurai Developer 05.12.07 at 1:32 am

[...] All I can say is that if you are having problems with this combo, take a look at your xmlrpc.php file, if there are any extra spaces or newlines at the end of the file, kill them. Thanks to the good folks at MindTweaks for the hint! [...]

2 Will 05.13.07 at 3:57 pm

Thanks for the comprehensive run down. After fixing ALL this stuff, I still have a problem - well, not the .htaccess fix since I’m running IIS. I know I’m pushing my luck here, but did you run across any other good resources?

TIA.

3 M.T. 05.13.07 at 8:59 pm

You’re welcome, Will - Sorry you’re still having troubles. I think I listed all of the fixes I found. What kinds of errors are you getting? Did LiveWriter ever connect to your blog?

4 Soulhuntre 05.15.07 at 11:05 pm

This is SOO frustrating. Windows Live Writer is a good tool, but it looks like development for it is just dead.

Serious bummer.

5 Whats up with Windows Live Writer? (http://www.cogmios.nl - Edward de Leau) 05.25.07 at 7:09 pm

[...] Possible fix for WLW and WP posting problems: http://www.mindtweaks.com/wordpress/?p=233 [...]

6 Albert 06.04.07 at 2:16 am

Deactivate all the plugins,then reactivate one by one,I find that it is the smart archive plugin cause the problem,thanks.

7 M.T. 06.08.07 at 2:00 am

Glad you found your problem, Albert :) Thanks for letting us know.

8 Milad 06.09.07 at 3:39 am

Hi, Thanks a lot for all the time you put on this!
I am having somewhat weirder problem.

I can’t seem to make a connection to my wordpress, let alone the xmlrpc access.
I get Network Connection Error.
I used to be able to post before, but now I can’t.
What do you think I should do?

9 Rick 06.09.07 at 1:45 pm

Evidently, this has been fixed in 2.2, and I’m still having problems with it. I’m frustrated, also. It’s too bad just a promising program, and from such a huge company, is so bug-ridden.

10 M.T. 06.09.07 at 11:48 pm

Milad, Double check your address info — I had trouble getting it set up the first time.

And have you tried uninstalling and reinstalling Live Writer from scratch? If you’re up to looking under the hood, download Fiddler and see if it tells you anything.

Rick, sorry about the frustration… I do understand it! But to be fair, WLW *is* only in beta, so it’s supposed to have bugs.

Have ya’ll tried some of the alternatives? Blogjet or Blogdesk? They aren’t as pretty, but they’re pretty stable.

11 manan.catch-free.com » Blog Archive » Windows Live Writer - A Small Review 07.30.07 at 9:36 am

[...] entry the funny part is that the entry will be published but wont be updated in the WLL … this link will [...]

12 Clickfire 10.31.07 at 10:02 pm

SecFilterInheritance worked for me. Thanks for this post. I have been looking everywhere for a solution.

13 phil 12.06.07 at 11:10 pm

Great post.

This just in (in other words, I’m posting too soon) but disabling Ultimate Tag Warrior 3.14159265 (the 1st I tried of many plugins) immediately fixed “metaWeblog.getRecentPosts” invalid.

Error appeared trying to retrieve posts from blog. Pages listed OK, only posts errored.

Modding .htaccess with your code produced internal server error 500, so we’ll just tread quietly away from that.

I’m using a theme on 3 blogs, two affected and the third not. Suspect update to current (Dec 07) WLW as the third OK blog hasn’t been touched by WLW yet. WP version 2nn - can’t verify from here at work.

14 M.T. 12.10.07 at 3:18 pm

Thanks Phil…

I haven’t encountered the problems in a long time - supposedly some of them were fixed with the latest update, but there are always new errors cropping up.

I am getting some issues with the full release version, errors when i try to change the font size, and a new and bizarre drag/drop paragraph function in layout mode that makes me insane. I haven’t tried to fix it yet, though.

Please keep posting your fixes, lots of other folks do seem to wind up here looking for help.

15 David 12.19.07 at 10:30 pm

One other solution I just found here (http://wordpress.org/support/topic/118630) that solved my problem was increasing the amount of memory for PHP. I couldn’t post anything with an image in it, until I bumped the memory limit above 8M.

16 Devlin 01.10.08 at 11:19 pm

Have you got any information about a somewhat-common time problem? All WordPress posts submitted from WLW ends up written five hours in the future! I’m unable to find anything about this on Google and any help would be appreciated.

17 MT (that MindTweaks Chick) 01.11.08 at 4:04 pm

Hey Devlin…

Turns out you’re in luck - there’s a discussion of this problem on the WLW MSN Community, complete with a work around. You can find it here: http://tinyurl.com/2hdge5

Hope it helps!

For General WLW Reference: The community board is quite helpful and the developers often read/respond directly. Incase the tinyurl above doesnt work, the home page is: http://groups.msn.com/WindowsLiveWriter/

:)

18 Qumana, Windows Live Writer, Login Problem | Internet Insight 02.28.08 at 7:25 pm

[...] Solution’s given by Sueblimely in THC’s blog gave me hints how this might be fixed and also a link to MindTweaks website where i might could find sollution for this lil problem. MindTweaks solution’s can be found here [...]

19 Wordpress 2.5.1 xmlrpc.php and HTTP 500 errors | Shawn's Thoughts 06.01.08 at 12:58 am

[...] tried everything I can think of - chmod’ing files, reinstalling WP files, etc. I even found folks having similar errors saying it was because of junk at the end of the xmlrpc.php file. I still get the errors. If anyone [...]

20 Harsh 06.10.08 at 11:05 am

Hey the thing about “REmOVINg SpaCes AftEr ThE ?>” thing really workd…

But tell me one thing : is XML/HTML not supposed to discard white spaces after the tags are closed???

21 Harsh 06.10.08 at 11:05 am

Anyway Thanks for the great help!!!

22 Tori Deaux 06.10.08 at 4:35 pm

You’re welcome for the help, Harsh, glad it’s working for you :) I’m not a good enough geek to fully explain the whitespace issue, but the files we’re dealing with are php, not html — and trailing whitespace in php often causes problems, from what little I know.

23 Sakach 07.09.08 at 3:35 pm

There is an error in some versions of xmlrpc.php.

In

"function mw_newPost()"

this line about halfway in the function is incorrect, and will show up in the log of the latest version of Windows Live Writer.

logIO(’O', ‘Post cats: ‘ . printr($catnames,true));

printr is not a PHP function nor is it defined in the WordPress code.

Instead of “printr”, the correct function name is “print_r”

logIO(’O', ‘Post cats: ‘ . print_r($catnames,true));

24 Marco Rubio 01.23.09 at 12:10 am

My problem was I have my WordPress blog in the wordpress folder of my website and Windows Live Writer can not opened it because the xmlrpc.php file was not in the main root but in the /wordpress/ path and there is not an alternative option to configure that way.

I dowload the xmlrpc.php file from the http://www.myblogsite.com/wordpress/ folder and edit the following lines in it:
- I changed this line -
include(‘./wp-config.php’);

- to this line -
include(‘./wordpress/wp-config.php’);

- I changed this line -
include_once(ABSPATH . ‘wp-admin/admin-functions.php’);

- to this line -
include_once(ABSPATH . ‘wordpress/wp-admin/admin-functions.php’);

Then I uploaded the xmlrpc.php file to the main root http://www.myblogsite.com/

After this the Windows Live Writer allowed me connect to my WordPress blog. Then I could changed the default path from http://www.myblogsite.com/xmlrpc.php to http://www.myblogsite.com/wordpress/xmlrpc.php

I hope this can be helpful to anyone else.

Marco Rubio.
abigchild@hotmail.com
Monterrey, Mexico.

25 Nikhil 06.01.09 at 11:14 am

Working for me… thx

26 Advantage Plans 06.29.09 at 1:55 pm

I am browsing to find a solution to my problem: out of the blue, nothing changed, I can’t connect to my WP blog anymore with WLW. Error ‘An unexpected error has occurred while attempting to log in: Network Correction Error ‘. Nothing has changed, and others from other computers can still connect. I’m pulling my hair out to find a solution… WLW is great while it works, but I’m also having lots of trouble with it…

27 WLW Errors | NGPriest’s Blog 08.01.09 at 12:11 pm
28 smrtinker 08.02.09 at 8:28 pm

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!

29 bagas 08.13.09 at 10:43 am

Really, really thank you so much. I tried modifying the .htaccess, and deactivating plugins with no results. I almost gave up, but I tried cleaning up the spaces in my theme files. Voila! Haha,,
Again, thanks!

30 Yohan Perera 09.28.09 at 7:57 am
31 LiveWriter not displaying tags in WordPress - Resolved | Anthony Lepki 01.22.10 at 1:13 am
32 Lepki 01.22.10 at 1:16 am

Great troubleshooting post!!!

After trying all the items in this post and contacting hosting company, turns out that making a change in your web hosting setting worked for me. Instead of PHP5, use PHP4 - all is good!

Here is how I did it

http://www.anthonylepki.com/livewriter-not-displaying-tags-in-wordpress-resolved/

Simple change and works great!

33 David Coburn 01.24.10 at 6:19 am

I am having a proble with WLW concatenating urls
It uses dashes (“-”) for the inital half then it just combines words. Has any one come accross this ? if so is there a solution
By the way can you edit the post url for WP through WLW ?

34 Brenton Blawat 02.19.10 at 11:00 am

I have a silly issue with Live Writer and Wordpress. I frequently update my posts as much as I switch computers. When I switch computers I copy My WeBlog Posts directory — in addition to all of my files in My Documents. The result is an issue that really is irritating. When I update the blog post, it treats the updated post as a new post, rather than updating the post that already exists. It also appends an “-2″ at the end of the post… and here in lies my problems. — When I try to update the post URL to be without the ‘-2′ it claims the post exists (which it does)… and when I try to delete the first post — I never lets go of the origional URL and still claims it still exists. >:(

Anyone run accross a fix for this? — Or am I going about something wrong?

Thanks!

-Brent
Brenton Blawat’s last post:     Default Domain Policies Windows Server 2003 SP2 / Windows server 2008 R2

35 Tori Deaux 02.19.10 at 2:17 pm

Hi Brenton - I’m not sure I’m following, but if I’m understanding right… when you switch computers, you’re copying over all of the files from your WLW over, too?

Why not just create a fresh install of WLW on the new system, and save the posts and drafts in your Wordpress installation? Just be sure to click the “post drafts online” option instead of “save draft online” then you can access them through the right sidebar.

If I’m completely misunderstanding, maybe someone else will have a suggestion :)

36 Brenton Blawat 02.19.10 at 3:22 pm

My apologies if I was not clear -

I did the following:
1. Upgraded to Windows 7
2. Install Windows Live Writer
3. Copy the ‘Documents folder’ to ‘Documents’ on the new OS
4. Windows Live Writer recognizes all of my drafts and posts (in the side bar).
5. I select a Recently Posted: Blog Article
6. Make Changes -> Publish
7. New Post is created -> Does not Update the Existing Post.

It doesn’t matter if it is the same computer being upgraded // or my desktop computer at home with the same OS // The Posts do not update on a fresh install of Windows Live Writer.

Please note: After #7 and a new Post is created -> I can update this Post without the creating a new one.

Its like there are GUIDs that are not matching up??
Brenton Blawat’s last post:     Default Domain Policies Windows Server 2003 SP2 / Windows server 2008 R2

37 Sylvain 03.03.10 at 3:48 pm

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

On my blog, I’ve recently posted the first part of an article on how to solve many of these problems by first identifying them precisely using the log file of WLW and/or an HTML traffic capturing tool such as Fiddler:

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

Beside the log file and Fiddler, this part one covers the specific problems of the presence of a an UTF-8 BOM at the beginning of one of the PHP script files (often, this will be the wp-config.php file in the case of WordPress) and of the presence of extraneous characters at either the beginning (before the opening tag ) of one of the PHP script files.

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.
Sylvain’s last post:     Solving the connection problems of Windows Live Writer (WLW), Part 1

38 Jeff B 04.13.10 at 11:21 am

My issue turned out to be the redirect plugin. Deactivated it and I was able to post just fine. The addition to the .Htaccess file caused issues with my blog so be sure to back up before changing.

Because of your post I started to look at the plugins. Thank for the great information.
Jeff B’s last post:     Mobile Defense Scares The Hell Out Of Thieves

39 Remy 05.06.10 at 12:11 pm

I also had issues with Windows Live Writer after a blog update. In my case xml-rpc.php returned the content length not accurate. I’m running php on an IIS6.0 Server. I have 2 blogs on it, but it only happens on one of them. No idea why?

I had to change the file class-IXR.php and hacked it to add 2 bytes to the content length. Seems to work so far.

More info here:
http://remy.supertext.ch/2010/05/wordpress-xml-rpc-issues/

Good luck!

40 Windows Live Writer WordPress 500 Internal Server Error | Mike's Mostly Tech blog 06.08.10 at 8:53 pm
41 TheDataEnthusiast 07.31.11 at 11:10 pm

Thanks I also found a fix to this. Same exact problem as your but what it was …was that I started using the “W3 Total Cache” Plugin and it modified my wp-config.php file and did not put a ‘?>’ at the end (it just wasn’t there). Hence, I added it and viola!! All happy now… :)

42 Suresh Kumawat 12.26.11 at 2:53 am

Hi,

I am following the code problems. When I make the post live on WordPress, The post came with the HTML code as it is in HTML editor.

The live writer is not identifying the HTML codes. I already had a chat about this problem with WordPress site hosting but I was told that this problem belongs to the live writer not to us.

So what I do. Please let me know. If their is a better solution.

I would be very graceful for you.

Looking for your positive response

Regards

Suresh Kumawat

MindTweaks