User Guide
  • Introduction
  • Overview
    • About 4WS.Platform
      • Architecture
      • Enterprise Edition
      • Tech specs and requirements
      • Warp SDK
    • Creating a web application
  • Core features
    • Tables
    • SqlTool
    • Definition of Data models and Relations
      • Relations
      • Reverse Engineering
      • Custom Fields
    • Defining business components
      • What are business components
      • Business components to fill-in panels
      • Creating business components
        • By a datastore entity
        • By a MongoDB collection
      • Defining Custom Java Business component
    • Defining the UI
      • App Designer
        • App Designer Menu
        • Definition of additional data sources
        • Panel containers and layouts
          • Tab panel
          • Alternative panel
          • Accordion panel
          • Vertical orientation panel
          • Horizontal orientation panel
          • Columns panel
          • Table panel
          • Generic panel
          • Responsive panel
        • Window content
          • Grid Panel
          • Form Panel
          • Filter Panel
          • Tree Panel
          • Google Map Panel
          • Preview Panel (old Image panel)
          • Tree + Grid Panel
          • Image Gallery
        • Windows list
        • Panel definition
          • Columns properties
          • Controls properties
          • Filter properties
          • Supported components
        • Variables
        • Code selectors
          • When not to use a dynamic combo-box
        • Smart Filter and Advanced Filter
        • Multi Value Combobox Filter
        • Multi Value Tree Filter
        • Buttons
        • Translations
          • Translations about GUI components and internationalization settings
          • Data coming from database
          • Custom code and translations
        • Application Menu
        • Bulk import binded to a grid
        • Range Date Filter
      • Web Interpreter
        • Grid components
        • Detail forms
        • Other components
        • Other features
          • Chat
        • Global variables
          • Client-side global variables
          • Server global variables
        • Forgot Password
    • Working with users and roles
      • Rule for roles
      • Permissions Administrator
    • Wizard
      • How to add a checkbox grid to select one or more rows
      • How to load a second grid when clicking on a row from the first grid
      • How to load a form when clicking on a row of the grid
      • How to open a window when double clicking on a row of the grid
      • How to open a window with right click on the popup menu
      • How to open a window when pressing a button on the grid toolbar
      • How to load a grid after loading a form
      • How to open a window when pressing a button on the form toolbar
      • How to load a grid when clicking on a tree node
      • How to load a form when clicking on a tree node
    • Defining events
      • Panel events
      • Column events
      • Control events
      • Filter events
      • Timer events
      • Start-End event
    • Server-side Javascript & Web Service
      • Server-side Javascript
      • Grid component filled by a server-side JS
      • Detail component filled by a server-side JS
      • How to define a server-side JavaScript action
      • Web service
  • Setting up the environment
    • How to install
    • Application parameters
    • Global parameters
  • Modules
    • Reports & Charts
      • Jasper Report + iReport
      • Online report
      • Docx templating
      • Charts
      • Pivot Grid
      • Multidimensional pivot grid
      • Data Export from SQL query
    • SSO
      • Identity management in Platform
        • Identity management on the internal Platform database
        • Identity management based on Google SSO
      • LDAP
        • LDAP support
        • Identity management based on LDAP and database
        • Identity management based on an embedded LDAP server used by Alfresco and or Activiti
        • Identity management based on a remote LDAP server to connect to Platform on the cloud
        • Connecting an LDAP server to Activiti BPM
        • Connecting an LDAP server to Alfresco ECM
      • Google SSO
        • Google SSO
        • Google OAuth2
        • Identity management based on Google SSO
      • Custom SSO
      • Firebase
    • Mobile
      • Mobile introduction
      • Offline vs Online
        • Server side features
        • Server side functionalities
        • Server side Platform features
        • Mobile app features
      • Mobile side specifics
        • Customizations
          • Custom theme editor
        • App Menu
        • Window content
          • Detail scrollable form
          • Scrollable paginated grid
          • Constraint layout
          • Constraint panel
          • Collection grid view
          • Preview panel (mobile)
        • Form Controls
      • Reference guide
      • Cleaning up data
      • How to
      • App deployment
        • App deployment for the iOS platform
        • App deployment for the Android platform
      • Style properties
      • Appendix : Synchronization flow
      • Translations
    • GSuite
      • Introduction
      • Client-side integration
      • GMail
      • Calendar
      • Drive
      • Contacts
    • Google Cloud Platform
      • Datastore
        • Google Datastore Introduction
        • How to create Datastore entities
      • Google Cloud Storage
    • Scheduler
      • Scheduler Introduction
      • Process settings
        • How to define a sequence of consecutive processes
        • How to define a Custom Java Business component
        • How to define a Grid Data Import
        • How to define a server-side Javascript action
      • Email notifications
      • Process executions
      • Manually start a scheduled process
      • Process input parameters
    • Queue Manager
    • Log & Analysis
      • Application Log
      • Log statistics
      • App analyzer
      • Table log
      • Threads
      • Sessions and heap memory
      • Heap memory analysis
      • Access Log
      • Datastore statistics
      • Total monthly costs with Google Datastore
      • Service Monitoring
        • Introduction
        • Defining a service to monitor
        • Notifications setup
        • Events automatically managed by Platform
        • Remote Platform servers
        • Knowledge base
        • Adding log programatically
        • Searching for logged data
        • Use cases
    • File Management
    • Export and Import of Metadata
      • Application Metadata Management
    • Trigger writing operations
    • Audit
    • BPM
      • BPMN Introduction
      • BPMN main parts
      • Activiti Setup
      • Platform integration
        • Processes
        • Models
        • Process instances
        • To-do list
        • Process history
      • Process Web Modeler
        • Model Creation
          • Start-End Event
          • Gateways
        • Supported objects
        • Start tasks and user tasks
        • Form properties
          • Important notes
          • Property types
        • Service tasks
          • Web service
          • SQL Query
          • SQL statement
        • Mail task
        • Script task
          • Example : how to get a value previously read from a SQL query
          • Example : how to get the current process instance id
        • Timer events
        • Subprocess and Call Activiti
      • Utility methods available in Platform
        • How to start a process from a JavaScript action
        • How to complete a user task from a JavaScript action
      • An example
        • Processes
        • Instances
        • Activities
        • History
    • Embedded CMS
    • ECM
      • Alfresco
        • Alfresco Introduction
        • Integration between 4WS.Platform and Alfresco
          • Integration at GUI level
          • Integration at model level
          • Integration at authentication and authorizations level
          • Additional features
        • How to use 4WS.Platform and Alfresco together
          • Set the same Identity Management system
          • Define document types and aspects in Alfresco
          • Import the document types and aspects definitions in 4WS.Platform
          • Define document types and aspects in 4WS.Platform
          • Reverse engineering of document types or aspects
          • Definition of business components to fill-in panels
          • Definition of the GUI
          • Additional server-side services
        • Requirements
        • Current limits in 4WS.Platform - Alfresco integration
      • Archiflow
        • Setup
        • Archiflow artifacts
        • How to
    • Lotus Notes Migration Tool
    • NoSQL databases
      • MongoDB
        • MongoDB Introduction
        • Setting up the environment
        • How to create collections
        • How to create business components
        • How to create windows filled with data coming from MongoDB collections
        • Design rules
      • Google Datastore
        • Google Datastore Introduction
        • Setting up the environment
        • How to create entities
        • How to create business components
        • How to create windows filled with data coming from Datastore entities
        • Design rules
    • TensorFlow
    • Web Page Development
      • Pure Web Page Development
      • Google Material Design development
      • Appendix A - a complete example without any lib
      • Appendix B - a complete example with Google MD
    • Jira Integration
    • Platform for GAE
    • SQL errors management
    • Multidimensional pivot grid
    • Quality
      • Automated Web Service Testing
      • Automated unit testing
      • Source code static analysis using ESlint
      • Source code static analysis using SonarQube
  • Troubleshootings
  • Best practises
    • Database design
    • Database maintenance
    • Creating a Web app : common use cases
    • Creating a mobile app : common use cases
Powered by GitBook
On this page

Was this helpful?

  1. Modules
  2. BPM
  3. Process Web Modeler
  4. Service tasks

Web service

PreviousService tasksNextSQL Query

Last updated 3 years ago

Was this helpful?

A service task can act as a web service caller by setting the folllowing task properties in this way: Id and Name: they identity the task and they are mandatory; be sure NOT to include accent characters in these fields (only alphanumeric characters are allowed).

  • Documentation: an optional description of this task

  • Class: it.sinesy.activiti.services.ExecuteComponentServiceTask

You can simply select the corresponding value from the combobox: "Platform Web Service":

  • Class fields: in this list of fields, a set of properties must be defined, in order to correctly define the web service invocation:

    • name: property name to refer

    • string value: value to assign to that property

    • expression: optional expression to set, e.g. ${VARIABLE == ’Test’ ? YES : ’NO’}

You can simple define the following name-value properties:

A typical web service invocation available within 4WS.Platform would contain the following couples name-value, as in the picture above:

  • name = applicationId

  • string value =

  • name = companyId

  • string value =

  • name = url

  • string value = &param2=val2

Important note: do not add the full URL, including "http://..." because you would create a workflow working only on the environment. In order to make it working in any environment, define exclusively related URLs, i.e. URL starting with the web service name (e.g. executeJs, getlist, etc.)

Important note: pay attention to the URL definition: the Activiti workflow editor does not allow you to write the & symbol: if you do it, it is likely that the Service Task properties will not be opened any more; for each & to include in the URL definition, use

&

Note that no credentials are required in this kind of communication, since the utility class referred is automatically able to authenticate in 4WS.Platform, starting from the user currently associated to the Activiti process, since both products share the same identity management system (users and roles).

Optional parameters:

name = requestBody string value = { "attr": value, … }

name = httpMethod string value = GET | POST | …

name = username string value =

name = fireError string value = Y

In case your service activity requires a feedback, you have also to:

  • define a 4th parameter in Class Fields, named "return" and filled in with the process property name hosting the feedback

  • use the utils.setReturnValue(...) instruction on the js server-side action to provide such a feedback

A few constraints must be respected:

  • the feedback MUST always be expressed as a JSON string

  • if you need to work with attributes coming from the JSON string, you'd better postpone a Script activity to the Service activity, in order to extract the JSON attributes and set each of them as a process property.

Example:

The Service activity has a Class Field property named "return", filled with "RESPONSE", i.e. "RESPONSE" would be the javascript object hosting the response coming from thr js server-side action, which would give back a JSON string.

The js server-side action MUST give back something like:

var response = {
    outcome: outcome
};
utils.setReturnValue(JSON.stringify(response));

The Script activity must be defined as:

  • Script format: "JavaScript"

  • Script:

execution.setVariable("OUTCOME", execution.getVariable("RESPONSE").outcome);

In this way, the JSON string coming from the js server-side action would be converted internally in a js object and the instruction above will extract the attribute "outcome" from the "RESPONSE" js object and store the attribute value to the "OUTCOME" process property.

Any other part of the workflow will be then able to access to the OUTCOME process property.

Note: it is possible that such variables are not reported in the Instance process execution or History screens.

Example

value of "url" class property within a web service Service Task:

executeJs?applicationId=XXX&appId=XXX&actionId=xxx&userId=:ADMIN

Important note Do NOT use the notation ${VARNAME} in the definition of a web service: you have to use the notation :VARNAME instead.

A more detailed example related to the invocation of the executeJs service available in Platform is: ClassFields url = httpMethod = POST companyId = XXXXX applicationId = XXX

Important note In order to make more portable a process, the defined tasks should not contain references to a specific environment, such as an host or port when invoking URLs in web services. This goal can be reached by omitting the whole URL and use a relative URL instead. This simplification can be done only if the first fixed part of any URL () has been defined as an installation parameter in Activiti-Rest db.properties file, where the "baseUrl" property must be set with that value. In this way, every installation would have its own ad hoc absolute path and all processes would remain portable, since they would not contain any more absolute URLs.

… baseUrl= …

executeJs?applicationId=XXX&appId=XXX&actionId=xxx&userId=ADMIN
http://host:port/webcontextofPlatform
http://localhost:8180/platform/
getList?param1=val1