Example 1: HTTP GET request

IMPORT com
 
MAIN
  DEFINE req com.HTTPRequest
  DEFINE resp com.HTTPResponse
  TRY
    LET req = com.HTTPRequest.Create("http://localhost:8090/MyPage")
    # Set additional HTTP header with name 'MyHeader', and value 'High Priority'
    CALL req.setHeader("MyHeader","High Priority") 
    CALL req.doRequest()
    LET resp = req.getResponse()
    IF resp.getStatusCode() != 200 THEN
      DISPLAY "HTTP Error ("||resp.getStatusCode()||") ",
        resp.getStatusDescription()
    ELSE
      DISPLAY "HTTP Response is : ",resp.getTextResponse()
    END IF
  CATCH
    DISPLAY "ERROR :",STATUS||" ("||SQLCA.SQLERRM||")"
  END TRY
END MAIN