Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 25th, 2012  |  syntax: None  |  size: 2.74 KB  |  hits: 9  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. XMLRPC showing -32601 error (using PHP)
  2. <?php
  3. include("lib/xmlrpc.inc");
  4.  
  5. $email='whatever@hotmail.com';
  6.  
  7. $c=new xmlrpc_client("/register/index.php", "ws.myserver.com", 80);
  8. $f=new xmlrpcmsg('existsEmail', array(new xmlrpcval($email, "base64")));
  9. print "<pre>" . htmlentities($f->serialize( )) . "</pre>";
  10.  
  11. $r=$c->send($f);
  12. $v=$r->value( );
  13.  
  14. if (!$r->faultCode( )) {
  15.     print "Email is". $email . " is " .
  16.           $v->scalarval( ) . "<br />";
  17.           print "<hr />I got this value back<br /><pre>" .
  18.           htmlentities($r->serialize( )). "</pre><hr />n";
  19. } else {
  20.     print "Fault: ";
  21.     print "Code: " . $r->faultCode( ) .
  22.     " Reason '" .$r->faultString( )."'<br />";
  23. }
  24.  
  25. ?>
  26.        
  27. <?xml version="1.0"?>
  28. <methodCall>
  29. <methodName>existsEmail</methodName>
  30. <params>
  31. <param>
  32. <value><base64>dnJvZHJpZ3VlekBpY2NrLm5ldC5jbw==</base64></value>
  33. </param>
  34. </params>
  35. </methodCall>
  36.        
  37. -32601 ---> server error. requested method not found
  38.        
  39. $path = 'http://xmlrpc-c.sourceforge.net/api/sample.php';
  40.  
  41. printf("n XMLRPC Service Discoverynn for: '%s'nn", $path);
  42.  
  43. $discovery = new Discovery($path);
  44. $methods = $discovery->getMethods();
  45.  
  46. printf(" Method Summary:n ===============n", count($methods));
  47. foreach ($methods as $i => $method)
  48. {
  49.     printf(" %'.-2d %sn", $i + 1, $method->getName());
  50. }
  51.  
  52. printf("n Method Details (%d):n ===================n", count($methods));
  53. foreach ($methods as $i => $method)
  54. {
  55.     printf("  %'.-2d %sn", $i + 1, $method->getName());
  56.     printf("n       %sn", $method);
  57.     printf("n%snn", preg_replace('/^/um', '     ', wordwrap($method->getHelp(), 46)));
  58. }
  59.        
  60. XMLRPC Service Discovery
  61.  
  62.  for: 'http://xmlrpc-c.sourceforge.net/api/sample.php'
  63.  
  64.  Method Summary:
  65.  ===============
  66.  1. debug.authInfo
  67.  2. sample.add
  68.  3. sample.sumAndDifference
  69.  4. system.listMethods
  70.  5. system.methodHelp
  71.  6. system.methodSignature
  72.  
  73.  Method Details (6):
  74.  ===================
  75.   1. debug.authInfo
  76.  
  77.        <struct> debug.authInfo
  78.  
  79.      Report any HTTP authentication in use
  80.  
  81.   2. sample.add
  82.  
  83.        <int> sample.add (<int>, <int>)
  84.  
  85.      Add two numbers
  86.  
  87.   3. sample.sumAndDifference
  88.  
  89.        <struct> sample.sumAndDifference (<int>, <int>)
  90.  
  91.      Add and subtract two numbers
  92.  
  93.   4. system.listMethods
  94.  
  95.        <array> system.listMethods (<string>)
  96.  
  97.      This method lists all the methods that the
  98.      XML-RPC server knows how to dispatch
  99.  
  100.   5. system.methodHelp
  101.  
  102.        <string> system.methodHelp (<string>)
  103.  
  104.      Returns help text if defined for the method
  105.      passed, otherwise returns an empty string
  106.  
  107.   6. system.methodSignature
  108.  
  109.        <array> system.methodSignature (<string>)
  110.  
  111.      Returns an array of known signatures (an array
  112.      of arrays) for the method name passed. If no
  113.      signatures are known, returns a none-array
  114.      (test for type != array to detect missing
  115.      signature)