-- Ralf Eggert <[email protected]> wrote
(on Wednesday, 15 February 2012, 11:12 PM +0100):
> I managed to build a pingback feature with Zend_XmlRpc_Server and
> Client. Some stuff works fine.
>
> - Sending pingbacks from one page of my project to another page of
> my project.
> - Sending pingbacks from one page of my project to a wordpress blog.
>
> But, whenever I sent a pingback from a wordpress blog to my project it
> does not work. This means the method of my Zend_XmlRpc_Server service
> class is not called (I check this with a log file).
>
> I tracked this down to the raw body that is sent by Zend_XmlRpc_Client
> and a wordpress installation. The Zend_XmlRpc_Client sends this body:
>
> ------------------------------------------
> <?xml version="1.0" encoding="UTF-8"?>
> <methodCall>
> <methodName>pingback.ping</methodName>
> <params>
> <param><value><struct><member>
> <name>0</name>
> <value><string>http://source.url.com/foo</string></value>
> </member></struct></value></param>
> <param><value><struct><member>
> <name>0</name>
> <value><string>http://target.url.com/bar</string></value>
> </member></struct></value></param>
> </params>
> </methodCall>
> ------------------------------------------
>
> This can be handled from Zend_XmlRpc_Server and my service class method
> is called properly.
>
> Now this is the raw body sent by workpress, which is much simpler.
>
> ------------------------------------------
> <?xml version="1.0"?>
> <methodCall>
> <methodName>pingback.ping</methodName>
> <params>
> <param><value><string>http://source.url.com/foo</string></value></param>
> <param><value><string>http://target.url.com/bar</string></value></param>
> </params></methodCall>
> ------------------------------------------
>
> Has anyone any idea why the wordpress call is not handled? It looks much
> clearer to me since it does not use a structure for the params.
The two calls are entirely different. Expressed in PHP, the first one is
doing the following:
ping(array(0 => 'http://source.url.com/foo'), array(0 =>
'http://target.url.com/bar'));
and the second the following:
ping('http://source.url.com/foo', 'http://target.url.com/bar')
As you can see, the first is wrapping the strings inside an associative
array, while the second is sending them as simply strings.
I'm unclear from your email if you are implementing a Zend_XmlRpc_Server
instance that is being pinged by a WP instance, or if you're using
Zend_XmlRpc_Client to ping a WP instance.
If it's the first (implmenting a server), I'd guess that your docblock
parameter definitions are off. Make sure they read as follows:
/**
* WP ping
*
* @param string $source
* @param string $target
* @return WhateverThisShouldReturn
*/
function ping($source, $target)
If it's the second (pinging WP using Client), I can think of two
possible issues:
* The system.methodDescription from the WP XML-RPC server is
incorrectly reporting the types to use, which is causing the Client
to wrap strings in structs.
* You're providing either assoc arrays or objects as arguments to the
client, which is causing them to be emitted as XML-RPC structs
The second is something you can correct in the code. The first you can
also likely correct by calling setSkipSystemLookup(true) on the client
and using call() directly (vs. the fluent interface):
$client->call('pingback.ping', array($source, $target));
Hope these ideas help you diagnose the problem!
--
Matthew Weier O'Phinney
Project Lead | [email protected]
Zend Framework | http://framework.zend.com/
PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
--
List: [email protected]
Info: http://framework.zend.com/archives
Unsubscribe: [email protected]