Strange error thrown by the createSimple function
PostPosted:Tue Mar 10, 2015 4:16 pm
Here's my PHP script:
Code: Select all
All I'm trying to do is to send all files from /home/test/ to the /okm:root/ directory. I'm aware of the fact, that they will be overwritten because the file name is constant ('file.to.upload'). The problem is that the createSimple() function is throwing an error which says "Fault occurred while processing.". What am I doing wrong?<?php
$OKMAuth = new SoapClient('http://localhost:8080/OpenKM/services/OKMAuth?wsdl');
$OKMDocument = new SoapClient('http://localhost:8080/OpenKM/services/OKMDocument?wsdl');
$loginResp = $OKMAuth->login(array('user' => 'okmAdmin', 'password' => 'mypass'));
$token = $loginResp->return;
foreach (glob("/home/test/*") as $filename) {
$handle = fopen($filename,'rb');
$file_content = fread($handle,filesize($filename));
fclose($handle);
try{
$OKMDocument->createSimple($token,"/okm:root/file.to.upload",$file_content);
}
catch (Exception $e){
echo $e->getMessage();
}
}
$OKMAuth->logout($token);
?>