[development] Continued Services woes

Victor Kane victorkane at gmail.com
Mon Mar 7 21:14:59 UTC 2011

Maybe this will help. I recently launched http://projectflowandtracker.com/ (on
Pantheon, yay!) in alpha (beta will come with jquery enhanced usability
improvements) and was working on an everything in code basis; so... I had to
import from the legacy site all the projects, user stories, etc. for the
150-200 folks who had been using the previous version.

I opted to use services on the legacy site, and did not use the
authentication key, but opted for user login instead, bringing the stuff
over to the new site using the Drupal API
http://api.drupal.org/api/drupal/includes--common.inc/function/xmlrpc/6 which
does not need to be downloaded or required.

 * client code for use with Services 6.x-2.4
 *    with following modules enabled on server, and following server config:
 *      Key Authentication, XMLRPC Server, Node Service, System Service,
User Service, Views Service
 *    with no special permissions for anonymous on server
 *    Key Authentication is chosen at Site building > Services > Settings
 *      but Use ssid selected, Use keys de-selected

$server = 'http://legacy.projectflowandtracker.com/services/xmlrpc';

$anon_session = xmlrpc($server, 'system.connect');

// login as...
// Use anon session id to login with authentication
$user = 'the_user';
$password = 'the_password';
$authenticated_session = xmlrpc($server, 'user.login',
$anon_session['sessid'], $user, $password);
      if (xmlrpc_error()) {
      $error_num = xmlrpc_errno();
      $error = xmlrpc_error();
      print_r ($error);

/*********** code just to bring a single node ****************/
$xmlrpc_result = xmlrpc($server, 'node.get',
$authenticated_session['sessid'], 2);
      if (xmlrpc_error()) {
      $error_num = xmlrpc_errno();
      $error = xmlrpc_error();
      print_r ($error);
print '<pre>' . print_r($xmlrpc_result, TRUE) . '</pre>';

This worked for me.

Victor Kane
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.drupal.org/pipermail/development/attachments/20110307/12992f67/attachment.html 

More information about the development mailing list