Jump to content

XML-RPC Implementation


atitthaker

Recommended Posts

Hi,

I am implementing XML-RPC using PHP and my code are as given below.

Server Code:
<?

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

function stax($ammount)
{       
    //$ammount=$par->getParam(0);
    //$ammount=$ammount->scalarval();
    $ammount=547;   
    $taxcalc=($ammount*12)/100;
    print_r(new xmlrpcresp(new xmlrpcval($taxcalc,"string")));
    return new xmlrpcresp(new xmlrpcval($taxcalc,"string"));
}
stax(547);
//$server=new xmlrpc_server(array("taxcalc.stax"=>array("function"=>"stax")));
?>

and my client code is:

<?php
include("xmlrpc.inc");
$ammount="547.00";
$format=new xmlrpcmsg('taxcalc.stax',array(new xmlrpcval($ammount,"double")));
$client=new xmlrpc_client("/TestAtitWsXmlRpcClient.php","localhost",80);
$request=$client->send($format);
print_r($request);
$value=$request->value();
print($val->scalarval());
?>

As u can see, it is simply manipulating the number and giving the response.

[b]This code is giving me following error:[/b]
Not Found
The requested URL /TestAtitWsXmlRpcClient.php was not found on this server.


--------------------------------------------------------------------------------

Apache/2.0.46 (Red Hat) Server at localhost Port 80
)
Fatal error: Call to a member function scalarval() on a non-object in /var/www/html/trainingweb/modules/test/TestAtitWsXmlRpcClient.php on line 9


I am unable to get the problem as I dont know much abt XML-RPC and the place I got code from has not given enough desc.

Please do the needful.

Thanks
Atit Thaker.
Link to comment
https://forums.phpfreaks.com/topic/26027-xml-rpc-implementation/
Share on other sites

  • 2 weeks later...

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.