我无法将 camunda 地图元素作为 Input parameter.Could 的子元素,不明白为什么?

I cannot make camunda map element as a child element of Input parameter.Could not understand why?

代码旋转网:

                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 响应:

{ "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/"

好吧,我遇到了同样的问题。根据 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