[prev in list] [next in list] [prev in thread] [next in thread] 

List:       xmlrpc-user
Subject:    Re: Always get "unknown method" with PHP server
From:       "Alexander Langer" <al () s-3 ! de>
Date:       2004-05-24 7:45:39
Message-ID: 004201c44163$1d00b590$2ce3a8c0 () MCS ! S3
[Download RAW message or body]

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 ----- 
  From: George Peristerakis 
  To: al@s-3.de 
  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:al@s-3.de]
    Sent: May 19, 2004 05:32
    To: xmlrpc-user@ws.apache.org
    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


[Attachment #3 (text/html)]

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=Content-Type content="text/html; charset=iso-8859-1">
<META content="MSHTML 6.00.2800.1400" name=GENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=#ffffff>
<DIV><FONT face=Arial size=2>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?</FONT></DIV>
<BLOCKQUOTE dir=ltr 
style="PADDING-RIGHT: 0px; PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: #000000 \
2px solid; MARGIN-RIGHT: 0px">  <DIV style="FONT: 10pt arial">----- Original Message \
----- </DIV>  <DIV 
  style="BACKGROUND: #e4e4e4; FONT: 10pt arial; font-color: black"><B>From:</B> 
  <A title=periste@tisec.com href="mailto:periste@tisec.com">George 
  Peristerakis</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>To:</B> <A title=al@s-3.de 
  href="mailto:al@s-3.de">al@s-3.de</A> </DIV>
  <DIV style="FONT: 10pt arial"><B>Sent:</B> Wednesday, May 19, 2004 3:47 
  PM</DIV>
  <DIV style="FONT: 10pt arial"><B>Subject:</B> RE: Always get "unknown method" 
  with PHP server</DIV>
  <DIV><BR></DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff size=2>Hi 
  Alexander,</FONT></SPAN></DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff size=2>The 
  error is in the declaration of your function:</FONT></SPAN></DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2><FONT face="Times New Roman"><FONT 
  color=#000000><STRONG></STRONG></FONT></FONT></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=955083713-19052004><STRONG><FONT size=2>Change the 
  following:</FONT></STRONG></SPAN></DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2><FONT face="Times New Roman"><FONT color=#000000><STRONG>new</STRONG> 
  XML_RPC_Server</FONT><FONT color=#ff0000 size=2>(</FONT><B><FONT size=2><FONT 
  color=#000000>array</FONT></B></FONT></FONT><FONT face="Times New Roman"><FONT 
  color=#ff0000 size=2>(</FONT><FONT color=#0000f0 
  size=2>'sample.sumAndDifference'</FONT><FONT color=#000000 size=2> 
  </FONT><FONT color=#ff0000 size=2>=&gt;</FONT></FONT><FONT size=2><BR><B><FONT 
  face="Times New Roman" color=#000000>array</FONT></B></FONT><FONT 
  face="Times New Roman"><FONT color=#ff0000 size=2>(</FONT><FONT color=#0000f0 
  size=2>'function'</FONT><FONT color=#000000 size=2> </FONT><FONT color=#ff0000 
  size=2>=&gt;</FONT><FONT color=#000000 size=2> </FONT><FONT color=#0000f0 
  size=2><U>'sample.sumAndDifference'</U></FONT></FONT><FONT 
  face="Times New Roman"><FONT color=#000000 size=2>,<BR></FONT><FONT 
  color=#0000f0 size=2>'signature'</FONT><FONT color=#000000 size=2> 
  </FONT><FONT color=#ff0000 size=2>=&gt;</FONT><FONT color=#000000 size=2> 
  </FONT><FONT color=#800000 size=2>$sumAndDifference_sig</FONT></FONT><FONT 
  face="Times New Roman"><FONT color=#000000 size=2>,<BR></FONT><FONT 
  color=#0000f0 size=2>'docstring'</FONT><FONT color=#000000 size=2> 
  </FONT><FONT color=#ff0000 size=2>=&gt;</FONT><FONT color=#000000 size=2> 
  </FONT><FONT color=#800000 size=2>$sumAndDifference_doc</FONT><FONT 
  color=#ff0000 size=2>)));</FONT></FONT><FONT size=2><FONT 
  face="Times New Roman" color=#000000> </FONT><BR></FONT></FONT></SPAN></DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2><FONT size=2>Hope this helps.</FONT></FONT></SPAN></DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2><FONT size=2></FONT></FONT></SPAN>&nbsp;</DIV>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2><FONT size=2>&nbsp;</DIV></FONT></FONT></SPAN>
  <DIV><SPAN class=955083713-19052004><FONT face=Arial color=#0000ff 
  size=2></FONT></SPAN>&nbsp;</DIV>
  <BLOCKQUOTE dir=ltr style="MARGIN-RIGHT: 0px">
    <DIV class=OutlookMessageHeader dir=ltr align=left><FONT face=Tahoma 
    size=2>-----Original Message-----<BR><B>From:</B> Alexander Langer 
    [mailto:al@s-3.de]<BR><B>Sent:</B> May 19, 2004 05:32<BR><B>To:</B> 
    xmlrpc-user@ws.apache.org<BR><B>Subject:</B> Always get "unknown method" 
    with PHP server<BR><BR></FONT></DIV>
    <DIV><FONT face=Arial size=2>Hi there!</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>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".</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>I'm now at a point where I try to connect to a 
    PHP server sample script, which looks like this:</FONT></DIV>
    <DIV><B><FONT color=#ff0000 size=2>
    <P>&lt;?php</B></FONT><FONT size=2><BR><BR><B>require_once</B></FONT><FONT 
    color=#ff0000 size=2>(</FONT><FONT color=#0000f0 
    size=2>"XML/RPC/Server.php"</FONT><FONT color=#ff0000 size=2>);</FONT><FONT 
    size=2><BR><BR><B>function</B> sumAndDifference</FONT><FONT color=#ff0000 
    size=2>(</FONT><FONT color=#800000 size=2>$params</FONT><FONT color=#ff0000 
    size=2>)</FONT><FONT size=2> </FONT><FONT color=#ff0000 size=2>{</FONT><FONT 
    size=2><BR></FONT><FONT color=#800000 size=2>$xval</FONT><FONT size=2> 
    </FONT><FONT color=#ff0000 size=2>=</FONT><FONT size=2> </FONT><FONT 
    color=#800000 size=2>$params</FONT><FONT color=#ff0000 
    size=2>-&gt;</FONT><FONT size=2>getParam</FONT><FONT color=#ff0000 
    size=2>(</FONT><FONT color=#008000 size=2>0</FONT><FONT color=#ff0000 
    size=2>);</FONT><FONT size=2> <BR></FONT><FONT color=#800000 
    size=2>$x</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=</FONT><FONT size=2> </FONT><FONT color=#800000 
    size=2>$xval</FONT><FONT color=#ff0000 size=2>-&gt;</FONT><FONT 
    size=2>scalarval</FONT><FONT color=#ff0000 size=2>();</FONT><FONT 
    size=2><BR></FONT><FONT color=#800000 size=2>$yval</FONT><FONT size=2> 
    </FONT><FONT color=#ff0000 size=2>=</FONT><FONT size=2> </FONT><FONT 
    color=#800000 size=2>$params</FONT><FONT color=#ff0000 
    size=2>-&gt;</FONT><FONT size=2>getParam</FONT><FONT color=#ff0000 
    size=2>(</FONT><FONT color=#008000 size=2>1</FONT><FONT color=#ff0000 
    size=2>);</FONT><FONT size=2><BR></FONT><FONT color=#800000 
    size=2>$y</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=</FONT><FONT size=2> </FONT><FONT color=#800000 
    size=2>$yval</FONT><FONT color=#ff0000 size=2>-&gt;</FONT><FONT 
    size=2>scalaraval</FONT><FONT color=#ff0000 size=2>();</FONT><FONT 
    size=2><BR><BR></FONT><FONT color=#800000 size=2>$struct</FONT><FONT size=2> 
    </FONT><FONT color=#ff0000 size=2>=</FONT><FONT size=2> 
    <B>array</B></FONT><FONT color=#ff0000 size=2>(</FONT><FONT color=#0000f0 
    size=2>'sum'</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=&gt;</FONT><FONT size=2> <B>new</B> XML_RPC_Value</FONT><FONT 
    color=#ff0000 size=2>(</FONT><FONT color=#800000 size=2>$x</FONT><FONT 
    size=2> </FONT><FONT color=#ff0000 size=2>+</FONT><FONT size=2> </FONT><FONT 
    color=#800000 size=2>$y</FONT><FONT size=2>, </FONT><FONT color=#0000f0 
    size=2>'int'</FONT><FONT color=#ff0000 size=2>)</FONT><FONT 
    size=2>,<BR></FONT><FONT color=#0000f0 size=2>'difference'</FONT><FONT 
    size=2> </FONT><FONT color=#ff0000 size=2>=&gt;</FONT><FONT size=2> 
    <B>new</B> XML_RPC_Value</FONT><FONT color=#ff0000 size=2>(</FONT><FONT 
    color=#800000 size=2>$x</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>-</FONT><FONT size=2> </FONT><FONT color=#800000 
    size=2>$y</FONT><FONT size=2>, </FONT><FONT color=#0000f0 
    size=2>'int'</FONT><FONT color=#ff0000 size=2>));</FONT><FONT 
    size=2><BR><B>return</B> <B>new</B> XML_RPC_Response</FONT><FONT 
    color=#ff0000 size=2>(</FONT><B><FONT size=2>new</B> 
    XML_RPC_Value</FONT><FONT color=#ff0000 size=2>(</FONT><FONT color=#800000 
    size=2>$struct</FONT><FONT size=2>, </FONT><FONT color=#0000f0 
    size=2>'struct'</FONT><FONT color=#ff0000 size=2>));</FONT><FONT 
    size=2><BR></FONT><FONT color=#ff0000 size=2>}</FONT><FONT 
    size=2><BR><BR></FONT><FONT color=#800000 
    size=2>$sumAndDifference_sig</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=</FONT><FONT size=2> <B>array</B></FONT><FONT color=#ff0000 
    size=2>(</FONT><B><FONT size=2>array</B></FONT><FONT color=#ff0000 
    size=2>(</FONT><FONT color=#0000f0 size=2>'struct'</FONT><FONT size=2>, 
    </FONT><FONT color=#0000f0 size=2>'int'</FONT><FONT size=2>, </FONT><FONT 
    color=#0000f0 size=2>'int'</FONT><FONT color=#ff0000 size=2>));</FONT><FONT 
    size=2><BR></FONT><FONT color=#800000 
    size=2>$sumAndDifference_doc</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=</FONT><FONT size=2> </FONT><FONT color=#0000f0 size=2>'Add and 
    subtract two numbers'</FONT><FONT color=#ff0000 size=2>;</FONT><FONT 
    size=2><BR><BR><B>new</B> XML_RPC_Server</FONT><FONT color=#ff0000 
    size=2>(</FONT><B><FONT size=2>array</B></FONT><FONT color=#ff0000 
    size=2>(</FONT><FONT color=#0000f0 
    size=2>'sample.sumAndDifference'</FONT><FONT size=2> </FONT><FONT 
    color=#ff0000 size=2>=&gt;</FONT><FONT size=2><BR><B>array</B></FONT><FONT 
    color=#ff0000 size=2>(</FONT><FONT color=#0000f0 
    size=2>'function'</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=&gt;</FONT><FONT size=2> </FONT><FONT color=#0000f0 
    size=2>'sumAndDifference'</FONT><FONT size=2>,<BR></FONT><FONT color=#0000f0 
    size=2>'signature'</FONT><FONT size=2> </FONT><FONT color=#ff0000 
    size=2>=&gt;</FONT><FONT size=2> </FONT><FONT color=#800000 
    size=2>$sumAndDifference_sig</FONT><FONT size=2>,<BR></FONT><FONT 
    color=#0000f0 size=2>'docstring'</FONT><FONT size=2> </FONT><FONT 
    color=#ff0000 size=2>=&gt;</FONT><FONT size=2> </FONT><FONT color=#800000 
    size=2>$sumAndDifference_doc</FONT><FONT color=#ff0000 
    size=2>)));</FONT><FONT size=2> <BR><BR></FONT><B><FONT color=#ff0000 
    size=2>?&gt;</P></B></FONT></DIV>
    <DIV><FONT face=Arial size=2>After that I tried to connect for debug 
    purposes, but I only got this:</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>C:\work\pfc\dev\Process_Viewer\classes&gt;java 
    org.apache.xmlrpc.XmlRpcClient <A 
    href="http://localhost/pfl/server-test.php">http://localhost/pfl/server-test.php</A> \
  sample.sumAndDifference 1 3<BR>Error: Unknown method</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Has anyone an idea of what I may be doing 
    wrong?</FONT></DIV>
    <DIV><FONT face=Arial size=2>I'm using current versions of the java library 
    as well as the PEAR PHP module...</FONT></DIV>
    <DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
    <DIV><FONT face=Arial size=2>Thanks,</FONT></DIV>
    <DIV><FONT face=Arial 
size=2>al</FONT></DIV></BLOCKQUOTE></BLOCKQUOTE></BODY></HTML>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic