← Back to list

Invoking a REST Service in IBM BAW Through an External Service Flow (Version 20.0.0.1 or earlier)

IBM Business Automation Workflow (BAW) Process Center offers comprehensive capabilities to create External Service Flows that facilitate…

P8 Hub🍁 · 2025-01-15 16:35 · 0 claps · 2.5 min read
#ibm #baw #filenet #rest-api #integration
Open on Medium ↗

Invoking a REST Service in IBM BAW Through an External Service Flow (Version 20.0.0.1 or earlier)

IBM Business Automation Workflow (BAW) Process Center offers comprehensive capabilities to create External Service Flows that facilitate integration with REST and SOAP services. These integrations are critical for enabling communication between BAW and third-party applications, whether for retrieving data, sending information, or executing external operations.

There are two types of implementations: one is a REST service using a local file, and the other is a REST service using a URL. In this case, I am using the first option (REST service from a local file). We need a Swagger file to describe the REST API, which can be written in either JSON or YAML syntax.

Below is the content of the p8hub.yml file used in this example.

basePath: /Resources/1.0
paths:
  /GetParameterInformation:
    get:
      summary: Get System Parameters
      description: Get System Parameters
      parameters:
      - name: api_key
        in: header
        type: string
        description: Parameter which holds the key that needs to be verified.
        required: true
      - name: Category
        in: query
        type: string
        description: Parameter Category
        required: true
      - name: SubCategory
        in: query
        type: string
        description: Parameter Sub Category
        required: false
      - name: FieldKey 
        in: query
        type: string
        description: Field Key
        required: false
      - name: FieldValue
        in: query
        type: string
        description: Field Value
        required: false
      responses:
        '200':
          description: Successful response
          schema:
            type: string
host: dev.apigateway1.p8hub.ad:2260
schemes:
- https
swagger: '2.0'
info:
  version: '1.0'
  title: Parameter_Information

New external service wizard

New external service wizard

After creating an external service, you can use it in any service flow. You can add a Service Task or a Server Script to execute the service. I prefer using a Server Script as it provides more flexibility to manipulate the response.

Service Flow

Service Flow

var request = new BPMRESTRequest();
request.externalServiceName = "Parameter_Information";
request.operationName = "/GetParameterInformation GET";
request.httpMethod = "GET";

request.parameters = {
    "Category": "BRNCH"
};
request.endpointAddress = tw.env.webApiEndpoint + "/Resources/1.0";
request.httpHeaders = {
    "Content-Type": "application/json",
    "Accept": "application/json",
    "api_key": tw.env.paramInfoApiKey
};
request.requestTimeout = parseInt(tw.env.webApiRequestTimeout);
request.responseTimeout = parseInt(tw.env.webApiResponseTimeout);

var response = tw.system.invokeREST(request);
log.info("Response - httpStatusCode: " + response.httpStatusCode);
log.info("Response - httpStatusMessage: " + response.httpStatusMessage);

tw.local.content = response.content;
var jsonObj = JSON.parse(response.content);
tw.local.code = response.httpStatusCode;
tw.local.message = response.httpStatusMessage;

if (response.httpStatusCode == 200) {
    var branchList = jsonObj.ParameterInformation_Response.Branch;
    if (branchList != null) {
        tw.local.results = new tw.object.listOf.toolkit.TWSYS.NameValuePair();

        for (var i = 0; i < branchList.length; i++) {
            var nameValuePair = {};
            nameValuePair.name = branchList[i].Mnemonic.trim();
            nameValuePair.value = branchList[i].Name.trim();
            tw.local.results[i] = nameValuePair;
        }
    } else {
        log.info(jsonObj.ParameterInformation_Response.Status.Description);
    }
} else {
    log.info("Error invoking: " + response.content);
}

Here, I am creating a name-value pair list from the REST service response to populate a Branch selection dropdown. Similarly, you can implement an external service to invoke a REST service for sending or receiving data and integrate with 3rd party applications in IBM BAW 20.0.0.1 (Business Automation Workflow) Process Center.

Update : IBM Business Automation Workflow (BAW) added OpenAPI 3.0 support starting with the 20.0.0.2 release. This update introduced the ability to discover REST services from an OpenAPI 3.0 specification and generate SCA/REST bindings based on it.


메타데이터
post_id
7e5f5e59eb27
slug
invoking-a-rest-service-in-ibm-baw-through-an-external-service-flow-7e5f5e59eb27
url
https://medium.com/@gihanshamikeliyanage/invoking-a-rest-service-in-ibm-baw-through-an-external-service-flow-7e5f5e59eb27
canonical_url
https://medium.com/@gihanshamikeliyanage/invoking-a-rest-service-in-ibm-baw-through-an-external-service-flow-7e5f5e59eb27
author_url
https://medium.com/@gihanshamikeliyanage
status
ok
fetched_at
2026-06-10 12:26:30