On 7/20/07, Ralph Schindler <[EMAIL PROTECTED]> wrote:

Perhaps this is a case of trying to hitting a nail with a sledgehammer,
I dunno.  I simply want to expose a single method to handle only one
xmlrpc.  Basically, this is implementing pingback functionality of blog
software.  The XmlRpc request looks like this:

<?xml version="1.0"?>
<methodCall>
<methodName>pingback.ping</methodName>
<params>
<param><value><string>http://xxx.dev/wordpress/?p=14</string></value></param>
<param><value><string>http://yyy.dev/blog/2007/07/18/test-test-test</string></value></param>
</params></methodCall>



My rpc controller looks like this:


//url: /blog/rpc/pingback
class Blog_RpcController extends Blog_AbstractController
{

     public function pingbackAction()
     {
         $this->_helper->ViewRenderer->setNoRender();
         $this->_helper->LayoutManager->useLayoutName(false);

         $server = new Zend_XmlRpc_Server();
         $server->setClass('Blog_RpcController', 'pingback');
         $server->handle();
     }

     public function ping($var1, $var2)
     {
         // what here?
     }

}

require_once 'Zend/XmlRpc/Server.php';

class Foo {
 /**
  * @access static
  * @param  string|base64 $url
  * @return   void
  */
 static function pingback($url)
 {
   // do something here
 }
}

$server = new Zend_XmlRpc_Server();
$server->setClass('Foo', 'ping');
echo $server->handle();


Which binds class 'Foo', with prefix ping.

Because you have a static method pingback, you get:

ping.pingback($url)

The essential part is also the documentation (phpdoc) of your class.
Without the documentation the reflection API will not be able to "make
it work". It's an essential part.

Just a quick rundown - I'd also look into binding an exception class
so it gets automatically converted to an XMLRPC fault, etc..

http://framework.zend.com/manual/en/zend.xmlrpc.server.html

Cheers,
Till

Reply via email to