[wp-xmlrpc] Extend xml-rpc

Frank Rust frust at iti.cs.tu-bs.de
Tue Sep 25 12:08:04 UTC 2012


Hi there.

I try to add a new xml-rpc function to wordpress but I can not get it
running.

Here my code (part of a plugin), to keep it simple I took an example
from the web:
<?php
/*
   Plugin Name: Franks WordPress Test Plugin
   Plugin URI: http://www.xxxxx.de/WP
   Description: Das ist mein allererstes WordPress Plugin
   Author: Frank Rust
   Author URI: http://www.xxxxx.de/WP
   Version: 0.0.3
*/

include_once(ABSPATH . WPINC . '/class-IXR.php'); 
include_once(ABSPATH . WPINC . '/class-wp-http-ixr-client.php'); 
 
add_filter( 'xmlrpc_methods', 'fwpr_add_new_xmlrpc_methods' );
function fwpr_add_new_xmlrpc_methods( $methods ) {
    $methods['demo.multiplyTwoNumbers'] = 'multiply_two_numbers';
    return $methods;
}
 
function multiply_two_numbers( $args ) {
    $first  = (int) $args[0];
    $second = (int) $args[1];
 
    return $first * $second;
}

// (...) lots of other code 

I'm running WP 3.4.2 (german).
The plugin is activated, other functions are working well.
And now when trying to call that 'demo.multiplyTwoNumbers' I get the
answer faultCode: -32601
faultString: server error. requested method  does not exist.

So what am I doing wrong? Missing some include or initialization? Is
there possibility to debug those xmlrpc calls?

Thanks in advance for any help,
best regards,
Frank
 
-- 
------------------------------------------------------------------------
Frank Rust                          Institut für Theoretische Informatik
Fon: 0531 3919525               Technische Universität Carolo-Wilhelmina
Fax: 0531 3919529                              Mühlenpfordtstrasse 22-23
Mail: f.rust at tu-bs.de                               D-38106 Braunschweig



More information about the wp-xmlrpc mailing list