Hi! I've been in about a 12-hr rabbit hole and just can't figure how to do a couple of things.
Does anyone know how to do any of the following?
1. Pass input parameters via REST API?
2. Receive output parameters via REST or Workflow Web Service?
Hi! I've been in about a 12-hr rabbit hole and just can't figure how to do a couple of things.
Does anyone know how to do any of the following?
1. Pass input parameters via REST API?
2. Receive output parameters via REST or Workflow Web Service?
Adding to this old thread for searchability. I made a post here that describes the Workflow Web Service REST API endpoint, how to access the local API documentation, and with an attached working example of two workflows you can import to your own system and test out:
Hi Rich! Here is the code you can use to Create an instance of a workflow named "Workflow 1" with 2 input parameters (for Workflow Web Service version 9.2):
using (WorkflowAPIBaseClient workflowService = new WorkflowAPIBaseClient()) { InstanceCreationData instanceData = new InstanceCreationData(); instanceData.ParameterCollection = new InstanceParameterCollection(); InstanceParameterData paramData1 = new InstanceParameterData(); paramData1.Name = "TestIn1"; paramData1.Value = "xyz"; instanceData.ParameterCollection.Add(paramData1); InstanceParameterData paramData2 = new InstanceParameterData(); paramData2.Name = "TestIn2"; paramData2.Value = "987"; instanceData.ParameterCollection.Add(paramData2); InstanceCreationResultData result = workflowService.CreateWorkflowInstance("Workflow 1", instanceData); }
Note that "result" does not hold the actual result of the workflow, but rather information about the workflow instance you created (such as the instance ID). This makes sense, since the call only starts an instance, and does not wait for it to finish.
At the moment, you cannot use the Workflow Web Service itself to acquire the results of the completed workflow (such as the output params). If you know when your Workflow is done, you can still use the good-ole Workflow SDK (WFSO) to get your Workflow instances though, and then maybe make a callback to the calling service with that. There are other ways of doing this kind of thing too, though the Workflow Web Service itself does not support the functionality, as it's mostly there to create instances of Workflows.
I could add to this. We have a mechanism that Workflow uses to provide a post-completion callback after an instance completes. This is used internally (for example, by the Workflow->Forms integration). As a note, this mechanism might seem a tad bit complicated and, while it is supported, it's not officially supported and thus it's not documented (but I was asked to share it anyways =)).
After a Workflow completes, it can make a callback to a WebService of your choice, established by using the following 3 "hidden" input parameters:
I'm writing a web service using the "hidden" parameters specified above. I'm not able to get the $SyncData to come back. I don't see it as a header value and the body is being populated with the XML for the output parameters as you had mentioned. Can you please let me know how to get the $SyncData returned in the callback URL?
Thank you
Hey Flavio!!
Again - another great and well-informed post. Would you mind showing/sharing additional details related to the above with "$Sync--"? Or possibly throwing up an image or two within the workflow to demonstrate it, just like you did for the Google API one por favor?
interesting topic here ... I manage to "read" portion of code that setting the callback URL, code snippets like:
if (!string.IsNullOrEmpty(submissionData.CallbackURL) && Uri.TryCreate(submissionData.CallbackURL, UriKind.Absolute, out result))
{
instanceParameters.Add(new InstanceParameter("$SycnMethod", "WebService"));
instanceParameters.Add(new InstanceParameter("$SyncWebAddress", result.ToString()));
instanceParameters.Add(new InstanceParameter("$SyncData", string.Empty));
}
However, need to know where this callback being called in which class.
Any idea?
If you're going the other direction (i.e. from Workflow to your web service), you'll want to take a look at the web service activities in Workflow: HTTP Form Post and HTTP Web Request.
Hey there,
Do you mean via a .Net solution,, another workflow or a URL in a web browser?
-Ben
Thanks for your input, guys!
I ended up having my workflow posting back to an MVC controller that wrote the results to MSMQ, which the initiating call would monitor after calling the Workflow Web Service.