DataPower

DataPower

Join this online group to communicate across IBM product users and experts by sharing advice and best practices with peers and staying up to date regarding product enhancements.

 View Only
  • 1.  Gatewayscript bringing Datapower to Down state

    Posted 07/22/20 10:59 AM

    Dear Team,

    When i am using below Gatewayscript code, my datapower is going down.

    am just doing Multiplication whith while loop.

    I know this is Datapower forum please help me to find out because not much difference in script.

    apim.readInputAsJSON(function (error, json) {

    if (error)

    {

    // handle error

    }

    else

    {

    var x1 = apim.getvariable('json.x');

    var y1 = apim.getvariable('json.y');

    var Result = 0; //Initializing with 0

    while(y1 != 0)

      {

       Result += x1;

       y1--;

      }

    session.output.write(Result); 

    // write to the output context

    }

    });



    #DataPower
    #Support
    #SupportMigration


  • 2.  RE: Gatewayscript bringing Datapower to Down state

    Posted 07/22/20 12:35 PM

    For negative y1 you execute loop nearly endless.

    Replace "while(y1 != 0)" with "while(y1>0)" and tell what happens then.



    #DataPower
    #Support
    #SupportMigration


  • 3.  RE: Gatewayscript bringing Datapower to Down state

    Posted 07/22/20 02:10 PM

    Thanks Hermann,

    It worked without failing datapower.

    Earlier it was causing infinite loop that's why datapower getting restarted.



    #DataPower
    #Support
    #SupportMigration