IBM BPM JS Calling external Service from another Toolkit (from dependency)

497 views Asked by At

im using

  1. integration toolkit for each external system ... externalService definition, Servers registation datas, ENV refers the J2C creds to use, datamapping, bussines-errors handling etc. (Bussines-Layer TK ex. TK_SAP)
  2. for the common functionality such as logging, tokenizing, pseudomizing, common http-error handling i want to use another one toolkit (Generic implementation for Transport-layer ex. TK_COM).

So its looks like this dependicies chain:

ProcessApp -> TK_SAP -> TK_COM

There is the serviceFlow with inputs externalServiceName, operationName and a serviceFlow ask for oAuth-token and call to target system using externalServiceName, operationName.

The problem is - when i try to invoke the BPMRESTRequest from TK_COM, i get NullPointerException because "externalServiceName" cant be resolved.

var request = new BPMRESTRequest();
request.externalServiceName = "language-translator-v2";
request.operationName="checkout";
...
var response = tw.system.invokeREST(request);
  1. is it possible to store service definition in another TK (upper) and refer it from Toolkit-invoker?
  2. Or is there callbacks for BPMRESTRequest-Construct to say which ServiceDefinition must be used and avoid NPE.
  3. Or another way to call Rest programmaticaly supporting Environments.

Im understand that switching the layers can help (serviceDefinition in lower TK-dependency), but it unlogisch is:

ProcessApp -> TK_COM -> TK_SAP
1

There are 1 answers

0
Alexandr Kil On BEST ANSWER

the answer is: JS-lib implementation. Implementing common functionality as JS-Server-file in TK_COM makes that a call to it from TK_SAP will instatiate JS-execution context in the TK_SAP namespace so all defined in TK_SAP externalServices and variables will be accesible by executing of JS-code (actualy provided by lower-dependency Toolkit)