4 Replies Latest reply: Oct 10, 2013 10:06 AM by ups_mike RSS

    Endless ajax call possible??

    ups_mike

      Hi 2 all!

      I would like to implement a meeting room display - apex application. It is a very small application which runs on a tablet mounted beside the door a meeting room.

      The application has two pages:

      Page 1 to set some cookies (meetingroom, site, timezone)

      Page 2 displays the defined meetingroom name, the actual datetime and the current booking situation. This page should run for at least one month without any interaction.

      Just always displaying the current booking situation.

       

      The current booking situation is located in an own region and the region content gets refreshed periodically by a an ajax call which calls an application.

      Some details...

       

      The application process (LOAD_MEETINGS):

      Begin

        owa_util.mime_header('plain/text', FALSE);
        htp.p('Cache-Control: no-cache');
        htp.p('Pragma: no-cache');
        owa_util.http_header_close;

        HTP.p (ers_display.display_mr(apex_application.g_x02,apex_application.g_x01));  --returns the html content

      End;

       

      The javascript code in the page header:

      <script language="JavaScript">

      //Loads the actual time

          window.onload=worldClockZone("datetime");

      //refresh of the booking status

          var refresh_content = function(){
          var ajaxRequest = new htmldb_Get(null, 500, 'APPLICATION_PROCESS=LOAD_MEETINGS', 1);
          ajaxRequest.addParam("x02", $.cookies.get('MEETINGROOM_COOKIE'));
          ajaxRequest.addParam("x01", $.cookies.get('SITE_CODE_COOKIE'));

          var ajaxResult = ajaxRequest.get();

          $("#BOOKING_CONTENT").html(ajaxResult);
          $("#themeetingroom").html($.cookies.get('MEETINGROOM_COOKIE'));
          $("#theclockclass").attr("name",$.cookies.get('JS_CLOCK_CLASS_COOKIE'));

          setTimeout("refresh_content()", 1000);

      }

      </script>

      <script language="JavaScript">

           var refresh_page = function(){
           apex.submit('REFRESH');

      }

      </script>

      Javascript executed when page loads:

      window.onload=worldClockZone("datetime");

      refresh_content();

      setTimeout("refresh_page()", 7200000);

      The problem:

      Every thing runs fine for about 20 hours. Then suddenly the following error appears:


      Mon,  7 Oct 2013 06:28:27 GMT wwv_flow.show:SIGNATURE (parameter names) MISSMATCH VARIABLES IN FORM NOT IN PROCEDURE:

      P NON-DEFAULT VARIABLES IN PROCEDURE NOT IN FORM: DATA name: devsystem PROCEDURE: wwv_flow.show URL :

      http://devsystem.int.com:7779/apex/devsystem/wwv_flow.show?p=::52342342343234: PARAMETERS : =========== P: ::52342342343234:

      ENVIRONMENT: =========== PLSQL_GATEWAY= WebDb GATEWAY_IVERSION=3

      SERVER_SOFTWARE=Oracle-Application.Server.10g/10.1.2.0.2 Oracle -HTTP-Server GATEWAY_INTERFACE=CGI/1.1 SERVER_PROT=7779 SERVER_NAME=devsystem.int.com

      REQUEST_METHODE=GET QUERY_STRING= p=::52342342343234: PATH_INFO=/wwv_flow.show SCRIPT_NAME=/apex/devsystem

      ....

      ....

       

       

      Why does this error occure? Is this an apex problem? Or does it come from the application server?

      I already set the application

            max session length in seconds = 0

            max sessionidle time = 0

       

      Any ideas where to search for a solution?

       

      Best regards,

      Mike

        • 1. Re: Endless ajax call possible??
          Greg Jarmiolowski

          Mike,

           

          Just going on a hunch here. The docs mention another job that could sweep out sessions older than 12 hours. If it runs every 8 hours it looks like 20 hours is about the maximum session duration possible (without altering the job).

           

          Maximum Session Length in Seconds - Enter a positive integer to control how many seconds a session exists and is used by this application. Leave the value null to revert the value to the instance level setting. Enter 0 to have the session exist indefinitely. The session duration may be superseded by the operation of the job that runs every eight hours which deletes sessions older than 12 hours.

           

          Greg

          • 2. Re: Endless ajax call possible??
            ups_mike

            Hi Greg!

             

            Thank your for your answer. The problem raises because the session ID got invalid during the ajax call.

            So it seems to me...

             

            1) the ajax call was initiated

            2) parameters were set

            3) application process was started

            4) session id got obsolete and new session id was created

            5) database returned the result but the old sessionid was not any longer valid

            6) error

             

            I am not totally sure but i simulated it by executing the following plsql statement every second:

               Begin

                   APEX_CUSTOM_AUTH.LOGOUT(500,                   --app_id

                                    null,                   --new session id

                                    'f?p=500:1:');  -- redirect url

                End;

            So i got every second a new session id.

            Additionally i changed the htmldb_get to

             

            apex.server.process('LOAD_MEETINGS',

                                  {x01: localStorage.site_code,

                                   x02: localStorage.meetingroom},

                                  {success: function(data){

                                      $("#BOOKING_CONTENT").html(data);

                                   },

                                   error: function(data){

                                      window.location.reload();

                                   },

                                   dataType: "text"}

                                 );

             

            In case of an error I reload the page.

            I will run a test about that over the weekend....

            Hope the problem is solved...

             

            Thanks! Mike

            • 3. Re: Endless ajax call possible??
              Nicolette

              Mike

               

              You may want to take into account that when an error occurs during the running of the ondemand process a html page with the error message is returned.

              The javascript function apex.server.process will see that as succesfull as there is a responce to the request.

               

              Nicolette

              • 4. Re: Endless ajax call possible??
                ups_mike

                Thank you!

                 

                Sounds correct!

                Mike