Welcome Guest, Not a member yet? Register   Sign In
xml-rpc debugging
#1

[eluser]JanDoToDo[/eluser]
hey guys,

i just tried to implement the xml rpc class following the user guide and copying code exactly and i get this error message:

The XML data receieved was either invalid or not in the correct form for XML-RPC. Turn on debugging to examine the XML data further.

Could someone let me know how to turn on xml rpc debugging? Or try and find out where the error is ffrom the user guide?

The client is:
Code:
class Xmlrpc_client extends Controller {
    
    function __construct()
    {
        parent::__construct();
    }
    
    function index()
    {    
        $this -> load -> helper('url');

        $this -> load -> library('xmlrpc');
        $server_url = 'http://www.mydomain.org/import_data/webservice_dave';
        $this -> xmlrpc -> server($server_url, 80);
        $this -> xmlrpc -> method('getOrderDetails');

        $request = array(array(array('username'=>'delagua'), 'struct'), array(array('password'=>'admin123!'), 'struct'));

        $this -> xmlrpc -> request($request);    
        
        if ( ! $this -> xmlrpc -> send_request()) :
            echo $this -> xmlrpc -> display_error();
            echo "hi";
        else :
        echo "2";
            echo '<pre>';
            print_r($this -> xmlrpc -> display_response());
            echo '</pre>';
        endif;
    }
}


The server is copied from the user guide as such:
Code:
function webservice_dave()
    {
        $this -> load -> library('xmlrpc');
        $this -> load -> library('xmlrpcs');
        
        $config['functions']['getOrderDetails'] = array('function' => 'import_data.get_order');
        $config['object'] = $this;

        $this -> xmlrpcs -> initialize($config);
        $this -> xmlrpcs -> serve();
    }
    
    function get_order($request)
    {
        $username = 'delagua';
        $password = 'admin123!';

        $this -> load -> library('xmlrpc');
    
        $parameters = $request -> output_parameters();
    
        if ($parameters['1'] != $username AND $parameters['2'] != $password)
        {
            return $this -> xmlrpc -> send_error_message('100', 'Invalid Access');
        }        
        $response = array(
                            array(
                                    'you_said'  => $parameters['1'],
                                    'i_respond' => 'Not bad at all.'),
                            'struct');
                                
        return $this -> xmlrpc -> send_response($response);
    }
#2

[eluser]JanDoToDo[/eluser]
Anyone? Smile
#3

[eluser]JanDoToDo[/eluser]
Solved
#4

[eluser]gvillavizar[/eluser]
Hi JanDoToDo, if you found an answer you can post it here so everyone with the same problem can have its solution without asking. Smile
#5

[eluser]JanDoToDo[/eluser]
Yeah sure - it was pretty simple! As per the user guide for xml-rpc - debugging is turned on with $this -> xmlrpc -> debug(TRUE) and then that gives you all the errors. In my case, the request array was incorrrectly formatted




Theme © iAndrew 2016 - Forum software by © MyBB