.Net SDK Webservice OKMDocument createSimple problem

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.
Post Reply
ofstab
Junior Boarder
Junior Boarder
Posts: 35
Joined: Tue Jan 05, 2016 9:21 am

.Net SDK Webservice OKMDocument createSimple problem

Post by ofstab » Tue Mar 01, 2016 11:55 am

Hi,

I am working on a Outlook Add In, and I am having a weird problem when handling office attachments in the form of docx or xlsx.

I import them to OpenKM using the following (vb.net) code:

Code: Select all

        Dim fileInputStream As IO.FileStream = New IO.FileStream(tempPath & "\" & tempFilename, IO.FileMode.Open)
        Dim content(fileInputStream.Length) As Byte

        fileInputStream.Read(content, 0, fileInputStream.Length)
        
        If webservice.documentExists(openKmpath & "/" & tempFilename) = False Then
            webservice.createSimple(openKmpath & "/" & tempFilename, content)
        End If

        fileInputStream.Close()
tempPath and tempFilename just point to the folder and filename of the dox/xlsx file, and openKmpath is what you think it would be.

webservice is an instance of OKMWebservice.

The problem is that when I try to download these documents from OpenKM, word and excel complain that they have been corrupted and they try to fix them. Excel tries some file validation repair, and Word plain refuses to open the file complaining it is corrupt. Excel eventually opens the file - and all the content is there. Word makes me recover the contents into a new file, and again everything is there.

I have carried out a byte comparison between the files before and after upload to OpenKM through my method and there is no change. Byte for byte the files are the same.

If I load the files into OpenKM through the Add Document menu option or through the Java File Uploader everything is fine. If I convert the files to the older .doc and .xls formats before I put them through my method, everything is fine.

The problem seems to be either something to do with my code, which seems simple, or the createSimple method is doing something to the files. When I view their properties in Windows, the metadata seems to have been stripped off (I mean the right click->properties->details tab information). All info apart from the creation dates is missing. The only thing I can think of is that this is triggering an Office warning about the file which manifests as a complaint about it being corrupt. Somehow the built in file upload methods manage to preserve this information, but the createSimple method does not.

All the metadata on the doc, or xml, files is also preserved by the createSimple method, it is just docx and xlsx files that seem to be affected. At present this is just an annoyance, as all the file content data is being preserved, and it just means a couple more mouse clicks when extracting a document, but I am concerned something more fundamental is wrong.

jllort
Moderator
Moderator
Posts: 9380
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by jllort » Wed Mar 02, 2016 6:51 pm


ofstab
Junior Boarder
Junior Boarder
Posts: 35
Joined: Tue Jan 05, 2016 9:21 am

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by ofstab » Thu Mar 03, 2016 1:17 pm

Thank you for your reply.

My simple answer is because I did not think the Rest services were available on the Community version. I was working from this http://wiki.openkm.com/index.php/SDK_for_.NET page which says that Rest 2.1 is for Professional. I have been working with the three individual DLLs for the "older" Community version.

And those SDKs do not have a createDocumentSimple method.

I now see from your link that Rest services are available for community. This is good! However, I cannot find anything in them that is the equivalent of the webservice.documentExists check that I perform in my code. Do you just
Try
.....create doc
Catch exception

if it already exists?

ofstab
Junior Boarder
Junior Boarder
Posts: 35
Joined: Tue Jan 05, 2016 9:21 am

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by ofstab » Thu Mar 03, 2016 5:07 pm

Hi. Silly question above. I presume this is the purpose of the new IsValidFolder/IsValidDocument methods.

My problem is that I cannot get that to work.

My code (VB again, sorry) is:

Code: Select all

Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports com.openkm.sdk4csharp
Imports com.openkm.sdk4csharp.bean


Class Form1

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim host As [String] = "http://localhost:8080/OpenKM"
        Dim username As [String] = "okmAdmin"
        Dim password As [String] = "admin"
        Dim ws As OKMWebservice = OKMWebservicesFactory.newInstance(host, username, password)

        Try
            Dim fld As New Folder()
            fld.path = "/okm:root/temp"
            ws.createFolder(fld)
            ListBox1.Items.Add("Created Folder")
        Catch ex As exception.OKMRestException
            ListBox1.Items.Add(ex.ToString())
        End Try

        Try
            ListBox1.Items.Add(ws.getNodeUuid("/okm:root"))
        Catch ex As exception.OKMRestException
            ListBox1.Items.Add(ex.ToString())
        End Try

        Try
            Dim answertoquestion As Boolean
            answertoquestion = ws.isValidFolder("/okm:root")
            ListBox1.Items.Add(answertoquestion)
        Catch ex As exception.OKMRestException
            ListBox1.Items.Add(ex.ToString())
        End Try

        Try
            Dim folderpath As String
            folderpath = "/okm:root/temp"
            ws.deleteFolder(folderpath)
            ListBox1.Items.Add("Deleted Temp")
        Catch ex As exception.OKMRestException
            ListBox1.Items.Add(ex.ToString())
        End Try

    End Sub
End Class
The first method - createFolder - works fine. A folder appears as expected. However, each of the other attempts throws an exception. The catalina.out log is:

Code: Select all

2016-03-03 17:02:41,712 [http-bio-0.0.0.0-8080-exec-9] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper- com.openkm.rest.GenericException: java.lang.NullPointerException
	at com.openkm.rest.endpoint.RepositoryService.getNodeUuid(RepositoryService.java:238)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:241)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:211)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at com.openkm.util.PathUtils.encodeEntities(PathUtils.java:109)
	at com.openkm.dao.NodeBaseDAO.calculateUuidFromPath(NodeBaseDAO.java:253)
	at com.openkm.dao.NodeBaseDAO.calculateUuidFromPath(NodeBaseDAO.java:232)
	at com.openkm.dao.NodeBaseDAO.getUuidFromPath(NodeBaseDAO.java:122)
	at com.openkm.module.db.DbRepositoryModule.getNodeUuid(DbRepositoryModule.java:707)
	at com.openkm.rest.endpoint.RepositoryService.getNodeUuid(RepositoryService.java:234)
	... 60 more

2016-03-03 17:02:41,774 [http-bio-0.0.0.0-8080-exec-10] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper- com.openkm.rest.GenericException: java.lang.NullPointerException
	at com.openkm.rest.endpoint.FolderService.isValid(FolderService.java:160)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:241)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:211)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at com.openkm.util.PathUtils.isPath(PathUtils.java:141)
	at com.openkm.module.db.DbFolderModule.isValid(DbFolderModule.java:670)
	at com.openkm.rest.endpoint.FolderService.isValid(FolderService.java:156)
	... 60 more

2016-03-03 17:02:41,820 [http-bio-0.0.0.0-8080-exec-7] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper- com.openkm.rest.GenericException: java.lang.NullPointerException
	at com.openkm.rest.endpoint.FolderService.delete(FolderService.java:104)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:241)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doDelete(AbstractHTTPServlet.java:217)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:652)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at com.openkm.util.PathUtils.isPath(PathUtils.java:141)
	at com.openkm.module.db.DbFolderModule.delete(DbFolderModule.java:211)
	at com.openkm.rest.endpoint.FolderService.delete(FolderService.java:101)
	... 60 more

Any idea?

jllort
Moderator
Moderator
Posts: 9380
Joined: Fri Dec 21, 2007 11:23 am
Location: Sineu - ( Illes Balears ) - Spain
Contact:

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by jllort » Fri Mar 04, 2016 6:01 pm

I suggest going step by step, there are a lot of methods and calls and is quite difficult decrypting everything.

Confirm to me that the method you are getting the error is:
String uuid = ws.getNodeUuid("/okm:root");

ofstab
Junior Boarder
Junior Boarder
Posts: 35
Joined: Tue Jan 05, 2016 9:21 am

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by ofstab » Mon Mar 07, 2016 9:40 am

OK, taking things step by step, I switched to a simple console application and used only the getNodeUuid method:

Code: Select all

Imports System.Collections.Generic
Imports System.Linq
Imports System.Text
Imports com.openkm.sdk4csharp
Imports com.openkm.sdk4csharp.bean

Module Module1

    Sub Main()
        Dim host As [String] = "http://localhost:8080/OpenKM"
        Dim username As [String] = "okmAdmin"
        Dim password As [String] = "admin"
        Dim ws As OKMWebservice = OKMWebservicesFactory.newInstance(host, username, password)

        Try
        '
        '
        '
            Console.WriteLine(ws.getNodeUuid("/okm:root"))
        '
        '        
        '
        Catch ex As Exception.OKMRestException
            Console.WriteLine(ex.ToString())
        End Try
        Console.WriteLine("Press Enter to terminate...")
        Console.Read()
    End Sub

End Module
In the console window that produces this error:

Code: Select all

com.openkm.sdk4csharp.exception.OKMRestException: RepositoryImpl (getNodeUuid)
RepositoryImpl (getNodeUuid): null

com.openkm.sdk4csharp.exception.UnknowException: RepositoryImpl (getNodeUuid): n
ull
   at com.openkm.sdk4csharp.impl.RepositoryImpl.getNodeUuid(String nodePath)
   at com.openkm.sdk4csharp.impl.RepositoryImpl.getNodeUuid(String nodePath)
   at com.openkm.sdk4csharp.OKMWebservice20.getNodeUuid(String nodePath)
   at Test_Valid_Console.Module1.Main() in C:\VBPrograms\Test_Valid_Console\Test
_Valid_Console\Module1.vb:line 19
Press Enter to terminate...

And the catalina.log file records this error:

Code: Select all

2016-03-07 09:04:05,091 [http-bio-0.0.0.0-8080-exec-1] WARN  org.apache.cxf.jaxrs.impl.WebApplicationExceptionMapper- com.openkm.rest.GenericException: java.lang.NullPointerException
	at com.openkm.rest.endpoint.RepositoryService.getNodeUuid(RepositoryService.java:238)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.cxf.service.invoker.AbstractInvoker.performInvocation(AbstractInvoker.java:188)
	at org.apache.cxf.service.invoker.AbstractInvoker.invoke(AbstractInvoker.java:104)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:204)
	at org.apache.cxf.jaxrs.JAXRSInvoker.invoke(JAXRSInvoker.java:101)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor$1.run(ServiceInvokerInterceptor.java:58)
	at org.apache.cxf.interceptor.ServiceInvokerInterceptor.handleMessage(ServiceInvokerInterceptor.java:94)
	at org.apache.cxf.phase.PhaseInterceptorChain.doIntercept(PhaseInterceptorChain.java:272)
	at org.apache.cxf.transport.ChainInitiationObserver.onMessage(ChainInitiationObserver.java:121)
	at org.apache.cxf.transport.http.AbstractHTTPDestination.invoke(AbstractHTTPDestination.java:241)
	at org.apache.cxf.transport.servlet.ServletController.invokeDestination(ServletController.java:248)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:222)
	at org.apache.cxf.transport.servlet.ServletController.invoke(ServletController.java:153)
	at org.apache.cxf.transport.servlet.CXFNonSpringServlet.invoke(CXFNonSpringServlet.java:171)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.handleRequest(AbstractHTTPServlet.java:286)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.doGet(AbstractHTTPServlet.java:211)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
	at org.apache.cxf.transport.servlet.AbstractHTTPServlet.service(AbstractHTTPServlet.java:262)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:311)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:116)
	at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:83)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:54)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:201)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
	at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:323)
	at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:173)
	at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:346)
	at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:259)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:503)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:170)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:421)
	at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1070)
	at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:611)
	at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:314)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.NullPointerException
	at com.openkm.util.PathUtils.encodeEntities(PathUtils.java:109)
	at com.openkm.dao.NodeBaseDAO.calculateUuidFromPath(NodeBaseDAO.java:253)
	at com.openkm.dao.NodeBaseDAO.calculateUuidFromPath(NodeBaseDAO.java:232)
	at com.openkm.dao.NodeBaseDAO.getUuidFromPath(NodeBaseDAO.java:122)
	at com.openkm.module.db.DbRepositoryModule.getNodeUuid(DbRepositoryModule.java:707)
	at com.openkm.rest.endpoint.RepositoryService.getNodeUuid(RepositoryService.java:234)
	... 60 more
My OpenKM Version is:

Code: Select all

OpenKM - Knowledge Management
Version: 6.3.1 (build: 8235)
My Java version is:

Code: Select all

c:\xampp\tomcat>java -version
java version "1.7.0_79"
Java(TM) SE Runtime Environment (build 1.7.0_79-b15)
Java HotSpot(TM) 64-Bit Server VM (build 24.79-b02, mixed mode)

ofstab
Junior Boarder
Junior Boarder
Posts: 35
Joined: Tue Jan 05, 2016 9:21 am

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by ofstab » Mon Mar 07, 2016 11:24 am

Problem solved. I am an idiot. I was using restsharp 104.1 when the guide expressly says that it needs 104.4.

As soon as I upgraded the RestSharp dll, the error went away.

Now to convert all my code to use the new SDK.

ofstab
Junior Boarder
Junior Boarder
Posts: 35
Joined: Tue Jan 05, 2016 9:21 am

Re: .Net SDK Webservice OKMDocument createSimple problem

Post by ofstab » Mon Mar 07, 2016 1:20 pm

All code now converted and I am pleased to report that the weird problem that prompted this thread has gone.

In summary createSimple has problems with xlsx and docx files. createDocumentSimple works fine.

Post Reply

Who is online

Users browsing this forum: No registered users and 1 guest