VMware {code} Community
karen6i
Contributor
Contributor

How to get the error message of workflow run

Hi,

I have created a web service client using C# and trying to excute workflow via SOAP.

If the workflow that I  run failed in the orchestrator, how can I get the error message of the workflow run via SOAP?

0 Kudos
2 Replies
sanchezs
VMware Employee
VMware Employee

Hi,

You should be able to use the WorkflowToken object and its xmlContent attribute.

http://pubs.vmware.com/vsphere-50/topic/com.vmware.vsphere.vco_develop_web_services.doc_42/GUIDDF70B...

Here you are a piece of Java code that you could adapt to your C# client:

Workflow wf = ...

WorkflowToken token = vsoWebControl.executeWorkflow(wf.getId(), username, password, null);

System.out.println(token.getGlobalState()); // probably "running"


while ("running".equals(token.getGlobalState())) {

    System.out.println("waiting for workflow to finish...");

    Thread.sleep(500, 0); // wait for half a second

    token = vsoWebControl.getWorkflowTokenForId(token.getId(), username, password);

}

System.out.println(token.getGlobalState()); // "failed" if there is an exception


String content = token.getXmlContent();

System.out.println("content = " + content); // exception message should be there

I hope it helps.

Regards,

Sergio

karen6i
Contributor
Contributor

Thanks for help!

I try it out and it works.

Regards,

Karen

0 Kudos