Supertext Home
Chief of the System Blog

Archive for the 'PHP' Category


blogger.getUsersBlogs method received from the blog server was invalid

Wednesday, July 13th, 2011

Invalid response document returned from XmlRpc server

I’m using Windows Live Writer to publish to my WordPress 3.2 Blog that runs on a Windows Server 2008 R2. This all worked fine for a while until I upgraded the blog today. Now I got the following error message:

 

Can’t connect to your blog service:

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

Invalid response document returned from XmlRpc server

Please try fixing the problem and then try again.

 

Lovely. Try fixing the problem or call the system administrator. Unfortunately I’m the administrator, so nobody there to call.

But then I remembered that I had a similar issue a while back. I wrote about it in the post WordPress XML-RPC Issues.

And, oh wonder, this solved the problem again!

Quick repetition:

Edit the class-IXR.php file from the wp-includes directory. Change

header(‘Content-Length: ‘.$length);

to

header(‘Content-Length: ‘.$length + 2);

And you are fine until next time.


Can’t save new post with WordPress 3.0

Friday, September 10th, 2010

After upgrading WordPress to 3.0 and then to 3.0.1 I couldn’t save newly created posts anymore.

Creating new users didn’t work either.

Turns out there is a problem with the DB tables. For some reason some of the fields don’t have default values and if you try to save something, the save SQL operation fails.

You can easy check if you have the same issue:

Just add define(‘WP_DEBUG’, true); to your wp-config.php file and then you should see the error messages.

To fix it, just run this query:

ALTER TABLE wp_posts CHANGE COLUMN post_mime_type post_mime_type VARCHAR(100) NOT NULL DEFAULT ”;

Same for creating a new user. This is the error message:

WordPress database error: [Field 'user_activation_key' doesn't have a default value]

INSERT INTO `wp_users` (`user_pass`,`user_email`,`user_url`,`user_nicename`,
`display_name`,`user_registered`,`user_login`) VALUES (‘$P$BdvJNscOoULkBECWck8tL0′,’natasa@email.ch’,
‘http://www.supertext.ch’,'natasa’,'Natasa’,
’2010-09-10 15:08:08′,’Natasa’)

And this is the solution:

ALTER TABLE wp_users CHANGE COLUMN user_activation_key user_activation_key VARCHAR(60) NOT NULL DEFAULT ”;

Maybe there are other places where something similar is missing. I’m sure you can fix it in the same way.


WordPress XML-RPC Issues

Wednesday, May 5th, 2010

After upgrading my wordpress blog I could not connect my Windows Live Writer anymore. Funny enough it will worked with my other blog (blog.supertext.ch). The only difference that I could find, was that remy.supertext.ch was configured to use iso-8859-1 and blog.supertext.ch used utf-8. But changing that did not actually help. Could be that the issue is some info that is still in the database.

Using the WordPress iPhone App, I got the following error:

NSXMLParserErrorDomain error 73

Does not really help either. But I found some posts, suggesting all kind of things that all didn’t apply or work.

Now, getting a little desperate, I installed Fiddler (which is really an awesome tool) and discovered that if I rerun the rpc call that Windows Live Writer is doing, I get a Content-Length mismatch Error:

image

Here is the request in raw form, you can try it yourself to see what results you get. Password/Username do not matter for the test, but you have to set the POST and Host value correctly:

POST http://blog.yourhost.ch/xmlrpc.php HTTP/1.1
Accept: */*
Accept-Language: en-US, en, *
User-Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Writer 1.0)
Content-Type: text/xml
Host: blog.yourhost.ch
Content-Length: 491
Connection: Close

<?xml version="1.0" encoding="utf-8"?>
<methodCall>
 <methodName>blogger.getUsersBlogs</methodName>
 <params>
  <param>
   <value>
    <string>ffffffabffffff716</string>
   </value>
  </param>
  <param>
   <value>
    <string>admin</string>
   </value>
  </param>
  <param>
   <value>
    <string>password</string>
   </value>
  </param>
 </params>
</methodCall>

I don’t really have an idea on how to fix this for real, but what helped is to just add 2 to the length of the response. Edit the class-IXR.php file from the wp-includes directory on line 396. I’m using WordPress Version 2.9.2

function output($xml) {
    $xml = '<?xml version="1.0"?>'."\n".$xml;
    $length = strlen($xml);
    header('Connection: close');
    header('Content-Length: '.$length  + 2);
    //+2 Solves the Live Writer issue
    header('Content-Type: text/xml');
    header('Date: '.date('r'));
    echo $xml;
    exit;
}

Just FYI:
I’m using IIS 6.0 on Windows 2003.

  • Topics
  • Archive
  • Subscribe
  • Facebook
  • Twitter