• "simple" property group write access

  • 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.
 #23432  by pldemon
 
Hi OpenKM team,

I'm writing a Perl module for a direct access of the OpenKM service and I'm facing a strange behavior during the data transmission of a property group. Please find included the structure I've used during my test:
Code: Select all
<property-groups>
  <property-group label="Testdata" name="okg:testdata">
    <input label="test1" type="text" name="okp:testdata.test1"/>
    <select label="test2" type="simple" name="okp:testdata.test2">
    	<option label="Foo" value="foo"/>
    	<option label="Bar" value="bar"/>
    </select>
  </property-group>
</property-groups>

If I'm filling in the text property group everything is working fine:
Code: Select all
$soap->setPropertiesSimple(
		name('{}token' => $token),
		name('{}nodePath' => "/okm:root/test.txt"),
		name('{}grpName' => "okg:testdata"),
		name('{}properties' => \SOAP::Data->value(
					name('key' => "okp:testdata.test1"),
					name('value' => "Text as expected")
					)
			)
	);
The log file is showing that the value was inserted as expected:
Code: Select all
2013-06-10 16:18:59,189 [http-bio-0.0.0.0-8080-exec-3] INFO  com.openkm.spring.LoggerListener - Authentication OK: okmAdmin
2013-06-10 16:18:59,208 [http-bio-0.0.0.0-8080-exec-2] INFO  com.openkm.module.db.stuff.SetPropertiesFieldBridge - Added field 'okp:testdata.test1' with value 'Text as expected'
If I do the same with the "simple" object, I don't face any info. The existing value seems to be overwritten but the new one is not written into the database:
Code: Select all
$soap->setPropertiesSimple(
		name('{}token' => $token),
		name('{}nodePath' => "/okm:root/test.txt"),
		name('{}grpName' => "okg:testdata"),
		name('{}properties' => \SOAP::Data->value(
					name('key' => "okp:testdata.test2"),
					name('value' => "foo")
					)
			)
	);
The log info:
Code: Select all
2013-06-10 16:21:08,123 [http-bio-0.0.0.0-8080-exec-6] INFO  com.openkm.spring.LoggerListener - Authentication OK: okmAdmin
Do I've to use a special value for a simple object? I've tried several combinations of the value ("foo", "foo=true", "foo=activated", ...) but it didn't help. I'm still not able to write the property group into into the database :(

Thanks
pldemon
 #23499  by jllort
 
Properties is waiting receive a list of pairs key,value I do not know if it will help you ? take a look for example in http://wiki.openkm.com/index.php/PHP_cl ... roup_value that value is array of pairs ( key, value ) I think that can be the problem.

If you have some example running with perl we can share with other community users in http://wiki.openkm.com/index.php/Webser ... OpenKM_6.2
 #23510  by pldemon
 
Hi jllort,

yes, this seems to be a problem. So I took a closer look into the source code of the system, and what I saw seems to confirm my suspicion: setPropertiesSimple is not able to handle the select key. You have to use setProperties instead. Please find a small sample, how the handling of "simple" or "multiple" elements may be done with Perl:
Code: Select all
$soap->setProperties(
	SOAP::Data->name('{}token' => $token),
	SOAP::Data->name('{}nodePath' => $file),
	SOAP::Data->name('{}grpName' => $groupname),
	SOAP::Data->name('{}properties' => \SOAP::Data->value(
		SOAP::Data->name('objClass' => "com.openkm.bean.form.Select"),
		SOAP::Data->name('name' => $element),
		SOAP::Data->name('options' => \SOAP::Data->value(
			SOAP::Data->name('value' => $Input[$i]),
			SOAP::Data->name('selected' => $seline))
					   )
				)
		)
   );
Cheers,
pldemon
 #23810  by pavila
 
This should work as I can see in the setPropertiesSimple source code. Which OpenKM version are you using?
 #23833  by pldemon
 
Not really. I've tested it with the current community and the professional version. Both versions didn't work.

The SOAP interface seems to be a little "tricky". There are several glitches and some security flaws inside :( I'll not describe this in detail but some commands are extremely dangerous even if you access the system with unprivileged uses accounts. As example I've destroyed the whole database several times with wrong commands :(
 #24483  by pavila
 
I don't understand how can you damage the database using the Web Services API. Please, post a sample code and will review it and fix any problem if see any bug.

As Josep said, using "setPropertiesSimple" is the best option because is the simplest way to change Property Groups values. See http://wiki.openkm.com/index.php/PHP_cl ... OpenKM_6.2 for sample code.

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.