I finally got it to work at home, but using the same sources and versions, it doesn't work at work. Only difference is, that the PHP server is running on linux at home and ms iis at work. But that shouldn't make or brake it, should it?
----- Original Message -----
Sent: Wednesday, May 19, 2004 3:47 PM
Subject: RE: Always get "unknown method" with PHP server

Hi Alexander,
 
The error is in the declaration of your function:
 
Change the following:
new XML_RPC_Server(array('sample.sumAndDifference' =>
array
('function' => 'sample.sumAndDifference',
'signature' => $sumAndDifference_sig
,
'docstring' => $sumAndDifference_doc)));

Hope this helps.
 
 
 
-----Original Message-----
From: Alexander Langer [mailto:[EMAIL PROTECTED]
Sent: May 19, 2004 05:32
To: [EMAIL PROTECTED]
Subject: Always get "unknown method" with PHP server

Hi there!
 
I'm about to implement some communication between a PHP XML-RPC server and a Java client. The server is doing fine, a PHP client is working perfectly, but I just can't get a Java client to work. Every time I get a "Error: Unknown method".
 
I'm now at a point where I try to connect to a PHP server sample script, which looks like this:

<?php

require_once
("XML/RPC/Server.php");

function sumAndDifference
($params) {
$xval = $params->getParam(0);
$x = $xval->scalarval();
$yval = $params->getParam(1);
$y = $yval->scalaraval();

$struct = array('sum' => new XML_RPC_Value($x + $y, 'int'),
'difference' => new XML_RPC_Value($x - $y, 'int'));
return new XML_RPC_Response
(new XML_RPC_Value($struct, 'struct'));
}

$sumAndDifference_sig = array(array('struct', 'int', 'int'));
$sumAndDifference_doc = 'Add and subtract two numbers';

new XML_RPC_Server
(array('sample.sumAndDifference' =>
array
('function' => 'sumAndDifference',
'signature' => $sumAndDifference_sig,
'docstring' => $sumAndDifference_doc)));

?>

After that I tried to connect for debug purposes, but I only got this:
 
C:\work\pfc\dev\Process_Viewer\classes>java org.apache.xmlrpc.XmlRpcClient http://localhost/pfl/server-test.php sample.sumAndDifference 1 3
Error: Unknown method
 
Has anyone an idea of what I may be doing wrong?
I'm using current versions of the java library as well as the PEAR PHP module...
 
Thanks,
al

Reply via email to