<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html style="direction: ltr;">
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bidimailui-charset-is-forced="true"
bidimailui-detected-decoding-type="latin-charset" bgcolor="#ffffff"
text="#000000">
<p style="margin-bottom: 0cm; margin-top: 0pt;">Victor, two
questions regarding this (for now). Where does another server
sending the request get a session id to send? And in this example,
and really every one I've seen, a standard method is being used
(node.get in this one), but I'm wondering if part of the issue is
that I'm defining a method in my module as opposed to using one
packaged with the services module. In my case, I'm receiving data,
and if its id matches a cck value in a content type I take the
data and update a field in the node with it, if not, I put the
data into a holding queue until there -is- a node with the id
being matched by the cck field.<br>
<br>
On 03/07/2011 04:14 PM, Victor Kane wrote:<br>
</p>
<blockquote
cite="mid:AANLkTinvhXtUVXTFnxkZ1f4B6XhAW1hGS+qcdok4iGWV@mail.gmail.com"
type="cite">Maybe this will help. I recently launched
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a moz-do-not-send="true" href="http://projectflowandtracker.com/">http://projectflowandtracker.com/</a> (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.
<div>
<br>
</div>
<div>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 <a
moz-do-not-send="true"
href="http://api.drupal.org/api/drupal/includes--common.inc/function/xmlrpc/6">http://api.drupal.org/api/drupal/includes--common.inc/function/xmlrpc/6</a> which
does not need to be downloaded or required.</div>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<div><br>
</div>
<div>
<div>/*</div>
<div> * client code for use with Services 6.x-2.4</div>
<div> * with following modules enabled on server, and
following server config:</div>
<div> * Key Authentication, XMLRPC Server, Node Service,
System Service, User Service, Views Service</div>
<div> * with no special permissions for anonymous on server</div>
<div> * Key Authentication is chosen at Site building >
Services > Settings</div>
<div> * but Use ssid selected, Use keys de-selected</div>
<div> */</div>
</div>
<div><br>
</div>
<div>
<div>$server = '<a moz-do-not-send="true"
href="http://legacy.projectflowandtracker.com/services/xmlrpc">http://legacy.projectflowandtracker.com/services/xmlrpc</a>';</div>
<div><br>
</div>
<div>$anon_session = xmlrpc($server, 'system.connect');</div>
<div><br>
</div>
<div>// login as...</div>
<div>// Use anon session id to login with authentication</div>
<div>$user = 'the_user';</div>
<div>$password = 'the_password';</div>
<div>$authenticated_session = xmlrpc($server, 'user.login',
$anon_session['sessid'], $user, $password);</div>
<div> if (xmlrpc_error()) {</div>
<div> $error_num = xmlrpc_errno();</div>
<div> $error = xmlrpc_error();</div>
<div> print_r ($error);</div>
<div> }</div>
<div><br>
</div>
<div>/*********** code just to bring a single node
****************/</div>
<div>$xmlrpc_result = xmlrpc($server, 'node.get',
$authenticated_session['sessid'], 2);</div>
<div> if (xmlrpc_error()) {</div>
<div> $error_num = xmlrpc_errno();</div>
<div> $error = xmlrpc_error();</div>
<div> print_r ($error);</div>
<div> }</div>
<div>print '<pre>' . print_r($xmlrpc_result, TRUE) .
'</pre>';</div>
<div><br>
</div>
</div>
<div>This worked for me.</div>
<div><br>
</div>
<div>Victor Kane</div>
<div><a moz-do-not-send="true" href="http://awebfactory.com.ar">http://awebfactory.com.ar</a></div>
<div><a moz-do-not-send="true"
href="http://projectflowandtracker.com">http://projectflowandtracker.com</a></div>
</blockquote>
</body>
</html>