1 Reply Latest reply: Oct 24, 2012 9:19 PM by AdamMartin RSS

    Get CGI environment from APEX Listener within database procedure

    AdamMartin
      I have seen a few topics on this forum that briefly touch on this issue, but nothing real definitive. I'd like to know how I can get the CGI environment from the APEX Listener. For example, if I want to write a procedure that inserts into a table the originating IP Address of the client making the web request, how do I get it?

      I am familiar with the Oracle Http Server and mod_plsql, and I know how to call OWA_UTIL.GET_CGI_ENV to get this sort of information. How do I do it using the APEX Listener?

      In particular, how do I do this when calling a custom procedure (not in an Apex workspace)? When I try it now, I get an error from owa_util. The cgi env seems to be empty or not initiated (owa.num_cgi_vars is null or zero).

      Specific set-up:
      I have a web server running the latest JDK, Glassfish, and Apex Listener. It connects to another server running the latest 11.2 database. Apex is installed and running, but I am not really developing a traditional Apex application in a workspace. I mainly use it like you would use mod_plsql. In other words, I have custom pl/sql packages that are called directly via URL. The requests are forwarded by the listener to the database, and the DB executes the procedure and returns output using htp.p to send text back to the browser. And it works just fine for this purpose. But if I want to call GET_CGI_ENV to get information like the IP Address, web browser making the request, etc. I can't seem to get it with the OWA packages.

      Can anyone shed some light on this? If Apex Listener is not designed to do this, is there some kind of workaround I can use to forward this sort of information to the database for each request?


      Edit: I should clarify that when I said I have the "latest" Apex Listener, I don't have the new 2.0 pre-release. I'm on 1.1.4.