[OPEN-ILS-DEV] Best way to authenticate users against Evergreen

Mark Jordan mjordan at sfu.ca
Sun Feb 22 16:38:35 EST 2009


OK, I've got the json gateway working, based on Niles' code (thanks again). However, I'd like to get the XML-RPC approach working as well, since not all PHP installations have curl enabled. Maybe I'm missing something obvious, but the following PHP code returns a 500 error from http://demo.gapines.org. The code does work against a test XML-RPC server I have running on my laptop (which just prints back whatever you pass it), so I'm assuming that the values I've plugged in from Evergreen's collections.pl are not correct in some way. Here's the PHP code:

<?php

// Gets seed for generating md5 hash of user password. Argument is 
// the patron's username.

$username = 'patron';
$request = xmlrpc_encode_request('open-ils.auth.authenticate.init', array('patron'));
$context = stream_context_create(array('http' => array(
    'method' => "POST",
    'header' => "Content-Type: text/xml",
    'content' => $request
)));
$file = file_get_contents("https://demo.gapines.org/xml-rpc/open-ils.auth", false, $context);
$response = xmlrpc_decode($file);
if (xmlrpc_is_fault($response)) {
    trigger_error("xmlrpc: $response[faultString] ($response[faultCode])");
} else {
    print_r($response);
}
?>

Can anyone see what I'm missing? One possible problem is that in collections.pl, arguments in the RPC request are passed through the Perl RPC::XML module's smart_encode function. I tried replacing 'patron' in my code above with '<string>patron</string>', but the demo.gapines.org gateway still returns a 500 response.

What am I missing?

Mark

Mark Jordan
Head of Library Systems
W.A.C. Bennett Library, Simon Fraser University
Burnaby, British Columbia, V5A 1S6, Canada
Voice: 778.782.5753 / Fax: 778.782.3023
mjordan at sfu.ca


More information about the Open-ils-dev mailing list