• Document setProperties Error

  • Do you want to create a native client or integrate with third party applications: webservices are the solution.
Do you want to create a native client or integrate with third party applications: webservices are the solution.
Forum rules: Please, before asking something see the documentation wiki or use the search feature of the forum. And remember we don't have a crystal ball or mental readers, so if you post about an issue tell us which OpenKM are you using and also the browser and operating system version. For more info read How to Report Bugs Effectively.
 #6910  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....
 #6917  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)

About Us

OpenKM is part of the management software. A management software is a program that facilitates the accomplishment of administrative tasks. OpenKM is a document management system that allows you to manage business content and workflow in a more efficient way. Document managers guarantee data protection by establishing information security for business content.