BPM, Workflow, and Case

 View Only
  • 1.  REST API call fails

    Posted Fri November 04, 2022 04:57 AM
    Hello,

    I have run into issue that REST API call on Postman success, but in IBM Process Designer fails. IBAW version 21.0.3
    any idea where could be a problem? On postman I do have exact same call and no issue at all. 
    this is the call:
    var request = new BPMRESTRequest();
    request.externalServiceName = "CSS Query_2";
    request.operationName = "graphql";
    request.httpMethod = "POST";

    request.httpHeaders = {
    "Jwt-Assertion": tw.local.authToken.accessToken,
    "Content-Type": "application/x-www-form-urlencoded",
    "Accept": "application/json",
    "Cache-Control": "no-cache"
    };

    var requestBody = {
    "query": "query getInvolvedPartyByGcn {\r\n technicalInvolvedPartiesByGcns(gcns:[\"00332640370005\"]) {\r\n involvedPartyId\r\n partySites\r\n {id\r\n createdAt\r\n siteCode\r\n activeFlag\r\n instanceId\r\n sebisId\r\n originType\r\n glIpType\r\n}\r\n}\r\n}"
    }

    request.parameters = {
    requestBody: requestBody,

    };

    request.endpointAddress = "https://api.dev.sebank.se/internal/css-query/v1/graphql";
    request.requestTimeout = 2000;
    request.responseTimeout = 7200;
    log.info("POSTKurreREQUEST" +JSON.stringify(request));

    try {
    var response = tw.system.invokeREST(request);

    if(response.httpStatusCode !== 200){
    throw response.httpStatusMessage + " " + response.httpStatusCode + " " + response.content;
    } else {
    }
    } catch (e){
    throw new Error(e);
    }

    Error message:
    CWTBG0019E: Unexpected exception during execution. Exception information: 'com.lombardisoftware.component.common.workflow.WorkflowProcessItemException: An exception occurred in activity "Script Task" of "Service Flow" with name "Get Kurre Data API 2". Task instance id "Task.887488". Details: "com.lombardisoftware.core.TeamWorksRuntimeException [TeamworksException name='Script Evaluation: Component.Script.c59e76bb-f949-44fb-a70b-92293e49ca70', message='Internal Script error: Error: Not Found 404 {"message":"no Route matched with those values"}', line=37, pos=-1 nested=<none>]".'.</none>

    ------------------------------
    Donata Mielaikaite
    ------------------------------


  • 2.  RE: REST API call fails

    IBM Champion
    Posted Wed November 16, 2022 11:31 AM
    Hi Donata,

    Are you able to run the Get Kurre Data API 2 service from process designer? Why this service name is getting logged when you are trying to call external service - CSS Query_2?



    ------------------------------
    Atanu Roy
    Solution Architect
    Salient Process
    ------------------------------



  • 3.  RE: REST API call fails

    Posted Thu November 17, 2022 02:23 AM
    hello,

    I found were the issue is. Endpointaddress + path are joined during the call.

    ------------------------------
    Donata Mielaikaite
    ------------------------------