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响应:
{ "时间戳":1518705529135, "状态":500, "错误":"内部服务器错误", " exception":" org.camunda.bpm.model.xml.ModelException", " message":"新子元素不是有效的子元素类型:map;有效类型是:[]", "路径":" / camunda / updateWorkflow /"
答案 0 :(得分:1)
好吧,我遇到了同样的问题。根据Camunda文档:https://docs.camunda.org/manual/7.6/reference/bpmn20/custom-extensions/extension-elements/#inputparameter map元素位于inputParameter的子元素列表中,因此它应该可以工作但不会。 解决方法是:
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