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.
-
fisioemax
- Fresh Boarder

- Posts: 9
- Joined: Fri Mar 24, 2017 9:15 am
Post
by fisioemax » Tue Apr 11, 2017 7:16 am
Traslado la pregunta a este apartado ya que es más correcta que donde la puse anteriormente.
El código me crea el documento en la carpeta del ordenador pero a la hora de llamar al método createDocument muestra los siguientes warning y no crea el documento dentro de OpenKM.
Code: Select all
<?php
include 'src/openkm/OpenKM.php';
use openkm\OKMWebServicesFactory;
use openkm\OpenKM;
use openkm\bean;
class ExampleDocument {
const HOST = "http://localhost:8080/OpenKM/";
const USER = "okmAdmin";
const PASSWORD = "admin";
private $ws;
public function __construct() {
$this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
}
public function testCreateDocument() {
try {
$archivo = fopen("datos.html", "w") or die("error creando fichero!");
$txt = "<h1>Contenido completo en HTML...</h1>";
fwrite($archivo, $txt);
fclose($archivo);
$fileName = dirname(__FILE__) . '/datos.html';
$document = new \openkm\bean\Document();
$document->setPath('/okm:root/Prueba/datos.html');
$doc = $this->ws->createDocument($document, file_get_contents($fileName));
var_dump($doc);
} catch (Exception $e) {
var_dump($e);
}
}
}
$openkm = new OpenKM(); //autoload
$exampleDocument = new ExampleDocument();
$exampleDocument->testCreateDocument();
?>
Los warnings:
Code: Select all
Warning: simplexml_load_string(): Entity: line 1: parser error : Start tag expected, '<' not found in C:\xampp\htdocs\openkm\src\Httpful\Handlers\XmlHandler.php on line 42
Warning: simplexml_load_string(): NullPointerException: null in C:\xampp\htdocs\openkm\src\Httpful\Handlers\XmlHandler.php on line 42
Warning: simplexml_load_string(): ^ in C:\xampp\htdocs\openkm\src\Httpful\Handlers\XmlHandler.php on line 42
Muchas gracias.
-
sochoa
- Junior Boarder

- Posts: 37
- Joined: Thu May 02, 2013 3:26 am
Post
by sochoa » Mon Apr 17, 2017 3:04 pm
Hola muy buenos dias hay un bugs con el metodo createDocument del SDK de PHP lo estoy revisando
puede probar con el otro metodo:
Code: Select all
createDocumentSimple($docPath,$content);
public function testCreateDocumentSimple() {
try {
$fileName = dirname(__FILE__) . '/files/logo.png';
$docPath = '/okm:root/SDK4PHP/logo.png';
$document = $this->ws->createDocumentSimple($docPath, file_get_contents($fileName));
var_dump($document);
} catch (Exception $e) {
var_dump($e);
}
}
Code: Select all
<?php
include 'src/openkm/OpenKM.php';
use openkm\OKMWebServicesFactory;
use openkm\OpenKM;
use openkm\bean;
class ExampleDocument {
const HOST = "http://localhost:8080/OpenKM/";
const USER = "okmAdmin";
const PASSWORD = "admin";
private $ws;
public function __construct() {
$this->ws = OKMWebServicesFactory::build(self::HOST, self::USER, self::PASSWORD);
}
public function testCreateDocumentSimple() {
try {
$archivo = fopen("datos.html", "w") or die("error creando fichero!");
$txt = "<h1>Contenido completo en HTML...</h1>";
fwrite($archivo, $txt);
fclose($archivo);
$fileName = dirname(__FILE__) . '/datos.html';
$docPath = '/okm:root/Prueba/datos.html';
$doc = $this->ws->createDocumentSimple($docPath, file_get_contents($fileName));
var_dump($doc);
} catch (Exception $e) {
var_dump($e);
}
}
}
$openkm = new OpenKM(); //autoload
$exampleDocument = new ExampleDocument();
$exampleDocument->testCreateDocumentSimple();
?>
-
fisioemax
- Fresh Boarder

- Posts: 9
- Joined: Fri Mar 24, 2017 9:15 am
Post
by fisioemax » Tue Apr 18, 2017 10:59 am
Con ese método si he podido crearlo.
Continúo probando cosas.
Muchas gracias.
-
sochoa
- Junior Boarder

- Posts: 37
- Joined: Thu May 02, 2013 3:26 am
Post
by sochoa » Thu Oct 12, 2017 4:12 am
Hola muy buenas noches.
El metodo createDocument se decidio quitarlo ya que el metodo createDocumentSimple hace lo mismo.
Esto cambio estara en la ver v1.1.2 del sdk4php
Saludos
Who is online
Users browsing this forum: No registered users and 3 guests