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.