Page 1 of 1

Document setProperties Error

PostPosted:Mon Oct 25, 2010 8:54 am
by nannicini
I try to change main value by webservice according with documentation example to a document that has been previously uploaded.
I try to change KEYWORDS value by setProperties method
this is the simple script:
Code: Select all
<?      
  $user = "okmAdmin";
  $pass = "admin";
  ini_set("soap.wsdl_cache_enabled", "0"); // disabling WSDL cache 
  $OKMAuth = new SoapClient('http://192.168.0.25:8080/OpenKM/OKMAuth?wsdl', 
  			array('proxy_host' => "192.168.0.25", 'proxy_port' => 8080));
  $OKMDocument = new SoapClient('http://192.168.0.25:8080/OpenKM/OKMDocument?wsdl', 
  			array('proxy_host' => "192.168.0.25", 'proxy_port' => 8080));
$token = $OKMAuth->login('okmAdmin','admin');
$dms_path="/okm:root/ambulatorio/pazienti/consensiprivacy/pg_0001.pdf";
$properties=$OKMDocument->getProperties($token,$dms_path);
print_r($properties);

$doc = array('path' => $dms_path, 'mimeType' => null,
  	'actualVersion' => null, 'author' => Admin, 'checkedOut' => false,
  	 'keywords' => 'CHANGEDVALUE', 'language' => null,
  	'lastModified' => null, 'lockInfo' => null, 'locked' => false,
  	'permissions' => 0, 'size' => 0, 'subscribed' => false,
	  'convertibleToPdf' =>0,
	  'convertibleToSwf' =>0);
try {
$OKMDocument->setProperties($doc);
} catch (Exception $e) {
    echo format_exception($e);
}
$OKMAuth->logout($token);  
 function format_exception($e) {
    if (isset($e->detail)) {
      $reflectionObject = new ReflectionObject($e->detail);
      $properties = $reflectionObject->getProperties();
      $exceptionName = $properties[0]->name;
    } else {
      $exceptionName = "Exception";
    }
    return $exceptionName.": ".$e->faultstring;
  }
?>
The script return
Exception: java.lang.NullPointerException

Probably i send a wrong $doc array? I need to send a StdClass Object?

Please help me....

Re: Document setProperties Error

PostPosted:Mon Oct 25, 2010 5:49 pm
by pavila
In OpenKM 5.0 if you want to add or remove document keywords, you should use:
Code: Select all
void addKeyword(String token, String nodePath, String keyword)
void removeKeyword(String token, String nodePath, String keyword)