• REST -> application/json -> No message body writer has been found for response class FolderList.

  • 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.
 #40741  by flip
 
Whenever I try to make a REST request without a specified "accept" header, I get XML as result.
However, when I set the "accept" header to "application/json" I get 500 Server Error and "No message body writer has been found for response class FolderList."

Steps to reproduce:
-> download newest OpenKM Community Version (6.3.1)
-> start, add few documents and folders
-> http://localhost:8080/OpenKM/services/r ... xxxxxxxxxx
-> add header "accept: application/json"

Is there any workaround or am I doing something wrong?
 #40745  by sochoa
 
I advise you to use the SDK became increasingly SDK method is exemplified

NEW SDK VERSIONS FOR JAVA, PHP AND .NET RELEASED

More information about SDK for Java.
http://docs.openkm.com/kcenter/view/sdk4j/

More information about SDK for PHP.
http://docs.openkm.com/kcenter/view/sdk4php/

More information about SDK for .NET.
http://docs.openkm.com/kcenter/view/sdk4net/

but will review the issue because no returns JSON

Greetings
 #40752  by jllort
 
As sochoa suggested to you we encourage using one of the SDK.

However you can check with curl command line
Code: Select all
$ curl -u okmAdmin:admin -H "Accept: application/json" \
   http://localhost:8080/OpenKM/services/rest/folder/getChildren?fldId=3492d662-b58e-417c-85b6-930ad0c6c3cf
 #40839  by Catscratch
 
Edit: I solved the problem. Indeed it was a CXF dependency problem. I documented the solution in JIRA:
http://jira.openkm.com/browse/OCM-6
Would be nice if you can modify community sources as described.

- old post -
Hi,

using SDK is not a solution. Because SDK is only available for Java and PHP. I got the same problem when trying to communicate via Javascript. Seems you forgot some annotations in the code or an own object wrapper for JSON. Thats a common issue when you try to return a whole own object (like FolderList) instead of some primitive objects like Map or List.

Here is the backend log:
Code: Select all
2015-11-10 16:59:02,350 [http-bio-0.0.0.0-18080-exec-175] WARN  org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor- No message body writer has been found for response class FolderList.
Besides, it's the same for every own object you return. Like (folder, document, ...):
Code: Select all
2015-11-10 16:55:04,825 [http-bio-0.0.0.0-18080-exec-131] WARN  org.apache.cxf.jaxrs.interceptor.JAXRSOutInterceptor- No message body writer has been found for response class Folder.
 #43345  by Petr_Valenta
 
Hello

I have downloaded a Development environment Openkm-6.3-community-portable-dev-1.0 (Windows) on 1.3.2017.

I face the same problem with OpenKM/services/rest/document/createSimple. When I create a document, I receive a message mentioned here.

But I have the same problem with OpenKM/services/rest/test/getComplex. It ends up with the same message.

If I use XML, it seems ok. But I need a json.

Could you hlep me please?

Thanks a lot in advance
 #43364  by jllort
 
Take a look here:
https://docs.openkm.com/kcenter/view/sd ... #Jarsample

If when you execute from eclipse will going right, but when you exeucte a jar fails, then probably you have a wrong pom.xml ( it's a problem while creating jar file, exists two dependences with same file name, and the files by default are not merging, are overwritten, the sample pom.xml in the documentation solves it ).
 #43368  by Petr_Valenta
 
Hello

Thank you very much for your answer.

But there is no construction in the pom.xml distributed within "Openkm-6.3-community-portable-dev-1.0 (Windows)" using "maven-assembly-plugin" or "maven-shade-plugin" (as mentioned in the link above). Should I add it into pom.xml? If yes - where?

As for pom.xml - it is unchanged version, I'm using your pom.xml. And it does not look like having any problem. The result seems functional except for the problem described here.

Any suggestion what to to do next?
 #43375  by jllort
 
You are using REST outside OpenKM has not sense using REST webservices from OpenKM.war file, from OpenKM.war you must use the API ( https://docs.openkm.com/kcenter/view/ok ... ption.html ). Portable edition comes with several project, one is the build of OpenKM source code where has not sense using from there the webservices.
 #43376  by Petr_Valenta
 
Hello

I'm afraid we don't understand each other.

I have 3rd party application on the customer's site and I need to communicate from it with OpenKM by REST. And I need to extend services by my own.

I have built OpenKM by means of Openkm-6.3-community-portable-dev-1.0 (Windows). When I test both original and custom services with application/xml, they work with no problem. But when I use application/json (which is the required way), both sets of services fail.

What do I need to change in your sources to be able to communicate by application/json?
 #43379  by jllort
 
It fails only in creation document or in any method ?
About the remote application, how are you creating the client ( it's a war application and you are creating from there, or you are creating a third-party-application -> man-in-the-middle -> what does it ? )
 #43380  by Petr_Valenta
 
There is failing the return of creating a document - from both the original service and from my custom service. The document itself is created in both cases, but the final status of the call is an error.

The third party application is assembling a JSON request "manually" and sends it through a middleware network layer to OpenKM.

As for other commands

curl -u okmAdmin:admin -H "Accept: application/json" -X POST -H "Content-Type: application/json" -d '/okm:root/newfolder' http://localhost:8080/OpenKM/services/r ... eateSimple --> RepositoryException: Invalid path: '/okm:root/newfolder'
This is not working for any tested path.

curl -u okmAdmin:admin -H "Accept: application/json" -X GET http://localhost:8080/OpenKM/services/r ... word=santo
No message body writer has been found for response class QueryResultList.

curl -u okmAdmin:admin -H "Accept: application/json" http://localhost:8080/OpenKM/services/r ... 85fdf6330a
No message body writer has been found for response class FolderList.

I did not test every service but it looks like a problem across all of them.

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.