Welcome Guest, Not a member yet? Register   Sign In
Creating my XML-RPC server
#1

[eluser]a77icu5[/eluser]
Code:
<?php
class Server extends Controller {

    public function __construct() {
        parent::Controller();
        $this->load->model('my_model');
    }
    
    public function index() {        
        $config['functions']['demo'] = array('function' => 'Server.process');
        $this->xmlrpcs->initialize($config);
        $this->xmlrpcs->serve();
    }
    
    
    public function process($request) {
        $parameters = $request->output_parameters();
        $data = $this->my_model->getAll();
        if (sizeof($data) == 0) {
            return $this->xmlrpc->send_error_message('123', 'Requested data not available');
        } else {
            foreach($data as $item) {
            $response[] = array(array('id' => $item->id,
                'name'    =>    xml_convert($item->name),
                'city'    =>    $item->city,
                'status'=>    $item->status), 'struct');
            }
            return $this->xmlrpc->send_response($response);
        }
    }
}
?>

Error: 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.

I think is because $response array had wrong format, somebody help me !!!
#2

[eluser]smilie[/eluser]
foreach($datas $item)

should be

foreach($data as $item)

Cheers,
Smilie
#3

[eluser]a77icu5[/eluser]
that was a mistake while writing ... still not working =(
#4

[eluser]Unknown[/eluser]
Hello,

Did you figure out what the issue for this was? I am stuck at the exact same spot. My XML-RPC server always replies with "The XML data receieved was either invalid or not in the correct form for XML-RPC. Turn on debugging ..."

Thanks
#5

[eluser]a77icu5[/eluser]
I finally finished moving the server to soap...
#6

[eluser]WebMada[/eluser]
[quote author="a77icu5" date="1295573280"]I finally finished moving the server to soap...[/quote]
That's too bad! The new server in SOAP is always Code Igniter one?
Me, I have a question, how can a server return an array in Code Igniter XML-RPC? The example given with the user guide is so simple.
#7

[eluser]a77icu5[/eluser]
Make my own wsdl and use the native soap server php functions, now my api works so fu***ing great =D
#8

[eluser]WebMada[/eluser]
That's cool! I've just discovered that CodeIgniter XML-RPC doesn't manage SSL and there is no project about SOAP in CI, that's too bad. Some of us have chosen using framework to simplify our tasks ...
#9

[eluser]a77icu5[/eluser]
The api soap based with php native functions and the webapps with codeIgniter is a great combination. The reason to move my api to soap is that I need to work with php and c# at the same time, soap in c# seems more "natural" that XML-RPC (I guess) but the framework in the webapps makes my life so easy.




Theme © iAndrew 2016 - Forum software by © MyBB