• Problema con OKMAuth getUsers

  • 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.
 #9682  by lopsa
 
Hola,

estoy tratando de obtener los usuarios registrados en Open KM a través del web service, pero me encuentro con un StringArray vacío. Sin embargo, en el log de JBoss (server.log) veo que efectivamente se serializa el objeto, pero por alguna razón no lo estoy recibiendo correctamente.

¿Me podrían orientar de alguna manera en este caso?

Gracias de antemano.

Saludos.
Code: Select all
private StringArray getUsers(java.lang.String token) throws PrincipalAdapterException_Exception {
        com.openkm.ws.endpoint.OKMAuth port = service.getOKMAuthPort();
        //Cliente WS. Aqui llega un objeto de tipo StringArray, vacío
        return port.getUsers(token);
    }
Server.log (OpenKM):
DEBUG [org.jboss.ws.core.soap.ObjectContent] xmlFragment: [source=<return><item>demo1</item><item>demo2</item><item>okmAdmin</item></return>]
 #9894  by pavila
 
Pues no he encontrado ningún problema en las pruebas realizadas. Por lo menos en la versión 5.0.3 de OpenKM funciona correctamente.
Code: Select all
<?php
$okmurl = "http://your-server/OpenKM/";
$okmid = "okmAdmin";
$okmpw = "admin";

$OKMAuth = new SoapClient($okmurl."OKMAuth?wsdl");

// Login
$token = $OKMAuth->login($okmid, $okmpw);
$userList = $OKMAuth->getUsers($token);
print_r($userList);

// Logout
$OKMAuth->logout($token);
?>
 #10235  by lopsa
 
Después de revisar el caso, caí en cuenta de cual es el error.

Al declarar el web service simplemente lo estaba anotando de acuerdo a la especificación de Java EE 6
Code: Select all
@WebServiceRef(wsdlLocation = "WEB-INF/wsdl/localhost_8080/OpenKM/OKMAuth.wsdl")
private OKMAuthService service;
y de este modo todos los métodos remotos funcionaban correctamente excepto aquellos que regresan un objeto "complejo" (Ej. FolderArray, StringArray, etc.).

Lo que hice para que funcionaran estos métodos es inicializar el servicio de forma explícita, agregando:
Code: Select all
OKMAuthService service = new OKMAuthService();
Lo que me parece curioso es que algunos métodos si funcionaban correctamente con la "anotación" @webServiceRef aún sin crear explícitamente una instancia del servicio.
 #10416  by pavila
 
Yo para hacer la parte cliente genero una librería con este script:
Code: Select all
#/bin/bash

wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMAuth?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMDocument?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMFolder?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMSearch?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMNotification?wsdl
wsimport -p com.openkm.ws.client http://localhost:8080/OpenKM/OKMRepository?wsdl

jar cvf okm-ws-client-2.1.jar com

rm -rf com

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.