cancel
Showing results for 
Search instead for 
Did you mean: 

Passing complex objects to instantiate process

justaname
Champ in-the-making
Champ in-the-making
Hello all,

I have a problem with passing complex objects to instantiate a process. The HTTP call and instantiation works fine if a pass the following message:
{"customerid":"cid_1234","ordervalue":4000,","processDefinitionId":"ReferenceProcessSimple:1:120"}
(although the process instance fails because of missing arguments 😉 )


but when I send this JSON:

{"order":{"article":[{"articleid":"artid_4444","articleprice":500,"articleamount":2,"articlename":"computer"},{"articleid":"artid_5555","articleprice":1000,"articleamount":3,"articlename":"laptop"}],"customerid":"cid_1234","ordervalue":4000,"customertel":"0176/765764","customername":"somename"},"processDefinitionId":"ReferenceProcessSimple:1:120"}

the following error is thrown:

1448

{
    "status" :
  {
    "code" : 500,
    "name" : "Internal Error",
    "description" : "An error inside the HTTP server which prevented it from fulfilling the request."
  }, 
 
  "message" : "06070013 Wrapped Exception (with status template): couldn't find type for {\"customerid\":\"cid_1234\",\"article\":[{\"articleid\":\"artid_4444\",\"articleprice\":500,\"articleamount\":2,\"articlename\":\"computer\"},{\"articleid\":\"artid_5555\",\"articleprice\":1000,\"articleamount\":3,\"articlename\":\"laptop\"}],\"ordervalue\":4000,\"customertel\":\"0176\/765764\",\"customername\":\"somename\"}", 
  "exception" : "org.springframework.extensions.webscripts.WebScriptException - 06070013 Wrapped Exception (with status template): couldn't find type for {\"customerid\":\"cid_1234\",\"article\":[{\"articleid\":\"artid_4444\",\"articleprice\":500,\"articleamount\":2,\"articlename\":\"computer\"},{\"articleid\":\"artid_5555\",\"articleprice\":1000,\"articleamount\":3,\"articlename\":\"laptop\"}],\"ordervalue\":4000,\"customertel\":\"0176\/765764\",\"customername\":\"somename\"}",
 
  "callstack" :
  [
       ""      ,"org.activiti.engine.ActivitiException: couldn't find type for {\"customerid\":\"cid_1234\",\"article\":[{\"articleid\":\"artid_4444\",\"articleprice\":500,\"articleamount\":2,\"articlename\":\"computer\"},{\"articleid\":\"artid_5555\",\"articleprice\":1000,\"articleamount\":3,\"articlename\":\"laptop\"}],\"ordervalue\":4000,\"customertel\":\"0176\/765764\",\"customername\":\"somename\"}"
      ,"org.activiti.engine.impl.variable.DefaultVariableTypes.findVariableType(DefaultVariableTypes.java:62)"
      ,"org.activiti.engine.impl.persistence.entity.VariableScopeImpl.createVariableLocal(VariableScopeImpl.java:212)"
      ,"org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariable(VariableScopeImpl.java:164)"
      ,"org.activiti.engine.impl.persistence.entity.VariableScopeImpl.setVariables(VariableScopeImpl.java:253)"


I have tried different alternatives to create the JSON-File (manually, XML.toJSONObject, JSONObject) and structures of the message but all of them fail with the same error message.

Since I have defined some custom logging in the process, I would at least recognize if the instance would have been started and the assignment of a variable would fail.


Help is very appreciated.

Thanks in advance!
2 REPLIES 2

vijay_pala
Champ in-the-making
Champ in-the-making
Hi All,

Is it possible to pass complex object to start process?

Thanks in Advance.

frederikherema1
Star Contributor
Star Contributor
This is currently not possible. In the new REST-api, this will be possible because there is a pluggable mechanism for variable-types. It will allow you to plug is some code to create a POJO based on a JSON-representation (exposed as a Map<Stirng, ..>). This will be available in 5.13 of 5.14.