How I can get HTTP response error message?

Viewed 734

I make rest request using APEX_WEB_SERVICE.MAKE_REST_REQUEST function, when I get unsuccessful response status code (for example 400, 405), I didn't get body, but Oracle Apex Debug Message Data displaying:

HTTP response 405 - <message>

How I can get this message? I try to use apex_web_service.g_headers but it doesn't give me it.

enter image description here Photo from Apex Debug, where is green border - my custom error, where is red border - Apex. And I think this data from HTTP header or something like that.

2 Answers

as MAKE_REST_REQUEST us a function, you should find the response body in the variable you have MAKE_REST_REQUEST assigned to ...

APEX never writes the response body to debug output; but you can do that yourself, as follows:

:
l_response := APEX_WEB_SERVICE.MAKE_REST_REQUEST( ... );
if apex_web_service.g_status_code >= 400 then
    apex_debug.info( 'Request Body is %s', sys.dbms_lob.substr( l_response, 4000, 1 ) );
end if;
:

APEX_WEB_SERVICE.G_REASON_PHRASE - that what I need.

Related