Using A Workflow Service To Orchestrate A Process


One of the key concepts within the New Wave Applications blueprint is that of Business Process Management (or BPM). The idea being that we can separate workflow out of our monolithic/silo based systems in order to build processes that span the entire organisation and make use of our library of web services to improve accuracy and efficiency.

We already have a BPM solution in the authority in the shape of the Singularity Process Platform and this has been used to construct the Free School Meals system using a BPM/SOA approach.

The point of this project is to use some form of workflow tool to create and run a process that makes use of at least 3 other, non-proprietary web services in order to complete a task. All of the elements making up the process must be de-coupled and not embedded into the workflow system.

For example:
• making a decision based on certain factors
• authorising a payment or request.
• Creating a document using various information sources


Details of where code, web pages etc can be found.

Unfortunately due to network restrictions and the complexities of the software used in the project it is only possible to view a simple demonstration of the work via a Virtual machine hosted on a one of the teams laptops. However, this report does contain screen shots and sample of code used.


Describe how you approached this piece of work, any technologies, tools or techniques that you found useful or tried and discarded. Include any examples that you used for inspiration and any contacts you have made in carrying out the work.

The original plan for this project was to identify suitable web service that could be integrated into a workflow package and then find a suitable workflow application to demonstrate the concept. I identifying web services that could be used was a simple process as there are many service to be found. E.g just have a look at the programmableweb web site. The main problem of the project was identifying a suitable workflow package. WCC currently makes use of such a package call ‘singularity’. However, it was perceived to be to involved to acquire, install, learn etc in a simple development environment. . e.g. a laptop.

It was decided to investigate other workflow systems which included the following :-

Microsoft BizTalk – This appeared to be a complex produce that required a windows server, SQL server and Share point. This product many have well met the requirements but, time it would have taken would have taken weeks.
Radicore – A Rapid Development Environment that provides a framework for developing web based applications and can be used to build activity based workflow systems. On first impressions this product looked promising. However, there did not appear to be any easy way to create/input workflows. Personally I would have liked some sort of GUI (Graphical User Interface) to aid the creation of the workflow.

Ez Components - A library of PHP components for using the enterprise which a workflow component. Again this product looked promising but, the installation looked complex and time consuming which was a risk to the project and along with this similar to the Radicore offering there was no simple way (for me) of creating a work flow.

ProcessMaker – This product took some finding but looked very promising, easy to install, a GUI for workflows, could make calls to web services and also be run as a web service itself.

It was decided to use ProcessMaker as the workflow packed as such it was installed under XAMPP running on a virtual machine. The install was fairly straightforward. The only complexity was setting it up a virtual server under apache as changes had to made to the httpd.conf configuration file to call an additional configuration file called pmos.comp.

pmos.comf – new apache configuration file

<VirtualHost >
ServerName "localhost"
# Location of ProcessMaker public index page
DocumentRoot C:\opt\processmaker\workflow\public_html
DirectoryIndex index.html index.php
<Directory "C:\opt\processmaker\workflow\public_html">
AddDefaultCharset UTF-8
AllowOverRide none
Options FollowSymlinks
Order allow,deny
Allow from all
RewriteEngine on
RewriteRule ^.*/(.*)$ sysGeneric.php [NC,L]

httpd.conf – addition line added to call the additional configuration file.

Include "C:\xampp\apache\conf\extra\pmos.conf"

In addition to this the php.ini file required the cURL library reference to be uncommented.
Php.ini – uncomment curl library.


Once completed the install process the product worked straightaway.


ProcessMaker Login Screen

Once logged in the is presented with a list of tasks that they are allowed to carryout. An normal user would just have access to cases where as the Admin account has access to a full range of activities including the management of processes.. Processes can be created, edited, imported and exported.

Leaning to use ProcessMaker was a fairly simple exercise thanks to the GUI. Tasks are dragged and dropped, sequenced, assigned to users and groups etc.


Sample workflow in ProcessMaker

Forms are designed by a forms designer which the user has access to a preview, XML, HTML, Field List and properties views. One point worth noting is that the Fields List has a bug that prevents the information from been displayed. The forms designer allows the placement of all the normal types of HTML furniture including sections of JavaScript. The full potential of this JavaScript has not been explored but it should be possible to achieve things like AJAX calls from the browser (It would nice to try this some time).


Form Designer Screen

The for designer also provide a mean to set any properties associated with items on the page e.g. name, behaviour, size, values and even connections to databases.


Form Designer Screen

One of the most important part of ProcessMaker in this project was to access web services, as mentioned earlier this could be access via AJAX on the web page but, the other way this can be achieved from the ProcessMaker server itself. Access to web services are achieved by using triggers, these can be assigned to process events in the workflow. The triggers themselves are basically PHP scripts with a small amount of pre-processing.

Below is a sample trigger script, as it can be seen the syntax is the same as PHP with the exception of the use of the double @ symbol (‘’). This denotes a global variable that is associated with a ProcessMaker process. Normally these are item on a ProcessMaker web page such as a text field. Have access such as this provides a means for the trigger script to access or assign values to items on ProcessMaker web page. The use of variables can also be used solely within different trigger scripts which provide a simple method of passing data between trigger events. The sample script below also contain a cURL call to a remote service passed via a proxy.

// url of the host
$twitterHost = "";
// Initiation of curl
$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
// Username and Password to access remote service
curl_setopt($ch, CURLOPT_USERPWD, "username:password");
// Instruct curl to use a proxy server
curl_setopt($ch, CURLOPT_PROXY, "");
// Define the type of call to be make to the remote service
curl_setopt($ch, CURLOPT_POST, 1);
// capture the contents of the message text box on the web page
$stat = @@message;
// complete the full path to the remote service
$twitterHost .= "statuses/update.xml?status=". urlencode(stripslashes(urldecode($stat)));
// pass the full path to curl
curl_setopt($ch, CURLOPT_URL, $twitterHost);
// Execute the call to the web service via curl
$result = curl_exec($ch);
// Capture the result of the call in a array
$resultArray = curl_getinfo($ch);
// Identify the return code and update the status text box with the result
if ($resultArray['http_code'] == 200) @@status = "Message sent";
else @@status = "Message failed";

ProcessMaker also provides a simple debugger that helps the developer monitor variables as a process proceeds.

Accessing web services from ProcessMaker is Easley achieved from triggers, catching data returned and acting on its contents are a little more difficult as they are returned in XML but there are many PHP libraries that are designed to handle XML it is not to much work to extract the data required. For this project a suitable XML parser was found at ‘’. Place the parser in the default ProcessMaker html directory and add an include line in any trigger that some XML functionality.

ProceessMaker is a good product but it does has some problems. Firstly the documentation could be better. My main cause for concern is problems updating list boxes and drop down menus. There is no information on how to active this from a trigger, something I think is quite important. Requests have been placed on the ProcessMakers forum. Many different coding approaches were made to try and update listboxes from triggers none of which succeeded. However, there many be away by using JavaScript to access the ProcessMaker variables (@@) and update the listbox via that route. It could work and it should be tried.
Having pretty much understood the working of ProcessMaker it was decided to produce the following process to demonstrate ProcessMaker’s capabilities to communicate with web services.

  • Passing a message to Twitter
  • Retrieve the contents of a notebook from Google
  • Retrieve current weather from a zip code, Country origin of IP address & weather from city and country.


Describe the degree to which the work was successful in addressing the project description. Include reasons why or why not.

Passing a Message to Twitter

Once a workflow to pass a message to Twitter was created within Processmaker all the user has to do to initialise a new case is to select the correct workflow process from a dropdown menu.


Starting a New Case

Once the new Twitter case is started the user is presented with a screen prompting the user to enter a message that is to be forwarded to Twitter.


Compose Twitter Message

Once the message is composed and sent Processmaker invokes a background script (PHP) that forwards the message to Twitter via Twitter API, the script also waits for a return code to indicate that the message has been accepted by Twitter. If the message has been accepted then the Processmaker form will display the text “Message Sent”, if the message failed then a “Message Failed” message will be displayed.


Twitter Message Sent Successfully

After a very short time the posted message will be displayed on twitter.


Twitter Message Sent Successfully

Retrieve the contents of a notebook from Google

This workflow demonstrates how a Google Notebook can be accessed via Processmaker. Google offers a facility where users can create Notebooks to hold simple textual notes. These Notebooks can be accessed via an API which can be used to list and access the content of these notebooks. The original idea of this workflow was to first al all get a list of available notebooks and then select one to have it’s contents displayed. However, a problem was soon found with Processmaker that there did not appear to be a method to dynamically populate listboxes and dropdown menus! Despite searching through numerous help pages, forums and posting a request for help there appears to be no way of updating listboxes and dropdown menus. This been the case then all this Google Notebook process could demonstrate is the retrieval of the contents of a fixed named notebook.

To start this case then the “Google Docs” process is selected. Once selected the workflow process prompts the user to retrieve the document from Google.


Prompt to get Google Notebook

Once activated the next task to retrieve the document is placed in the workflow queue.


Processmaker Workflow Queue

When the user opens the task from the Processmasker queue the contents of the Google notebook will be accessed via the Google API and displayed of the Processmaker screen.


Google Notebook Contents

Retrieve current weather from a zip code, Country origin of IP address & weather from city and country.

This example shows a web service can retrieve the current weather from a zip code or a city and country. It also demonstrates finding the country of origin for a given IP address.

As in the previous examples the user selects the relevant workflow to initialise a new case. Once initialised the user will be prompted for a zip code (try 20006).


Entering a Zip Code (20006)

Once to Zip Code is entered the workflow will call a script (PHP) to access a web service that will return the temperature for the supplied Zip Code. Unlike the Google Notebook API which uses a simple HTTP get to retrieve information, the weather web service requires the use of SOAP. As the scripting language used by Processmaker is PHP which includes within its distribution a SOAP library it is a very simple exercise to integrate this type of web service into the application.


The Temperature at the Whitehouse USA

The next task in the process prompts the user to enter an IP Address. This time a web service will be accessed to find the IP Addresses country of origin.


Enter IP address ( the BBC)

Once again a script is invoked that this time returns the country of origin for the given IP Address.


IP Address Origin

Finally the last part of the demonstration is the weather for a named city. Unfortunately there was a couple of problems with accessing this web service. The first that there appears to be only a limited number of cities and counties that will actually produce a result., hence the example of Boryspil in the Ukraine. Secondly problems were encountered with translating the XML returned from the web service.


Entering City and Country (Boryspil & Ukraine)

Once entered a full weather report will be displayed. Due to problems processing the XML returned it was only possible to display the actual XML.. With a little more work fixing the translation issue then it should be straight forward to display the weather in a more readable form.


The Weather in XML

Sample PHP to access web service via a proxy using SOAP

Below is some sample code that shows how a web service that communicates via SOAP can be accesses via a proxy server.

define ( 'WSDL_URL_IP', '' );
$endpoint = WSDL_URL_IP;
$sessionId = '';
$client = new SoapClient( $endpoint , array('proxy_host' => "",'proxy_port' => 8080));
$params = array('IPAddress'=> "" );
$result = $client->__SoapCall('GetGeoIP', array($params) );
@@COUNTRY= $result->GetGeoIPResult->CountryName;


What immediate impact could the output of this R&D work have on the organisation – could it provide benefits without compromising our strategic approach?

This project demonstrates that implementing an workflow system that handles a variety of web services can be achieved very quickly. Added to this was the fact take all the software used was open source and free to use. The only costs involved would be the hardware required run ProcessMaker in an Apache environment.

Another benefit to arise from this project was how to manage SOAP calls through a proxy server.


How the work carried out fits with our strategic direction or how it should contribute to our strategic thinking.

ProcessMaker has the potential to be a good product despite the problems with listboxes. What this project highlights is the need for a product to be flexible and easy to customise. The potential to place AJAX calls on the its web pages combined with the trigger scripting capabilities makes the produce very versatile..
‘Singularity’ has been used within the council and only recently Singularity have introduced access to web services. It would be interesting to compare the flexibility between the two systems when it comes to accessing web services and the skills required to maximise there use. With Singularity I cannot say for sure but any customisation required to access web services from ProcessMaker would require a lower level programming skills in the case of Singularity, more than likely C# with Singularity where as ProcessMaker uses PHP a simple language that can learnt very quickly. This and that fact take PHP code can be written and tested very quickly would give an environment where changes and new servers could be implemented with very short lead times.


How to update Listboxes and Dropdown menus with ProcessMaker

After much persistence a way to update listboxes and dropdown menus has been found. It is not the most elegant piece of software but it works.

To achieve this a hidden variable needs to be created on one of the ProcessMaker pages. This variable can then be assigned a value from a trigger.

data01= "0|document 1"; data01 .= |1|document 2;
data01 .= |2|document 3; data01 .= |2|document 4;

This section of script will update the hidden variable on the web page.

On the web page itself a small peace of JavaScript then needs to be added. This will take the contents of the hidden variable and split it into an array using the ‘|’ symbol. The resultant array can then be used to dynamically populate dropdown menus or list boxes.

<data01 type="hidden" defaultvalue="33333" mode="edit"></data01>
<js02 type="javascript"><![CDATA[
var data = getField('data01').value;
var result = data.split('|');
for ( var i = 0 ; i < result.length ; i = i + 2){
var option = document.createElement("option");
option.text = result[i+1];
option.value = i;
for ( var i = 0 ; i < result.length ; i = i + 2){
var option = document.createElement("option");
option.text = result[i+1];
option.value = 0;

This is only a very simple example but the same principle can be supplied to all sort of dynamic data including data returned from web services.

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License