Welcome Guest, Not a member yet? Register   Sign In
A strange xmlRPC problem,anyone help me?
#1

[eluser]chmod[/eluser]
hello,I use CI's xmlRPC lib to access a XMLRPC server.
the client is :
Code:
$this->load->library('xmlrpc');
            $this->xmlrpc->set_debug(TRUE);
            $this->xmlrpc->server('http://192.168.130.229/middlers/middlerxmlrpcservlet', '8080');
            $this->xmlrpc->method('middler.login');

            $passport = $this->input->post('input_username');
            $password = '{MD5}'.base64_encode(md5($this->input->post('input_password'), TRUE));
            $clientip = '192.168.131.93';

            $request = array(    'pp'   => array($passport, 'string'),
                                'pwd'    => array($password, 'string'),
                                'cip'    => array($clientip, 'string'));

            $this->xmlrpc->request($request);
            if (!$this->xmlrpc->send_request()){
                echo $this->xmlrpc->display_error();

            }else{
                print_r($this->xmlrpc->display_response());
            }


and the Server is JAVA. I am sure the server URL and METHOD is correct.
but when I call server's method,the output is :

Code:
<div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined offset:  0</p>
<p>Filename: libraries/Xmlrpc.php</p>
<p>Line Number: 627</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>
<p>Message:  Undefined offset:  1</p>
<p>Filename: libraries/Xmlrpc.php</p>
<p>Line Number: 627</p>

</div><div style="border:1px solid #990000;padding-left:20px;margin:0 0 10px 0;">

<h4>A PHP Error was encountered</h4>

<p>Severity: Notice</p>

<p>Message:  Undefined offset:  2</p>
<p>Filename: libraries/Xmlrpc.php</p>
<p>Line Number: 627</p>

</div><br />
<b>Fatal error</b>:  Call to a member function serialize_class() on a non-object in <b>E:\AppServ\www\myproject\system\libraries\Xmlrpc.php</b> on line <b>646</b><br />
#2

[eluser]brianw1975[/eluser]
First off, if the xmlrpc response you get has "<h4>A PHP Error was encountered</h4>" in it.. then the server is not Java.

Second, the error is rather obvious "Undefined offset: 0" means that your data array is not working right and that the code is trying to use that array at line 627 repeatedly.

Finally on line 646 of this file E:\AppServ\www\myproject\system\libraries\Xmlrpc.php the function serialize_class() is being used inappropriately.
#3

[eluser]chmod[/eluser]
[quote author="brianw1975" date="1235040630"]First off, if the xmlrpc response you get has "<h4>A PHP Error was encountered</h4>" in it.. then the server is not Java.

Second, the error is rather obvious "Undefined offset: 0" means that your data array is not working right and that the code is trying to use that array at line 627 repeatedly.



Finally on line 646 of this file E:\AppServ\www\myproject\system\libraries\Xmlrpc.php the function serialize_class() is being used inappropriately.[/quote]

maybe,
I am sure the error "A PHP Error was encountered"
is output in my client,not the server's response.

but I only loaded xmlRPC libriary,and not modified the source file libraries/Xmlrpc.php. I have read the file,and can not look for a resolution.

I use xmlrpc libriary refer to the example in CI's notebooks:

Code:
$this->load->library('xmlrpc');

$this->xmlrpc->server('http://rpc.pingomatic.com/', 80);
$this->xmlrpc->method('weblogUpdates.ping');

$request = array('My Photoblog', 'http://www.my-site.com/photoblog/');
$this->xmlrpc->request($request);

if ( ! $this->xmlrpc->send_request())
{
    echo $this->xmlrpc->display_error();
}
#4

[eluser]brianw1975[/eluser]
ok, so you are loading xml from the remote java server and parsing it locally, this means that the xml you are getting from the remote server is not what the php code is programmed to parse.

I would inspect the xml that is being received from the remote server and verify that it is in a proper format.

Gotta make sure that the data you get is actually useful and not some error like "the system is unavailable due to scheduled maintenance"
#5

[eluser]louis w[/eluser]
Did you get it to work? I think it's because your post data is malformed.

Should be:

Code:
$request = array(array(
    'pp'    => $passport
    , 'pwd' => $password
    , 'cip' => $clientip
    ), 'struct');




Theme © iAndrew 2016 - Forum software by © MyBB