Code Spinnet :
CamundaInputParameter camundaInputParameter2=createElement(camundaInputOutput, CamundaInputParameter.class);
camundaInputParameter2.setCamundaName("headers");
CamundaMap camundamap = createElement(camundaInputParameter2, CamundaMap.class);
CamundaEntry camundaentry = createElement(camundamap, CamundaEntry.class);
camundaentry.setCamundaKey("Accept");
camundaentry.setTextContent("application/json");
JSON Response :
{ "timestamp": 1518705529135, "status": 500, "error": "Internal Server Error", "exception": "org.camunda.bpm.model.xml.ModelException", "message": "New child is not a valid child element type: map; valid types are: []", "path": "/camunda/updateWorkflow/"
Well, I was facing the same issue. According to the Camunda docs: https://docs.camunda.org/manual/7.6/reference/bpmn20/custom-extensions/extension-elements/#inputparameter the map element is in the list of child elements of inputParameter, so it should work but it doesn't. A workaround would be:
CamundaInputParameter headers = model.newInstance(CamundaInputParameter.class);
headers.setCamundaName("headers");
CamundaMap map = model.newInstance(CamundaMap.class);
CamundaEntry entry = model.newInstance(CamundaEntry.class);
entry.setCamundaKey("Content-Type");
entry.setTextContent("application/json");
map.addChildElement(entry);
//headers.addChildElement(map); does not work
headers.getDomElement().appendChild(map.getDomElement()); // works