1

代码旋转网:

                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,“错误”:“内部服务器错误”,“异常”:“org.camunda.bpm.model.xml.ModelException”,“消息”:“新孩子不是一个有效的子元素类型:map;有效的类型是:[]", "path": "/camunda/updateWorkflow/"

4

1 回答 1

1

好吧,我面临着同样的问题。根据 Camunda 文档:https ://docs.camunda.org/manual/7.6/reference/bpmn20/custom-extensions/extension-elements/#inputparameter 地图元素在 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
于 2018-03-15T12:37:07.717 回答