Page 1 of 1
WebService PHP
PostPosted:Wed Oct 09, 2013 6:03 pm
by jcorral
Hola,
no se si estoy haciendo algo mal, estoy probando y he creado una carpeta, he subido a esta un fichero PDF, tengo instalado Apache para ejecutar PHP he creado un fichero php con el código que existe en la web con el título "List folders and documents" y recibo el siguiente error:
Code: Select allToken: a5535bb3-74c7-438e-be20-bba0d4224c1f
Path: /okm:root
[FOLDER] Path: /okm:root/Prueba, Author: okmAdmin
( ! ) Notice: Undefined property: stdClass::$return in C:\wamp\www\sislex\listar.php on line 38
Call Stack
# Time Memory Function Location
1 0.0010 690816 {main}( ) ..\listar.php:0
Gracias
Re: WebService PHP
PostPosted:Thu Oct 10, 2013 8:30 pm
by jllort
Nos tendrías que decir que intentas hacer y también poder ver el código fuente para tener una idea aproximada de que esta pasando en la linea 38
Re: WebService PHP
PostPosted:Fri Oct 11, 2013 9:11 pm
by jcorral
es el código que existe en el apartado de OpenKM "PHP Client"
Code: Select all<?php
function printFolder($folder) {
echo "[FOLDER] Path: ".$folder->path.", Author: ".$folder->author."<br>";
}
function printDocument($document) {
echo "[DOCUMENT] Path: ".$document->path.", Author: ".$document->author.", Size: ".$document->actualVersion->size."<br>";
}
// Register WSDL
$OKMAuth = new SoapClient('http://localhost:8081/OpenKM/services/OKMAuth?wsdl');
$OKMDocument = new SoapClient('http://localhost:8081/OpenKM/services/OKMDocument?wsdl');
$OKMFolder = new SoapClient('http://localhost:8081/OpenKM/services/OKMFolder?wsdl');
$path = '/okm:root';
// Login
$loginResp = $OKMAuth->login(array('user' => 'okmAdmin', 'password' => 'admin'));
$token = $loginResp->return;
echo "Token: ".$token."<br>";
echo "Path: ".$path."<br>";
// List folders
$getChildrenResp = $OKMFolder->getChildren(array('token' => $token, 'fldPath' => $path));
$folderArray = $getChildrenResp->return;
if ($folderArray) {
if (is_array($folderArray)) {
foreach ($folderArray as $folder) {
printFolder($folder);
}
} else {
printFolder($folderArray);
}
}
// List documents
$getChildrenResp = $OKMDocument->getChildren(array('token' => $token, 'fldPath' => $path));
$documentArray = $getChildrenResp->return;
if ($documentArray) {
if (is_array($documentArray)) {
foreach ($documentArray as $document) {
printDocument($document);
}
} else {
printDocument($documentArray);
}
}
// Logout
$OKMAuth->logout(array('token' => $token));
?>
Re: WebService PHP
PostPosted:Sat Oct 12, 2013 7:08 am
by jllort
Esto esta perfecto no tiene ningún problema, si quieres puedes probarlo en nuestra demo online demo.openkm.com ( te he adaptado el código fuente ). El problema yo creo que esta en otro sitio, contra que versión de OpenKM lo estas probando y que versión de php tienes, porque aquí debe estar el fondo de la cuestión.
En la linea 38 hace esto $documentArray = $getChildrenResp->return; ( lo único que se me pasa por la cabeza es que sea null ? y no creo que eso sea la naturaleza del fallo, en el catalina.log te aparece algun error ?)
Code: Select all<?php
function printFolder($folder) {
echo "[FOLDER] Path: ".$folder->path.", Author: ".$folder->author."<br>";
}
function printDocument($document) {
echo "[DOCUMENT] Path: ".$document->path.", Author: ".$document->author.", Size: ".$document->actualVersion->size."<br>";
}
// Register WSDL
$OKMAuth = new SoapClient('http://demo.openkm.com/OpenKM/services/OKMAuth?wsdl');
$OKMDocument = new SoapClient('http://demo.openkm.com/OpenKM/services/OKMDocument?wsdl');
$OKMFolder = new SoapClient('http://demo.openkm.com/OpenKM/services/OKMFolder?wsdl');
$path = '/okm:root';
// Login
$loginResp = $OKMAuth->login(array('user' => 'user1', 'password' => 'pass1'));
$token = $loginResp->return;
echo "Token: ".$token."<br>";
echo "Path: ".$path."<br>";
// List folders
$getChildrenResp = $OKMFolder->getChildren(array('token' => $token, 'fldPath' => $path));
$folderArray = $getChildrenResp->return;
if ($folderArray) {
if (is_array($folderArray)) {
foreach ($folderArray as $folder) {
printFolder($folder);
}
} else {
printFolder($folderArray);
}
}
// List documents
$getChildrenResp = $OKMDocument->getChildren(array('token' => $token, 'fldPath' => $path));
$documentArray = $getChildrenResp->return;
if ($documentArray) {
if (is_array($documentArray)) {
foreach ($documentArray as $document) {
printDocument($document);
}
} else {
printDocument($documentArray);
}
}
// Logout
$OKMAuth->logout(array('token' => $token));
?>
Re: WebService PHP
PostPosted:Tue Oct 15, 2013 6:42 am
by jcorral
OpenKM 6.2.21 y PHP 5.3, el código que tu me comentas funciona perfectamente, pero no entiendo porque el mio no cuando es igual salvo que apunta a mi tomcat local, falla al hacer el ECHO del documento, no se si tendrá algo que ver, he instalado el OpenKM y solamente he creado una carpeta y subido un documento nada mas.
Un Saludos
Re: WebService PHP
PostPosted:Wed Oct 16, 2013 11:09 am
by jllort
Tienes instalada una trial verdad ? Tendrías que mirar si en el log del servidor aparece algun error ( catalina.log )
Re: WebService PHP
PostPosted:Wed Oct 16, 2013 4:07 pm
by jcorral
tengo una community, va a ser mejor idea que me instale una máquina desde cero e instalar solo OpenKM y Apache y ver que pasa.
Muchas gracias
Re: WebService PHP
PostPosted:Fri Oct 18, 2013 8:00 am
by jllort
La 6.2.21 no es una community es un trial seguro que te caducará a los 30 días. La versión community actual es una 6.2.5