3 Replies Latest reply on Apr 4, 2018 7:33 AM by Pierre Yotti

    OWA_UTIL.STATUS_LINE has no effect

    Erik Raetz

      We are currently in the need of providing our own HTTP status codes depending on the response of a service request.

      We use services of source type plsql/block only and provide our own HTTP mime type and body already.

       

      Using OWA_UTIL.STATUS_LINE had no effect no matter where we tried to put it.

       

      The only solution we found is providing a new OUT parameter for each service using X-APEX-STATUS-CODE.

      The problem with this is that we need to adjust every single service because of that since our procedures need to provide the :status of the decare script with our new HTTP status code.

      If we could have used OWA_UTIL.STATUS_LINE it would have been one line change in one function and we would have been done.

       

      Example of the problem:

       

      ords.define_handler(

        p_module_name => 'dev', p_pattern => 'status', p_method => 'GET',

        p_source_type => 'plsql/block',

        p_source => 'DECLARE

      BEGIN

        OWA_UTIL.STATUS_LINE(400,NULL,FALSE);

        OWA_UTIL.MIME_HEADER(''text/pain'', FALSE, ''utf-8'');

        htp.p(''X-Transactionid: 123'');

        OWA_UTIL.HTTP_HEADER_CLOSE;

        htp.prn(''Hello world!'');

      END;',

        p_items_per_page => NULL

      );

       

      The only working solution we found:

       

      ords.define_handler(

        p_module_name => 'dev', p_pattern => 'status2', p_method => 'GET',

        p_source_type => 'plsql/block',

        p_source => 'DECLARE

      BEGIN

        :status := 400;

        OWA_UTIL.MIME_HEADER(''text/pain'', FALSE, ''utf-8'');

        htp.p(''X-Transactionid: 123'');

        OWA_UTIL.HTTP_HEADER_CLOSE;

        htp.prn(''Hello world!'');

      END;',

        p_items_per_page => NULL

      );

       

      ords.define_parameter(p_module_name => 'dev', p_pattern => 'status2', p_method => 'GET',

        p_name => 'X-APEX-STATUS-CODE',

        p_bind_variable_name => 'status',

        p_source_type => 'HEADER',

        p_param_type => 'STRING',

        p_access_method => 'OUT'

      );

       

      Are we doing anything wrong?