Hi, everyone,

I'm using Edd Dumbill's XML-RPC distribution for PHP, and I think I have what is a simple problem, but I just can't figure it out. I've got this code as a server:

<?

include("xmlrpc.inc");
include("xmlrpcs.inc");

function addem($m) {
    $num1 = xmlrpc_decode($m->getParam(0));
    $num2 = xmlrpc_decode($m->getParam(1));
    $temp = "$num1 plus $num2 is equal to ";
    $temp .= $num1 + $num2;
    $r = new xmlrpcresp(new xmlrpcval($temp, $xmlrpcstring));
}

$disp_map = array( "examples.addEm" =>
                         array("function" => "addem"));

$s = new xmlrpc_server($disp_map);

?>

For the client, I've got some Perl code:

#!/usr/bin/perl -w

use strict;
use Frontier::Client;

my $client = Frontier::Client->new
       ( url => "http://www.disserto.com/xmlrpc/addition.php",
         debug => 1);

print $client->call('examples.addEm', 3, 5), "\n";

exit (0);

Pretty simple, right? Here's my results:

---- request ----
<?xml version="1.0"?>
<methodCall>
<methodName>examples.addEm</methodName>
<params>
<param><value><i4>3</i4></value></param>
<param><value><i4>5</i4></value></param>
</params>
</methodCall>
---- response ----
<br />
<b>Fatal error</b>:  Call to a member function on a non-object in <b>/web/disserto/docs/include/xmlrpcs.inc</b> on line <b>176</b><br />
unknown RPC type `br'
at line 1 column 0

Another error I frequently get is this:

Incorrect parameters passed to method: Wanted , got at param )

The error message is very little help.

I'm lost. Any thoughts?

Thanks!

Sean

    its kinda of hard to determine were the br is coming from, you gotta be careful about this extension

    This extension is EXPERIMENTAL. The behaviour of this extension -- including the names of its functions and anything else documented about this extension -- may change without notice in a future release of PHP. Use this extension at your own risk.

    what version of php are you running and on what platform?
    good luck 😃

      Well, the br is, I think, a PHP error getting returned, which, of course, isn't an XML-RPC response. The error inside, "Call to a member function on a non-object in /web/disserto/docs/include/xmlrpcs.inc on line 176", is what I'm worried about.

      PHP 4.2.1 on Apache Linux. This will eventually be ported to PHP 4.2.3 on Apache 2 on Win2K.

      Thanks,

      Sean

        I would try and see what member functions exist for the object
        [PHP
        $methods = get_class_methods(get_class($OBJ));
        print_r($methods );
        [/code]
        I ran into this problem when i was trying to experiement with DOM (Document Object Model) extension and found out that the methods that I was using didnt exist in the implementation but did in the documentation (4.0.6). It was very painful to find out the some of the methods didnt exist or didn't have an implementation

          Well, I can't even really get that far because I've got a basic PHP error that's stopping me. I think. Will what you're suggesting be cut off at the pass by that error?

          Thanks,

          Sean

            if you do it right before it should print all of it out untill the fatal error

              15 days later

              Hi Mate,

              I have used this xmlrcp library extensively during the last month or so. I have php on the server side and java on the client side, and to make things easier to test as I wasnt fortunate to be coding the client side, I wrote my own client side test routines.

              This allowed me to elliminate the client and the any other issues, and it has worked very well, so what I would suggest is to write a test client in php using the same libaries as you can then enable debugging in the php rpc functions which has been a life saver for me.

              Then once you get it working then move onto the client in the destination code.

              Hope this helps 🙂

              Shaitan

                Write a Reply...