VMware Cloud Community
DeepakPN
Contributor
Contributor
Jump to solution

Get workflow parameter value before workflow execution completes from SOAP client

I am calling Orchestrator's  SOAP webservices from my application to execute a workflow.I want to get a parameter/attribute value before the workflow execution stops.

Brief :

I have a workflow XYZ which adds two numbers supplied by my application.After this my workflow perform some other functionality which takes say 5 minutes.

My application wants the addition result as soon as addition is done. I do not want to wait for those 5 minutes to complete after which my worlkflow execution is over and then get the result.

0 Kudos
1 Solution

Accepted Solutions
Burke-
VMware Employee
VMware Employee
Jump to solution

Hello DeepakPN - first off, if you're using vCO 5.x we highly recommend using the REST api instead of the old SOAP api.

Now, to answer your question:

When you execute a workflow, the soap body returned to you includes a workflow return id - this is your workflow token id - essentially the instance of your workflow execution. It looks a little like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <executeWorkflowResponse xmlns="http://webservice.vso.dunes.ch">

         <executeWorkflowReturn>

            <id>ff80808141e74b090141f05c5d2c00f7</id>

There are several additional lines of detail below that, but I left it out as the important piece of info here is that <id> tag. The value contained within it should be used with the "getWorkflowTokenForId" operation. By providing that ID and your credentials, the resulting SOAP body will contain the details of your execution at the time of your query. So, if you have your sum stored as an attribute by the time you run the query, you will see it in the results. For my simple test, here is my "getWorkflowTokenForId" operation for a test flow I ran via SOAP:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <getWorkflowTokenForIdResponse xmlns="http://webservice.vso.dunes.ch">

         <getWorkflowTokenForIdReturn>

            <id>ff80808141e74b090141f05c5d2c00f7</id>

            <title>Any Test</title>

            <workflowId>1a568e2e-5c15-4b68-9bab-20cb955f0004</workflowId>

            <currentItemName>item0</currentItemName>

            <currentItemState>completed</currentItemState>

            <globalState>completed</globalState>

            <businessState xsi:nil="true"/>

            <startDate>20131025120447-0400</startDate>

            <endDate>20131025120447-0400</endDate>

            <xmlContent><![CDATA[<token>

<atts>

<stack>

<att n='inputTypeName' t='string' e='n' s='l'><![CDATA[string]]]]>><![CDATA[</att>

<att n='anyInput' t='Any' e='n' s='l'><![CDATA[Hello World]]]]>><![CDATA[</att>

</stack>

</atts>

<exception encoded='n' ></exception>

<transitionType value='normal' /></token>]]></xmlContent>

         </getWorkflowTokenForIdReturn>

      </getWorkflowTokenForIdResponse>

   </soapenv:Body>

</soapenv:Envelope>

Inside the <atts> tag there is a <stack> tag that contains each of my inputs/attributes. In the code above, "anyInput" was the input parameter to my workflow and "inputTypeName" was an attribute.

Hope this helps Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter

View solution in original post

0 Kudos
1 Reply
Burke-
VMware Employee
VMware Employee
Jump to solution

Hello DeepakPN - first off, if you're using vCO 5.x we highly recommend using the REST api instead of the old SOAP api.

Now, to answer your question:

When you execute a workflow, the soap body returned to you includes a workflow return id - this is your workflow token id - essentially the instance of your workflow execution. It looks a little like this:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <executeWorkflowResponse xmlns="http://webservice.vso.dunes.ch">

         <executeWorkflowReturn>

            <id>ff80808141e74b090141f05c5d2c00f7</id>

There are several additional lines of detail below that, but I left it out as the important piece of info here is that <id> tag. The value contained within it should be used with the "getWorkflowTokenForId" operation. By providing that ID and your credentials, the resulting SOAP body will contain the details of your execution at the time of your query. So, if you have your sum stored as an attribute by the time you run the query, you will see it in the results. For my simple test, here is my "getWorkflowTokenForId" operation for a test flow I ran via SOAP:

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

   <soapenv:Body>

      <getWorkflowTokenForIdResponse xmlns="http://webservice.vso.dunes.ch">

         <getWorkflowTokenForIdReturn>

            <id>ff80808141e74b090141f05c5d2c00f7</id>

            <title>Any Test</title>

            <workflowId>1a568e2e-5c15-4b68-9bab-20cb955f0004</workflowId>

            <currentItemName>item0</currentItemName>

            <currentItemState>completed</currentItemState>

            <globalState>completed</globalState>

            <businessState xsi:nil="true"/>

            <startDate>20131025120447-0400</startDate>

            <endDate>20131025120447-0400</endDate>

            <xmlContent><![CDATA[<token>

<atts>

<stack>

<att n='inputTypeName' t='string' e='n' s='l'><![CDATA[string]]]]>><![CDATA[</att>

<att n='anyInput' t='Any' e='n' s='l'><![CDATA[Hello World]]]]>><![CDATA[</att>

</stack>

</atts>

<exception encoded='n' ></exception>

<transitionType value='normal' /></token>]]></xmlContent>

         </getWorkflowTokenForIdReturn>

      </getWorkflowTokenForIdResponse>

   </soapenv:Body>

</soapenv:Envelope>

Inside the <atts> tag there is a <stack> tag that contains each of my inputs/attributes. In the code above, "anyInput" was the input parameter to my workflow and "inputTypeName" was an attribute.

Hope this helps Smiley Happy

If my answer resolved or helped you, please mark it as Correct or Helpful to award points. Thank you!

Visit http://www.vcoteam.info & http://blogs.vmware.com/orchestrator
for vRealize Orchestrator tips and tutorials - @TechnicalValues on Twitter
0 Kudos