jBPM as a remote service
The jBPM platform provides many remote APIs services. It provides developers with an improved level of flexibility in designing solutions that require jBPM integration. This remote APIs opens up a number of possibilities with a flexible, open architecture, in order to satisfy and to quickly react to changing application requirements.
JBPM work with the following remote service APIs –
The REST API
This API is used to manage tasks, process, create process instances, and other actions which require the use of a simple HTTP client library. It provides functionalities in the following areas –
RuntimeEngine – It provides the user with process instance creation, process instance querying, and workitem operations.
History – It provides with auditing data.
Task – It provides task operation and task query methods.
Deployment – It provides deployments management operations.
Authentication
jBPM provides authentication For the REST API. Upon invocation, the REST service operations check for the basic authentication user ID of your current HTTP session. If we are not authorized it will give an error, otherwise set user ID and password for authentication. This will return the following response-
The remote Java API
If we don’t want to manually create HTTP requests to access jBPM remotely, then we can use Java API. The Java API is a high-level API. It uses REST or JMS API to interact with the remote engine services to provide the user with service API classes such as TaskService, KieSession and so on. The entry point of Java API is the classRuntimeEngine, and we can access it by using the class RemoteRuntimeEngineFactory as given below.
Now, we have to access KieSession, TaskService and AuditService remote interfaces. These interfaces help to perform remote calls using pure Java code and manage HTTP connections with the remote jbpm server. The remote API must have the following maven dependency.
The SOAP API
SOAP stands for Simple Object Access Protocol. It is a messaging protocol which allows a program to run on different operating system to exchange information using HTTP protocol. It allows us client-server communication. In this API, Clients can initiate requests to servers then servers process that requests and return responses to the user.
Dependency-
The Maven Dependency for SOAP API are as follows-
Command Web Service
In this section, we will now describe how to call into jBPM by using its SOAP API. Our jbpm-remote-server test project, the SOAPTest jUnit test class, creates a web service client and then starts a new process instance.
JBoss BPM Suite provides a SOAP interface in the form of CommandWebService. A Java client is rovided as a generated CommandWebService class. Classes generated by the kie-remote-client module function as a client-side interface for SOAP. The CommandWebServiceClient class referenced in the test code below is generated by the Web Service Description Language (WSDL) in the kie-remote-clientJAR.