Page 1 of 1

OpenKM WS through another WS

PostPosted:Fri Mar 04, 2011 11:28 am
by mateusz
Hi,

I want to use OpenKM WS methods from my own WS, to do so I created jar archive with all needed classes after that I created WS which simply login and check if there is some documents in repo in WSDL there is one method which do this.
Code: Select all
@WebService
// @MTOM
public class OpenKMService {

	final static Logger logger = LoggerFactory.getLogger(OpenKMService.class);

	@WebMethod
	public List<Document> unallocatedDocList(
			@WebParam(name = "session_identifier") String session_identifier) {

		List<Document> result = new ArrayList<Document>();

		logger.info("unallocatedDocList test");

		OKMAuthMethods am = new OKMAuthMethods();
		try {
			OKMAuthService okmAuthService = new OKMAuthService();
			OKMAuth okmAuth = okmAuthService.getOKMAuthPort();
			OKMDocumentService okmDocumentService = new OKMDocumentService();
			OKMDocument okmDocument = okmDocumentService.getOKMDocumentPort();

			// Login
			String token = okmAuth.login("okmAdmin", "admin");
			System.out.println("Token: " + token);

			// List documents
			DocumentArray docArray;
			try {
				docArray = okmDocument.getChilds(token,
						"/okm:root");

				List<Document> documents = docArray.getItem();
				for (Document document : documents) {
					System.out.println("[DOCUMENT] Path: " + document.getPath()
							+ ", Author: " + document.getAuthor() + ", Size: "
							+ document.getActualVersion().getSize());
				}
			} catch (PathNotFoundException_Exception e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
			okmAuth.logout(token);
The problem is when I try to check if this work by SoapUI application I get empty response.

Server log:
Code: Select all
11:57:25,260 ERROR [SOAPFaultHelperJAXWS] SOAP request exception
java.lang.reflect.UndeclaredThrowableException
	at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:228)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.processRequest(RequestHandlerImpl.java:474)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleRequest(RequestHandlerImpl.java:295)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.doPost(RequestHandlerImpl.java:205)
	at org.jboss.wsf.stack.jbws.RequestHandlerImpl.handleHttpRequest(RequestHandlerImpl.java:131)
	at org.jboss.wsf.common.servlet.AbstractEndpointServlet.service(AbstractEndpointServlet.java:85)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:235)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
	at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:190)
	at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:92)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.process(SecurityContextEstablishmentValve.java:126)
	at org.jboss.web.tomcat.security.SecurityContextEstablishmentValve.invoke(SecurityContextEstablishmentValve.java:70)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
	at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:158)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:330)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:829)
	at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:598)
	at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
	at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.LinkageError: loader constraint violation: when resolving method "javax.xml.ws.Service.<init>(Ljava/net/URL;Ljavax/xml/namespace/QName;)V" the class loader (instance of org/jboss/classloader/spi/base/BaseClassLoader) of the current class, com/openkm/ws/client/OKMAuthService, and the class loader (instance of <bootloader>) for resolved class, javax/xml/ws/Service, have different Class objects for the type javax/xml/namespace/QName used in the signature
	at com.openkm.ws.client.OKMAuthService.<init>(OKMAuthService.java:45)
	at pl.poznan.put.erepodevel.OpenKMService.unallocatedDocList(OpenKMService.java:52)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
	at java.lang.reflect.Method.invoke(Method.java:597)
	at org.jboss.wsf.container.jboss50.invocation.InvocationHandlerJSE.invoke(InvocationHandlerJSE.java:108)
	at org.jboss.ws.core.server.ServiceEndpointInvoker.invoke(ServiceEndpointInvoker.java:222)
	... 26 more
I know that this problem isn't directly connected with OpenKM but you have more experience both in jBoss server and OpenKM, could you help me?

Thanks in advance

Mateusz

Re: OpenKM WS through another WS

PostPosted:Mon Mar 07, 2011 10:02 am
by pavila
I think is better to post on a dedicated JBoss-WS forum.

Re: OpenKM WS through another WS

PostPosted:Tue Mar 29, 2011 11:38 am
by mike_m
I did exactly the same with what you want to do.
See the following project

The following code is a class wrapper to OpenKM client
http://projects.ellak.gr/projects/scrip ... rImpl.java

The following code is my Service implementation that call OpenKM service
http://projects.ellak.gr/projects/scrip ... rvice.java

Beware, if you're ussing annotated services that ListArrays cannot be passed as webparam arguments.

mike