logo

Example of integrating ELMA with an external system (ELMA web service, SOA Connector)

A web service allows you to start process instances in ELMA from other applications. In this article, we give an example of the "Process Order" process, which is started when an order is made on a website. 

Here is the graphic model of the process:


  

Process context:


  
To make it possible to start the process form an external system, do the following:
     
  • select the "From external system" option. If you check the "Manually" option, the users with corresponding access permissions will be able to start the process from ELMA web application.
  •     
  • generate a process token or enter it manually 
  •     
  • check the "Web Service" box 

  

The order form on the website looks like this (the code for the form is attached to the article):


  

When "Send" is clicked, a php script is executed, sending a SOAP request:  

<?php
$userName = "admin"; //username of the user who will start the process
$password =""; //password of the user who will start the process
$token = "6e8e72fb-0178-4d8c-a84d-d354debe4de9"; //process token
$instanceName = $_POST[’company’]; //process instance name
$data = new stdClass();
$data->Items = new stdClass();
$data->Items->WebDataItem = array(); // Forming an array of context variables.
$data->Items->WebDataItem[0] = array("Name"=>"CompanyName", "Value"=>$_POST[’company’]);
$data->Items->WebDataItem[1] = array("Name"=>"FullNameofCompanyRepresentant", "Value"=>$_POST[’name’]);
$data->Items->WebDataItem[2] = array("Name"=>"SoftwareVersion", "Value"=>$_POST[’version’]);
$data->Items->WebDataItem[3] = array("Name"=>"NumberofLicenses", "Value"=>$_POST[’licence’]);
$data->Items->WebDataItem[4] = array("Name"=>"RepresentantsPhoneNumber", "Value"=>$_POST[’phone’]);
$data->Items->WebDataItem[5] = array("Name"=>"Address", "Value"=>$_POST[’address’]);
 
// Array of paramters required to start the process
$parameters = array(
                    "userName"=>$userName,
                    "password"=>$password,
                    "token"=>$token,
                    "instanceName"=>$instanceName,
                    "data"=>$data);
 
if($_POST[’Run_Workflow’])
{
// Creatin SOAP client with WSDL
$client = new SoapClient("URL?WSDL", array("location"=>"URL"));
//Call Run method to start process instance
$client->Run($parameters);
echo "Thank you for your order! We will contact you in a few minutes.";
}
?>

 

The script receives the values from the order form, sends the URL of the WSDL document to the SoapClient class constructor, and receives the object for working with the required web service. In ELMA the WSDL document is stored at http://<system's URL>/Modules/EleWise.ELMA.Workflow.Processes.Web/WFPWebService.asmx?WSDL (<system's URL> must be replaced with the URL of your system). Then call the method of the object that has the same name as the method of the web service, and pass the value parameters. The Run method is used to start the process.

As a result, when a customer fills out an order form, the "Process Order" process starts in ELMA.

Attachments