Can a web service start a workflow?

Developers have been looking for additional guidance and support on initiating Adobe LiveCycle Workflow processes from a web service. They are interested in understanding how kicking off a workflow is accomplished using web services or ultimately how processes are initiated using third-party apps.

Chris Trubiani, who is one of our developer support engineers for the Adobe Enterprise Developer Program walked me through this, and I think it is worth sharing.

To initiate a workflow from a third party app, you would typically use a web service call. You wouldn’t use the LiveCycle WorkFlow API for that as the API needs to be used from within the context of the Workflow engine and your app would not be running in that context.

It is not possible to provide meaningful sample code for something like this since the code is ideally generated by some third party tool, and is unique since it is based on your wsdl. But I’m going to tackle the points involved and hopefully that will get you off to a good start with understanding the procedure.

The first thing is to create a process and deploy a workflow in it. When you create the workflow make sure to check the “Web Service Access” box so that the workflow will be available as a web service.

Once the workflow is deployed the wsdl will be available at the URL: http://ServerName:Port/services/ProcessName?wsdl

– ServerName is the name of the server that LCWF is hosted on.
– Port is the port that JBoss is listening to (usually 8080).
– ProcessName is the name of the process you created and deployed the workflow in.

In your code you would create some proxy code that allows you to access the web service. Your IDE of choice should have a tool that will generate this automatically for you when you pass it the URL to the wsdl.

For example, in WebSphere if you create a Web Service Client and give it the URL to the WSDL, it will automatically generate the necessary proxy code. Using this you can access the web service by calling the methods in the proxy code.

There are four methods exposed by the web service:

– invoke()
– synchronousInvoke()
– getResult(long)
– getStatus(long)

These are fairly self-explanatory names but you can find a description of what these methods do in the javadocs that come with the Workflow SDK in the com.adobe.workflow.manager.ProcessManager class.

There are lots of ways to kick off a workflow with human interaction, like the actual submission of a form, but this is very useful when doing integration using a workflow that is outside of the core application.

2 Responses to Can a web service start a workflow?

  1. Alessio Giorgini says:

    Very Useful article!

  2. Alessio Giorgini says:

    Hi Ben,My problem is this: I would like to start a workflow from a webservice.Now, I created a workflow by using the option “WebService Access” and setting some “in” variables (string type). Some of this “in” variables are required.Now, I expect that if I don’t fill the mandatory field in my client application (a generic SOAP Client), the workflow would not start and report me a error message.But, on the contrary, the workflow starts and it sends me the ID of the process.So, here are the questions:1) Is it possible to make server validations on the data, especially that related to mandatory fields?2) Is it possible to customize the response of the web service created into Workflow?I’m using Adobe LiveCycle Forms, Form Manager and Workflow 7.0 in Windows Server 2003 Enterprise Edition, with MySQL and JBoss (turnkey installation).This is a little example of the variables i’m using when exported as XML1001001002510010