REST -> application/json -> No message body writer has been found for response class FolderList.
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.
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.
REST -> application/json -> No message body writer has been found for response class FolderList.
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?
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?
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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
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
-
- Moderator
- Posts: 11385
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
As sochoa suggested to you we encourage using one of the SDK.
However you can check with curl command line
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
-
- Platinum Boarder
- Posts: 336
- Joined: Wed Feb 16, 2011 10:35 am
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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:
Besides, it's the same for every own object you return. Like (folder, document, ...):
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.
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.
-
- Moderator
- Posts: 11385
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
Thanks, usually us we're using XML an we had not detected it. As soon as possible we will solve it on source code.
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
Does this command line work without the modification?
Code: Select all
curl -u okmAdmin:admin -H "Accept: application/json" http://localhost:8080/OpenKM/services/rest/test/getComplex
-
- Platinum Boarder
- Posts: 336
- Joined: Wed Feb 16, 2011 10:35 am
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
This is working.
Answer:
Answer:
{
"author": "Kiko",
"date": "2016-01-18T12:04:16.072+01:00",
"path": "/one/path",
"text": "Test content message"
}
-
- Senior Boarder
- Posts: 47
- Joined: Mon Mar 06, 2017 9:10 am
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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
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
-
- Moderator
- Posts: 11385
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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 ).
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 ).
-
- Senior Boarder
- Posts: 47
- Joined: Mon Mar 06, 2017 9:10 am
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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?
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?
-
- Moderator
- Posts: 11385
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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.
-
- Senior Boarder
- Posts: 47
- Joined: Mon Mar 06, 2017 9:10 am
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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?
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?
-
- Moderator
- Posts: 11385
- Joined: Fri Dec 21, 2007 11:23 am
- Location: Sineu - ( Illes Balears ) - Spain
- Contact:
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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 ? )
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 ? )
-
- Senior Boarder
- Posts: 47
- Joined: Mon Mar 06, 2017 9:10 am
Re: REST -> application/json -> No message body writer has been found for response class FolderList.
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.
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.