Can't upload a case document through /bpm/caseDocument POST request

Hi,
Using bonitaVersion: 7.3.2
I’m not able to upload a document through …/bpm/caseDocument POST request
request_payload is
{“caseId”: 38012, “file”:“test.doc”, “name”:“myTestList”,“fileName”:“test_1.doc”, “name”:“testfiles”, “description”:“”}
and response is
{
“exception”: “class java.lang.IllegalArgumentException”,
“message”: “Can’t parse JSon”,
“stacktrace”: [
“org.bonitasoft.web.rest.server.framework.json.JSonSimpleDeserializer._unserializeTree(JSonSimpleDeserializer.java:62)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:178)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:123)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:212)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:650)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:731)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)”,
“org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)”,
“org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)”,
“org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)”,
“org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)”,
“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)”,
“org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)”,
“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)”,
“org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)”,
“org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)”,
“org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)”,
“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)”,
“org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)”,
“org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)”,
“org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)”,
“java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)”,
“java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)”,
“org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”,
“java.lang.Thread.run(Thread.java:745)”
],
“cause”: {
“exception”: “class org.json.simple.parser.ParseException”,
“message”: “”,
“stacktrace”: [
“org.json.simple.parser.Yylex.yylex(Unknown Source)”,
“org.json.simple.parser.JSONParser.nextToken(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.bonitasoft.web.rest.server.framework.json.JSonSimpleDeserializer._unserializeTree(JSonSimpleDeserializer.java:60)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:178)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:123)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:212)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:188)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:650)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:75)”,
“javax.servlet.http.HttpServlet.service(HttpServlet.java:731)”,
“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:226)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:176)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:747)”,
“org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:485)”,
“org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:410)”,
“org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:337)”,
“org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171)”,
“org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92)”,
“org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:394)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.bonitasoft.console.common.server.login.filter.AbstractAuthorizationFilter.doFilter(AbstractAuthorizationFilter.java:60)”,
“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)”,
“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)”,
“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)”,
“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)”,
“org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)”,
“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)”,
“org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)”,
“org.bonitasoft.console.security.SessionFixationValve.invoke(SessionFixationValve.java:77)”,
“org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)”,
“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)”,
“org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1082)”,
“org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:623)”,
“org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)”,
“java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)”,
“java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)”,
“org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)”,
“java.lang.Thread.run(Thread.java:745)”
]
}
}

Hi,

Unsure why, but your payload seem malformed:

{“caseId”: 38012", “file”:“test.doc”, “name”:“myTestList”,“fileName”:“test_1.doc”, “name”:“testfiles”, “description”:“”}

There is an extra " at the end of 38012 on the first argument. I don’t think that should be here.

Cheers

Hi, there is no problem with request payload, I’ve missed a symbol.
Please clarify, why exception occurs.

Not sure. You also have the attribute name twice in the payload.

{“caseId”: “12”, “file”:“test.doc”, “name”:“myTestList”,“fileName”:“test_1.doc”, “description”:“”}
even this correct payload got failed response(same as mentioned in the question)

{“caseId”:“38023”,
“file”:“myImage.jpg”,
“name”:“testfiles”,
“description”:“”} even this got failed response

“exception”: “class java.lang.IllegalArgumentException”,
“message”: “Can’t parse JSon”,
“stacktrace”: [
“org.bonitasoft.web.rest.server.framework.json.JSonSimpleDeserializer._unserializeTree(JSonSimpleDeserializer.java:62)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:178)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:123)”,

“cause”: {
“exception”: “class org.json.simple.parser.ParseException”,
“message”: “”,
“stacktrace”: [
“org.json.simple.parser.Yylex.yylex(Unknown Source)”,
“org.json.simple.parser.JSONParser.nextToken(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.json.simple.parser.JSONParser.parse(Unknown Source)”,
“org.bonitasoft.web.rest.server.framework.json.JSonSimpleDeserializer._unserializeTree(JSonSimpleDeserializer.java:60)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:178)”,
“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,
“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:123)”,