Page 1 of 1

setContent function non valid

PostPosted:Wed Jun 28, 2017 3:55 pm
by Xeyos
I have this problem,
i try to update one document by API (PHP)
this is my code:
Code: Select all
$OKMDocument = new SoapClient('http://localhost:8080/OpenKM/services/OKMDocument?wsdl');
...
$this->OKMDocument->checkout(array('token' => $this->token, 'docPath' => $path));
$this->OKMDocument->setContent(array('token' => $this->token, 'docPath' => $path, 'content' => file_get_contents($file)));
But i have this error:
Function ("setContent") is not a valid method for this service

Re: setContent function non valid

PostPosted:Thu Jun 29, 2017 8:59 pm
by jllort
I suggest forget Soap, we are no longer support it, consider deprecated and in near future we will definitively remote it. Really in the next professional version after advising the last 3 years it has been removed.

I suggest use our PHP SDK based in REST webservices, you can find it here https://docs.openkm.com/kcenter/view/sdk4php-1.1.1/

Re: setContent function non valid

PostPosted:Mon Jul 03, 2017 6:29 am
by Xeyos
OK but which function should I use to update a document? There is no setContent here.

Re: setContent function non valid

PostPosted:Mon Jul 03, 2017 9:25 am
by vhlen
I think we can use "Check-in" REST function to update the document (https://docs.openkm.com/kcenter/view/sd ... ml#checkin) as behavior that you are using on the website.

Re: setContent function non valid

PostPosted:Mon Jul 03, 2017 12:53 pm
by Xeyos
This sdk is not simple to include in a framework as Symfony...

Re: setContent function non valid

PostPosted:Tue Jul 04, 2017 3:42 am
by vhlen
You can implement this function with RESTful method. It's using basic authentication for each api and easy to use.
The openKM also supports it. You can find it here: https://docs.openkm.com/kcenter/view/ok ... stful.html

Re: setContent function non valid

PostPosted:Tue Jul 04, 2017 9:35 am
by Xeyos
I integrate the sdk as external library and i change all SOAP request with the API in sdk.
Now all works correctly.

For other user this is my solution to ingrate the sdk with Symfony framework.

1) Paste the content of src(openkm and Httpful) folder in your vendor project folder, both folders under one folder called for example openkm.
2)Modify you autoload.php file
Code: Select all
$loader->add('openkm',__DIR__.'/../vendor/openkm');
$loader->add('Httpful',__DIR__.'/../vendor/openkm');
Now in your class you can use all classes of SDK example: (I create my utility service)
Code: Select all
use openkm\OKMWebServicesFactory;
Thx

Re: setContent function non valid

PostPosted:Wed Jul 05, 2017 8:47 pm
by jllort
Thanks for sharing the solution.