Having read this quick guide I’ve created a simple process and deployed it locally using the Bonita UI version 6.2.5 - I can login, create a new case of my process navigating to localhost:8080 in my browser. However when I attempt to create a new case using the REST api I get a HTTP 500 error and the following response returned:
{"exception":"class java.lang.NullPointerException","message":"","stacktrace":[ < massive stack trace here > ]}To do this I’m navigating to http://localhost:8080/bonita/API/bpm/process?p=0 to obtain the process ID, which I believe is the highlighted portion of the response below:
[{“id”:“7163253574217604033”,“icon”:“”,“displayDescription”:“”,“deploymentDate”:“2014-04-14 16:00:54.369”,“description”:“”,“activationState”:“ENABLED”,“name”:“AuthoriseBankAccountChange”,“deployedBy”:“4”,“displayName”:“AuthoriseBankAccountChange”,“last_update_date”:“2014-04-14 16:00:54.553”,“configurationState”:“RESOLVED”,“version”:“1.0”}]
Then I’m creating the POST request as follows - I’m just putting together a quick POC\evaluation first, which is why I’m hacking a quick test together using js in my browser:
// authenticate. verified correct by logging in with these credentials using the //web UI, logging out + clearing cookies, unsuccessfully navigating to // http://localhost:8080/bonita, then issuing the command and successfully //navigating to http://localhost:8080/bonita var loginURL = "http://localhost:8080/bonita/loginservice" $.post(url, { username: "walter.bates", password: "bpm", redirect: false })// create a new case. returns http 500 error
var processURL = “http://localhost:8080/bonita/API/bpm/case/”
var processData = { “processDefinitionId”: 7163253574217604033, “variables”: [{“name”:“claccountid”, “value”:“123456”},{“name”:“datemodified”, “value”:“2014-04-14”},{“name”:“modifiedby”, “value”:“404404”},{“name”:“fieldname”, “value”:“SortCode”},{“name”:“oldvalue” , “value”:“123456”},{“name”:“newvalue” , “value”:“123455”},{“name”:“approved”,“value”:“false”}]}
$.post(processURL, processData)
For each of the elements in “variables” the “name” field corresponds to a variable in the main swimlane of my BPM diagram. When I change the processDefinitionId to something random I get the same error, so I’m thinking that I might be using the wrong value - is this the case?
Edit: full stack trace is as follows…
{“exception”:“class java.lang.NullPointerException”,“message”:“”,“stacktrace”:[“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:212)”,“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:198)”,“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:188)”,“org.bonitasoft.web.toolkit.client.common.json.JSonItemReader.parseItem(JSonItemReader.java:168)”,“org.bonitasoft.web.rest.server.framework.APIServletCall.getJSonStreamAsItem(APIServletCall.java:84)”,“org.bonitasoft.web.rest.server.framework.APIServletCall.doPost(APIServletCall.java:169)”,“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.doPost(ToolkitHttpServlet.java:184)”,“javax.servlet.http.HttpServlet.service(HttpServlet.java:643)”,“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:71)”,“javax.servlet.http.HttpServlet.service(HttpServlet.java:723)”,“org.bonitasoft.web.toolkit.server.servlet.ToolkitHttpServlet.service(ToolkitHttpServlet.java:222)”,“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)”,“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)”,“org.bonitasoft.console.common.server.login.filter.FilterManager.pageRedirect(FilterManager.java:88)”,“org.bonitasoft.console.common.server.login.filter.FilterManager.doFilter(FilterManager.java:68)”,“org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)”,“org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)”,“org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)”,“org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)”,“org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)”,“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:109)”,“org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)”,“org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:861)”,“org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:606)”,“org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)”,“java.lang.Thread.run(Unknown Source)”]}