[eluser]axiom82[/eluser]
This regards the XMLRPC library.
Please review lines 259 - 283 in /system/libraries/Xmlrpcs.php.
When the method you are mapping your server requests to is not part of the CodeIgniter super object (e.g. Blog.update_post), the is_callable function causes the execution of the method to fail.
The problem is more significant actually . It seems that the class part of the mapped method (e.g.'Blog' in Blog.update_post) is ignored and considered as the Xmlrpc_server class itself. Therefore, Blog.update_post really leads to Xmlrpc_server.update_post. If this is true, then the method checking itself is fine and the actual method assignment code would be to blame.
Here is my implementation for reference:
XMLRPC POST Request URI
Code:
http://localhost/index.php/xmlrpc_client/request/update_copy_category
XMLRPC Client
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Xmlrpc_client extends Controller {
function request($method){
$this->load->library('xmlrpc');
$this->xmlrpc->server(site_url('xmlrpc_server'), 80);
$this->xmlrpc->method($method);
$data = array(array($_POST, 'struct'));
$this->xmlrpc->request($data);
if ($this->xmlrpc->send_request()){
$response = $this->xmlrpc->display_response();
if (!empty($response)) echo $response;
}
else echo $this->xmlrpc->display_error();
}
}
/* End of file xmlrpc_client.php */
/* Location: ./system/application/controllers/xmlrpc_client.php */
XMLRPC Server
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Xmlrpc_server extends Controller {
function __construct(){
parent::__construct();
$this->load->library('xmlrpc');
$this->load->library('xmlrpcs');
}
function index(){
$config = array(
'object' => $this,
'functions' => array(
'copy_category_update' => array('function' => 'Copy.category_update')
)
);
$this->xmlrpcs->initialize($config);
$this->xmlrpcs->serve();
}
}
/* End of file xmlrpc_server.php */
/* Location: ./system/application/controllers/xmlrpc_server.php */
?>
XMLRPC Server-Mapped Class & Method
Code:
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
class Copy extends Controller {
function __construct(){
parent::__construct();
$this->load->model('copy_model');
}
function category_update($request){
$data = $request->output_parameters();
$data = $data[0];
if (isset($data['id'])){
$category_id = $data['id'];
unset($data['id']);
if (count($data)){
$this->copy_model->category_update($category_id, $data);
}
}
return $request->send_response(null);
}
}
/* End of file copy.php */
/* Location: ./system/application/controllers/copy.php */