You are not logged in.
Pages: 1
Hi there,
I'm trying to work with the web service's plugin of GLPI but i'm having some problems.
I've already installed the plugin then i've tried to use the client and it works for some of the methods like 'glpi.test' and 'glpi.status'.
But some of then need authentication and i tried to use the method 'glpi.doLogin' but with no sucess.
The error is "SoapFault exception: [Missing parameter] 11". I've no user and password defined on "Plugins" -> "web services" -> local (my web service) -> user and password...
What i supose to do to get access to other methods?
Please help..
Thanks
Hugo
Offline
user and password are the one of the user you want to use to log in glpi (tryp for example glpi/glpi)
Offline
that's what i've tried too... here's my code so u can see... but with no sucess...
Same error.
And when i go to "Plugins" -> "web services" -> local (my web service) -> user / password and put glpi / glpi too... with this same code... The error is Access Denied (1) .
if (!extension_loaded("soap")) {
die("Extension soap not loaded\n");
}
chdir(dirname($_SERVER["SCRIPT_FILENAME"]));
chdir("../../..");
$url = "/" . basename(getcwd()) . "/plugins/webservices/soap.php";
$args = array ();
if ($_SERVER['argc'] > 1) {
for ($i = 1; $i < count($_SERVER['argv']); $i++) {
$it = explode("=", $argv[$i], 2);
$it[0] = preg_replace('/^--/', '', $it[0]);
$args[$it[0]] = (isset ($it[1]) ? $it[1] : true);
}
}
if (isset ($args['help']) && !isset ($args['method'])) {
echo "\nusage : " . $_SERVER["SCRIPT_FILENAME"] . " [ options] \n\n";
echo "\thelp : display this screen\n";
echo "\thost : server name or IP, default : localhost\n";
echo "\turl : SOAP plugin URL, default : $url\n";
echo "\tusername : User name for security check (optionnal)\n";
echo "\tpassword : User password (optionnal)\n";
echo "\tmethod : SOAP method to call, default : glpi.test\n";
echo "\tdeflate : allow server to compress response (if supported)\n";
die("\nOther options are used for SOAP call.\n\n");
}
if (isset ($args['url'])) {
$url = $args['url'];
unset ($args['url']);
}
if (isset ($args['host'])) {
$host = $args['host'];
unset ($args['host']);
} else {
$host = 'localhost';
}
if (isset ($args['login_name'])) {
$username = $args['login_name'];
//unset ($args['login_name']);
} else {
$username = 'glpi';
}
if (isset ($args['login_password'])) {
$password = $args['login_password'];
//unset ($args['login_password']);
} else {
$password = 'glpi';
}
if (isset ($args['method'])) {
$method = $args['method'];
//unset ($args['method']);
} else {
$args['method'] = $method = 'glpi.doLogin';
}
echo "+ Calling '$method' on http://$host/$url\n";
try {
// Nouvelle instance de la classe soapClient
$client = new SoapClient(null, array (
'uri' => 'http://' . $host . '/' . $url,
'location' => 'http://' . $host . '/' . $url
));
//echo "<pre>";
//echo $client;
//Call the genericExecute method
$result = $client->__soapCall('genericExecute', array(new SoapParam($args,'params')));
print_r($result);
} catch (SoapFault $fault) {
echo $fault;
}
?>
Offline
if someone have a web service client working for those method like listcomputers or others that require authentication please post it... so i can test in my web service...
It would be very usefull..
Thank you very much
Hvasconcelos
Offline
Already solved this problem.. Thanks anyway!
Now what i want to know is if there's any function in the webservice that returns the software information.
Thanks.
Hvaconcelos
Offline
Pages: 1