[development] Continued Services woes

jeff at ayendesigns.com jeff at ayendesigns.com
Mon Mar 7 20:39:51 UTC 2011

I downloaded and installed xmlrpc.inc, and looked at the example in the 
node below. It wasn't evident how to handle multiple method parameters 
and a type other than int on a parameter, or why the url was broken into 
two parts. So I read the class docs (surprise!) and assembled the code 
below. There are a couple different forms given in the docs for each 
call, so I used the simpler version for a couple.

When I hit the service url from the browser, I get 'xml-rpc accepts POST 
request only' as I should, the point being that it responds. When I 
execute the code below, it ends up timing out with the error being KO. 
Error: Connect error: A connection attempt failed because the connected 
party did not properly respond after a period of time, or established 
connection failed because connected host has failed to respond. (10060)

   // Load the XML-RPC for PHP library from wherever you've put it
   // File path relative to the Drupal root

   // Create an XMLRPC message
   $m = new xmlrpcmsg('video.transcribe',
       new xmlrpcval("12345", "int"),
       new xmlrpcval("hello world", "string")
   // Create a connection to the remote server
   $c = new xmlrpc_client('http://localhost/www/services/xmlrpc');
   $c->return_type = 'phpvals';
   // Send the message to the remote server and get the response
   $r = $c->send($m);

   if ($r->faultCode()) echo 'KO. Error: '.$r->faultString(); else print 
'<pre>' . print_r($r->value(),1) . '</pre>';

> On 03/05/2011 10:37 AM, Victor Kane wrote:
>     The code can easily be adapted to not using the app key, the
>     difference in the parameter signature is clear in the services
>     test page.
>     Doesn't this Drupal handbook page (http://drupal.org/node/816934)
>     help?
> On 03/05/2011 09:49 AM, Blake Senftner wrote:
>> Jeff,
>> Take a look at this d.o page:
>> http://drupal.org/node/816934
>> It shows example XMLRPC code for Services 6.x-2.0 (which predates the 6.x-2.2 rewrite) using both with and without API keys. (The example code showing logic with API key authentication is a comment at the bottom.) Perhaps this will provide the comparison info you seek to learn how your parameters need to be handled without authentication.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110307/b81f29d6/attachment.html 

More information about the development mailing list