Workflow workflow = (Workflow) workflowObject;
RequestAndStatusHandler handler = workflow.getRequestAndStatusHandler();
DocumentRequestBuilder builder = new DocumentRequestBuilder();
try {
handler.buildRequest(builder);
} catch (ActivityIllegalStateException e) {
LOG.error("Exception in converting the workflow to XML", e);
e.printStackTrace();
}
String workflowXML = builder.getXML();