[wp-xmlrpc] Extend xml-rpc

Marko Heijnen mailing at markoheijnen.nl
Tue Sep 25 12:21:38 UTC 2012


Hey,

First of all including IXR isn't needed at all. Don't think that causes issue tho. Looking at the code it does seems fine.
You can try to set WP_Debug on or check your php error log.

Marko

Op 25 sep. 2012, om 14:08 heeft Frank Rust <frust at iti.cs.tu-bs.de> het volgende geschreven:

> 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
> 
> _______________________________________________
> wp-xmlrpc mailing list
> wp-xmlrpc at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-xmlrpc



More information about the wp-xmlrpc mailing list