This discussion is archived
5 Replies Latest reply: Nov 22, 2012 1:50 AM by Udo RSS

Reading CGI environment variable in procedure.preProccess

Sanjeev Chauhan Newbie
Currently Being Moderated
In Apex Listener 2.0 EA, I have pre/post process procedure set in default.xml file. In the defined procedure, when I try to get a CGI environment variable, using owa_util.get_cgi_env('remote_user' ), I get a "500 - Internal Server Error". This method works in mod_plsql in the DAD directive PlsqlBeforeProcedure and PlsqlAfterProcedure. How can I achieve similar behavior using apex listener. I need the environment variables to so that I can set the correct session level context for the application. I don't have Apex listener 1.1.4 installed to confirm if this problem exists there as well.

Edited by: Sanjeev Chauhan on Nov 16, 2012 6:07 PM
  • 1. Re: Reading CGI environment variable in procedure.preProccess
    Udo Guru
    Currently Being Moderated
    Hello Senjeev,
    In Apex Listener 2.0 EA, I have pre/post process procedure set in default.xml file
    You mean apex-config.xml , right?
    Did you edit this file manually or using SQL Developer or listenerAdmin?
    In the defined procedure, when I try to get a CGI environment variable, using owa_util.get_cgi_env('remote_user' ), I get a "500 - Internal Server Error".
    This should work with APEX Listener. Could you post the corresponding output of APEX Listener's log?

    Thanks,

    Udo
  • 2. Re: Reading CGI environment variable in procedure.preProccess
    Sanjeev Chauhan Newbie
    Currently Being Moderated
    I used SQL Developer 3.2 to define the procedure.preProcess and procedure.postProcess at the Database Setting level not at the Global Setting level. I then saved the settings and moved the zip file over to the sever manually. When pre/post procedure did not work, I manually edited the default.xml and then tried again. That is when I got the "500 - Internal Server Error" error. I don't have an apex-config.xml file. The files I have are:
    defaults.xml
    url-mapping.xml
    conf/dvlpdms.xml
    conf/dvlpdms_al.xml
    conf/dvlpdms_rt.xml
    The glassfilsh log show this when pre/post procedure is called
    [#|2012-11-19T11:40:38.221-0600|SEVERE|glassfish3.1.2|null|_ThreadID=18;_ThreadName=Thread-2;|Executing procedure failed for oas_util.before_proc
    |#]
    By commenting out the lines where I retrieve environment variables from oas_util.before_proc , then things work.
  • 3. Re: Reading CGI environment variable in procedure.preProccess
    Udo Guru
    Currently Being Moderated
    You are right. I forgot that the apex-config.xml in my instance came from the previous APEX Listener 1.1 release. It moved to defaults.xml with APEX Listener 2 EA2. I'm sorry I've send you into the wrong direction.
    So, you could add
    <entry key="debug.printDebugToScreen">true</entry>
    to this file in order to get a more comprehensive error message in your log.
    I used SQL Developer 3.2
    Which exact version?
    When pre/post procedure did not work, I manually edited the default.xml and then tried again.
    What exactly did you edit and how?

    -Udo
  • 4. Re: Reading CGI environment variable in procedure.preProccess
    Sanjeev Chauhan Newbie
    Currently Being Moderated
    Thanks for taking my question. I manually edited the default.xml file with these values:
    <entry key="log.procedure">true</entry>
    <entry key="debug.debugger">true</entry>
    <entry key="debug.printDebugToScreen">true</entry>
    
    <entry key="procedure.preProcess">oas_util.before_proc</entry>
    <entry key="procedure.postProcess">oas_util.after_proc</entry>
    SQL Developer 3.2.20.09
    RDBMS 11.2.0.3.0
    APEX 4.2.0.00.27
    APEX Listener 2.0.0.268.17.04

    When the "500 - Internal Server Error" error message is raised, that is all there is on the screen. So, how do I get it to display detailed debugging information.

    Edited by: Sanjeev Chauhan on Nov 20, 2012 10:20 AM
  • 5. Re: Reading CGI environment variable in procedure.preProccess
    Udo Guru
    Currently Being Moderated
    I'd really expect to see more information on that error in the application/server log on your GlassFish.
    I'll try to reproduce your scenario as soon as I have access to my testing environment again if you can't find anything there...

    -Udo

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points