4 Replies Latest reply on Dec 1, 2017 8:01 AM by lgtandi

    Invoke web service script

    l3ender Rookie

      Hello, I'm trying to create a small script that will eventually be called from a triggered action. I'm wanting to call a 3rd party API that is REST based. I have the 3rd party application running on a local internal server and I can access it directly. I am now trying to call the application from a HEAT script with the following:


      var response = ExecuteWebRequest("GET", "http://is-pc80.rbfcu.local:9090/appnotify/", null, null);


      I'm stuck on where to go from here. Is there somewhere where I can manually run this and see the output?



      • I've tried creating a simple trigger (business objects > incident > business rules > triggered actions) to fire when the subject is changed. See screenshot:
        • action1.png
        • The triggered action is set with an "action rule type" of "web service script (beta), where I've entered my script above. However when I create or edit an incident I don't see anything hitting the server where the 3rd party app is running
      • I've set script logging (application logs > logging configuration) to "all"
      • Version we are running is HEAT 2016.2.1000.21143 @ 1/23/2017


      Please advise. Thank you!

        • 1. Re: Invoke web service script
          bernd.kallweit Apprentice

          Hi l3ender,


          if your script does not need to run in the context of a specific business object (like your example above) you can simply start it with the 'Publish and Run Now' button. It will take a few seconds and the script will run.

          You could as well link your script with a Web Service Script quick action and then run it from the Action Menu of the particular business object. That way you don't have to create a situation in which the trigger fires.


          For logging I typically use console.debug (or console.error for real errors) and set script logging to 'Debug'.



          Good luck,


          • 2. Re: Invoke web service script
            l3ender Rookie

            Thanks for the response, Bernd.


            When you use logging (console.debug, etc), where are you viewing the log files?

            • 3. Re: Invoke web service script
              bernd.kallweit Apprentice

              First, I don't really know, if the debug messages make it to the Log workspace in Heat; I believe, they do. And then you should be able to find the messages there.


              The messages are written to the AppServer.frslog files, but those get deleted after being consumed by the Logging Service.

              I 'improved' Heat logging by adding a second appender, which accumulates log messages in my own, separate log file; you can do this by modifying the log4net.config file in AppServer: duplicate the ASPCustXMLAppender, give it a new name, change some params (as below), and add it to the root section at the bottom. My params are

                 <param name="File" value="D:\Logs\AppServer.log" />

              <param name="PreserveLogFileNameExtension" value="true" />

              <param name="RollingStyle" value="Composite" />

              <param name="AppendToFile" value="true" />

              <param name="MaximumFileSize" value="10MB" />

              <param name="DatePattern" value=" yyyyMMdd" />

              <param name="MaxSizeRollBackups" value="-1" />

              <param name="CountDirection" value="1" />

              <param name="StaticLogFileName" value="true" />

              • 4. Re: Invoke web service script
                lgtandi Apprentice

                You have to set the log level of service "Script" to DEBUG or INFO if you want to see your console output in the "Logs" workspace.