BPM, Workflow, and Case

 View Only
  • 1.  Process Center - Change Toolkit REST server definition

    Posted Wed June 12, 2024 03:44 AM
    Hi,
     
    we face always the same problem when we transfer process applications with its dependent toolkits from a process center to another.
    In fact we have 10 process centers, one per customer.
    In several toolkits we have define a REST server to access our customer's data.
    As each REST Server has to access the right customer endpoint, the hostname defined in the REST server has to be changed.
    When we deploy the process application on a process server, we usually change the hostnames thru the Process Admin interfance.
    But when we deploy the process application and its toolkits on a process center, we have to create a new snapshot of all toolkits and process applications after changing the REST Server hostnames in Process Designer.
     
    Is there a way to achieve the REST server properties update thru APIs for the Tip version or directly in the toolkit definition without creating a new snapshot ?
    Our last solution were to change it directly on database, if possible.
    Thanks for help
    Yannick


    ------------------------------
    Yannick Martin
    ------------------------------


  • 2.  RE: Process Center - Change Toolkit REST server definition

    Posted Wed June 12, 2024 07:16 AM

    Hello Yannick-

    So you have a toolkit with services that utilize REST endpoints and the hostname for each endpoint depends on the process application?  Would you be able to modify the service(s) in the toolkit to accept the REST endpoint hostname as an input variable and then the process app contains an environment variable for the hostname which is passed into the toolkit REST service?  This would allow you to set the hostname for each deployed snapshot separately.  If there are a number of references to the toolkit service in the process app, you could even create a wrapper at the process app level which passes in the environment variable for you (so the environment variable is only referenced in one place), and then just utilize the wrapper service in all CSHS, coaches, system services, etc where it is used.

    Let me know if any part of this approach is unclear or wouldn't work for you for some reason.

    Thanks -Don



    ------------------------------
    Don Williams
    ------------------------------



  • 3.  RE: Process Center - Change Toolkit REST server definition

    Posted Thu June 13, 2024 04:45 AM
      |   view attached

    Hi Don,

    thank for your answer.

    I understand that you suggest to use environment variables. How to define the hostname from a REST Server (see picture) with an environment variable ?

    Remark :Thus the environment variables aren't updateable directly in Process Center like on runtime environments (thru Process Admin).

    BR

    Yannick



    ------------------------------
    Yannick Martin
    ------------------------------



  • 4.  RE: Process Center - Change Toolkit REST server definition

    Posted Thu June 13, 2024 04:10 PM

    Ah, yes using the default server configuration like that is an issue.  I typically use a custom Java integration to call REST endpoints via Java's HttpURLConnection and allowing me to pass in the endpoint URL, a header map, optional request body, etc. due to various "inflexibilities" I've encountered over the years with the out of the box REST integration methods.  Creating your own custom Java integration to call REST endpoints might be an option for you as well - which would allow you to pass in the hostname from an environment variable as I described - but converting over to that method might be a big undertaking depending on your situation.

    Thanks -Don



    ------------------------------
    Don Williams
    ------------------------------



  • 5.  RE: Process Center - Change Toolkit REST server definition
    Best Answer

    IBM Champion
    Posted Fri June 14, 2024 09:08 AM
    Edited by Luis Dorantes Tue June 18, 2024 12:46 PM
    Yannick,
    We are using the different solutions Don described as well, dependent upon the service we are calling.
    We use Java for complicated stuff like cookie handling, but we try to use the Javascript functionality as much as possible as described in https://www.ibm.com/docs/en/baw/23.x?topic=javascript-passing-input-parameters. and https://www.ibm.com/docs/en/baw/23.x?topic=service-invoking-rest-by-using-javascript.
    Using this JavaScript, you can overrule (some) properties defined in the REST server definition (by your own ENV of other settings)
    Consider the following sample client code:
    var request = new BPMRESTRequest();
    request.externalServiceName = "MyServiceName";
    request.operationName = "myOperation"; 
    request.endpointAddress = tw.local.inputEndpointAddressDefinedInCallingProcessApp; // Overrule the hostname with an input variable
    request.parameters = {};
    request.parameters.id = tw.local.inputId;
    request.httpHeaders = {"Content-Type": "application/json", 
                    "Accept": "text/plain"
    };
                 
    var response = tw.system.invokeREST(request);
    tw.local.outputResponseObject = JSON.parse(response.content);
    I hope this inspires you.
    Regards,
    Henry



    ------------------------------
    Henry Schenau

    ------------------------------



  • 6.  RE: Process Center - Change Toolkit REST server definition

    Posted Fri June 14, 2024 09:16 AM

    Hi Henry,

    thanks our issue may be resolved with such setting. 

    Thanks



    ------------------------------
    Yannick Martin
    ------------------------------



  • 7.  RE: Process Center - Change Toolkit REST server definition

    Posted Thu June 13, 2024 03:37 PM

    I was in the same boat! Useful info



    ------------------------------
    john smith
    ------------------------------