• Web services create folder problem

  • We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
We tried to make OpenKM as intuitive as possible, but an advice is always welcome.
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.
 #19398  by fuzzyq
 
Hi,

I try write some script to digital sign documents from php. But i have a problem with OKMFolder service i can't create any folder from php.

Simple script:
Code: Select all
<?php
  $OKMAuth = new SoapClient('http://192.168.1.106:8080/OpenKM/services/OKMAuth?wsdl');
  $OKMFolder = new SoapClient('http://192.168.1.106:8080/OpenKM/services/OKMFolder?wsdl');

  // Login
  $loginResp = $OKMAuth->login(array('user' => 'okmAdmin', 'password' => 'admin'));
  $token = $loginResp->return;
  echo "Token: ".$token."<br>";
 
// Create folder
  $createResp = $OKMFolder->create($token, '/okm:root/test');

  // Logout
  $OKMAuth->logout(array('token' => $token));
?>
I always get this error:
Code: Select all
Fatal error: Uncaught SoapFault exception: [soap:Server] Fault occurred while processing. in C:\xampp\htdocs\okmtest\aa.php:16 Stack trace: #0 C:\xampp\htdocs\okmtest\aa.php(16): SoapClient->__call('create', Array) #1 C:\xampp\htdocs\okmtest\aa.php(16): SoapClient->create(Array) #2 {main} thrown in C:\xampp\htdocs\okmtest\aa.php on line 16
Sorry for my english.

Regards
 #19411  by miguelromero
 
Check the correct function name and variable parameters to create a folder in the open xml which shows all the accesible functions for each class:
http://192.168.1.106:8080/OpenKM/servic ... older?wsdl

What you need is createSimple, not create function :D
create function has a lot more parameters.

You can also use try and catch to get the exception error message, as its shown in the openkm wiki for php.
 #19451  by fuzzyq
 
OK, but how?

I search parameters everywhere and i can't understand what a must use.

Can you give some example of create folder. I use OpenKM ver 6.20

That help me a lot.

Regards
 #19458  by miguelromero
 
I will publish a full class with a lot more options soon but until then here you go:
Code: Select all
//CREATE folder, basic call
	public function OpenKM_createfolder($surlOpenKM, $token, $fldPath)
	{
		$bRet = 0;
		$okmurl = $surlOpenKM; //"http://".$sIP.":".$sport."/OpenKM/";
		if (isset($okmurl) && isset($token) && isset($fldPath))
		{
			try
			{
				$OKMFolder = new SoapClient($okmurl . "services/OKMFolder?wsdl");
				$OKMFolder->createSimple(array('token' => $token, 'fldPath' => $fldPath));
				$bRet = 1;
			}
			catch (Exception $e)
			{
				self::format_exception($e);
			}
		}
		return $bRet;
	}

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.