I’ve run into a problem while using the “Get BPMN 2.0 XML” request. I have managed to get the XML of my model correctly, however when i try to show it in my website while using the bpmn.js library, I get this error. message : “required args <xml=string>”. Is there some kind of step I’m missing that goes between fetching the XML and this code (from the bpmn.js starter guide
)
Any help would be much appreciated!
@CormacJordan can you upload the bpmn model?
Feelings.bpmn (4.6 KB)
Here’s my model. It’s a very simple one, I only made it to try my hand at getting its XML.
I’m having the same issue.
@CormacJordan @drobqlarant, Give a try like this:
const BpmnViewer = require('bpmn-js');
const xml; // my BPMN 2.0 xml
const viewer = new BpmnViewer({ container: document.createElement('div') });
viewer.importXML(xml, function() {
// our rendering takes place here
});
And refer this blog https://blog.camunda.com/post/2018/02/creating-a-3d-renderer/ wrote by @sebastian.stamm, and
I think the issue was related to camunda passing back the xml object in json, and trying to have BPMN bind to the json, instead of the specific json object that contains the xml.
Can you share the response?
When you make a call to http://{YOURURL}/engine-rest/process-definition/{processDefinitionId}/xml it returns a json array of objects. This array contains an object called “bpmn20Xml”. This object contains the xml. If you only pass the results from the API call without specifying this object, you will get the error:
“required args <xml=string>”
I’m still not sure how to apply the state data to the XML, so that I can overlay the process step on top of the diagram, however.
Got it. The response json has two attributes. I think you can access the bpmnxml by querying the json itself.
Yeah, exactly. Once you have the data just select the xml object.
Correct. Extract the xml string from the json object and apply it
Do you know of any examples of how to apply the state data that shows what step the process is in?