2 Replies Latest reply on Feb 27, 2020 7:17 PM by PJ

    500 / 403 confusing

    PJ

      Hi There

      I want to share something here, and maybe someone can clarify whats going on for me.

      I am using Oracle 18 and ORDS 19.2 in XEPDB1 container DB.

       

      Note the error in the service handler declare section.  When the error is NOT there, I get 200.  Great.  If I mangle the local variable definition I get 403 when I expect I should get 500.  What is going on?  I am using Google ARC to test.

       

       

      Thanks

       

      create or replace package pjtest as
      procedure do_nothing(p_in  varchar2);
      end;
      /
      
      create or replace package body pjtest as
      procedure do_nothing (p_in varchar2) is
      begin
        PLJ_LG.D('PJTEST');   -- Writes to a log table
      end;
      end;
      /
      
      
      
      
      EXEC ORDS.DROP_REST_FOR_SCHEMA('KAMATA');
      
      EXEC ORDS.ENABLE_SCHEMA;
      
      COMMIT;
      
      BEGIN
      
        ORDS.enable_schema(
          p_enabled             => TRUE,
          p_schema              => 'KAMATA',
          p_url_mapping_type    => 'BASE_PATH',
          p_url_mapping_pattern => 'kamata'
      --    p_auto_rest_auth      => FALSE
        );
      
      
        ORDS.DEFINE_SERVICE(
          p_module_name    => 'test',
          p_base_path      => 'dev/',
          p_pattern => '.',
          p_method => 'POST',
          p_source_type    => ORDS.source_type_plsql,
          p_source         => q'[DECLARE
                                   l_var_BAD varchar2(12) := 'YYY';        -- Mangled local variable
                                 BEGIN 
                                   PJTEST.DO_NOTHING(p_in => l_var);    
                                 END;]',
          p_items_per_page => 0);
      
       ORDS.DEFINE_PARAMETER(
          p_module_name => 'test',
          p_pattern => '.',
          p_method => 'POST',
          p_name => 'Conent-Length',
          p_bind_variable_name => 'content_length',
          p_source_type => 'HEADER',
          p_access_method => 'OUT'
        );
      
      
      END;
      /
      
      COMMIT;