4 Replies Latest reply: Jan 30, 2013 2:03 PM by Billy~Verreynne RSS

    Regarding htp or htf packages..

    phani marella
      Hi all..

      Oracle Database: 10g

      Please help me with the following question.
      I am working on a application , which was completed coded with htp and htf packages (oracle web util).
      Is there any command or proc, that we can ""capture the url"" of the page that is getting genarated.
      Basically i have a process which is genaring ""oracle reports url"" using lot of "htp or htf" calls.
      I need to capture that url and see what url the code is generating.

      Thank u
        • 1. Re: Regarding htp or htf packages..
          Billy~Verreynne
          Not sure what exactly the question is. Do you want to determine the URL of the caller inside PL/SQL web enabled code?

          If you are inside PL/SQL code that has been called by/via a URL, then the URL can be determined via CGI (Common Gateway Interface) variables. E.g.
          myUrl := 'http://'||
                   owa_util.get_cgi_env( 'SERVER_NAME' ) || ':' ||  owa_util.get_cgi_env( 'SERVER_PORT' ) ||
                   owa_util.get_cgi_env( 'SCRIPT_NAME' ) || owa_util.get_cgi_env( 'PATH_INFO' ) || '?' ||
                   owa_util.get_cgi_env( 'QUERY_STRING' );
          If https is also option, evaluate the HTTPS CGI variable.
          • 2. Re: Regarding htp or htf packages..
            phani marella
            Sorry for the late reply Billy.
            This is my scenario.
            I am in a pl/sql process which is generating the ""url"" for opening a report (it can be either oracle report or XML publisher report). I would like print that url, i mean capture that url and see what url the code is generating to output that report..

            some sample code. Sorry it is a huge package , that's why i cannot paste it completely.
            The following code is part of ""BI publisher"" report, it is constructing a url (i think)
                        htp.tablerowopen;
                        htp.tableHeader('_xpf');
                        htp.tableData( htf.formText('_xpf'));
                        htp.tableRowClose;
                        htp.tableRowOpen;
                        htp.tableHeader('_xpt');
                        htp.tableData( htf.formText('_xpt',NULL,NULL,'0'));
                        htp.tableRowClose;
                        htp.tableRowOpen;
                        htp.tableHeader('_xdo');
                        htp.tableData( htf.formText('_xdo',NULL,NULL,l_cp.server));
                        htp.tableRowClose;
            
                        htp.tableRowOpen;
                        htp.tableHeader('_xt');
            
                        htp.tableData( htf.formText('_xt',NULL,NULL,l_cp.keymap));
                        htp.tableRowClose;
            
                        htp.tableRowOpen;
                        htp.tableHeader('_xf');
                        htp.tableData( htf.formText('_xf',NULL,NULL,'pdf'));
                        htp.tableRowClose;
            
                        htp.tableRowOpen;
                        htp.tableHeader('_xmode');
                        htp.tableData( htf.formText('_xmode',NULL,NULL,'4'));
                        htp.tableRowClose;
            • 3. Re: Regarding htp or htf packages..
              phani marella
              Can anyone please help me with this issue..

              Thank u
              • 4. Re: Regarding htp or htf packages..
                Billy~Verreynne
                Low on coffee and caffeine... so you need to explain extra slowly for me to understand. ;-)

                As I understand your issue now, you have a web enabled procedure - and you want to call it manually to see the (web/http) output it generates.

                Typically, this is what mod_plsql (Apache module) does. It gets the browser's http call from the Apache kernel. It parses that. It changes it into a database PL/SQL call. Once the procedure has done, it reads the HTTP output of that procedure, and sends it back (via Apache) to the browser.

                Yes, this can be done manually to. You need to create/initialise a CGI environment in your database session. Execute the web procedure. And then manually look at the HTTP/HTML buffer that the procedure generated and would have send, via Apache, back to the browser.

                I've shown the basics of how this can be done in {message:id=2251131} - where the procedure WebTest is the web enabled PL/SQL procedure generating a web report/page/whatever.

                The PL/SQL (pipeline table) function WebCall is used as the "web browser/mod_plsql" interface. It initialises the CGI environment for the web enabled procedure. It then calls this procedure. Finally, it reads the dynamic web content generated by this procedure and output it as text lines.

                If I'm not mistaken, SQL-Developer has a similar feature?