2

I have been a little frustrated with trying to get outside applications to consume services. The services browser is invaluable in testing the services themselves but fails in helping test the servers. For instance, if I do a views.get in the service, it returns an array (php) with node references. When I try the JSON server module, it does not return the node references. Are there any recommendations on how to test different service functions out through JSON? I though that a PHP file could be written to do this, but I wanted to see if anything out there exists alreay.

  • I found this module drupal.org/project/clients which seems to be destined to consume and test services, althoug I think it only works with XML_RPC currently, and it's still buggy (I could not get it to work right) – user379468 May 26 '11 at 14:54
2

I found a module called Web Service Clients. It is still unstable, but it works.

Parallel to the Services module, the Clients module provides the ability to implement pluggable clients to external web services, including external Drupal sites running the Services module, the main use case being ingesting content from other Drupal installs via the Services module XMLRPC server.

0
/Load xmlrpc library
require_once('XmlRPC.php');
//Define Facekard server host
$facekard_server = 'localhost';

//Define facekard api server path
$facekard_server_path = '/wsdl/test/services';

//Make connection to server
$connection = new XmlRPC($facekard_server,$facekard_server_path);
//die(print_r($connection));

//Call remote function system.connect to get session id
$system_connect = $connection->call('system.connect');
//die(print_r($system_connect));
//Fetch sessid from xml object
$session_id = $system_connect->sessid;
$pass = '123456';
  • 1
    Hi Tan, welcome to DA. Although the code looks sound, it'd be great to see an explanation as to what it's doing so it might help other users or less-experienced Drupalers :) – Chapabu Oct 21 '12 at 14:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.