Hi,
I'm rewriting this to better explain an idea I previously shared in the forum.
Basically, I need to retrieve the XML output of a report I created using a Report Query in Shared Components. I managed to do this successfully on the client side using fetch()
in JavaScript — it works perfectly.
However, when I tried to achieve the same on the server side using APEX_WEB_SERVICE.make_rest_request
, it didn’t work. The reason seems to be that the URL I’m calling lacks session information, such as cookies. As a result, it cannot access the content.
I tested the same URL using Postman and manually included my session cookies — it worked there. I then tried to replicate this in PL/SQL using owa_util.get_cgi_env('HTTP_COOKIE')
, but it doesn’t retrieve the required cookies like:
ORA_WWV_APP_<application id> = ORA_WWV_APP_workspace cookie id
ORA_WWV_REMEMBER_UN

So I believe that's why the request fails in PL/SQL.
Here's a simplified version of what I tried:
l_url := APEX_UTIL.HOST_URL ||
APEX_UTIL.PREPARE_URL(
p_url => 'f?p=' || :APP_ID || ':0:' || :APP_SESSION || ':PRINT_REPORT=RP-GEPR-REPORTE',
p_checksum_type => 'SESSION',
p_plain_url => TRUE
);
l_clob := APEX_WEB_SERVICE.make_rest_request(
p_url => l_url,
p_http_method => 'GET'
);
So my question is: is there any other way to call this URL from PL/SQL and somehow capture the response — maybe similar to how owa_util.redirect_url works — so I can retrieve and store the XML output?
I need the XML because my reporting server requires that structure to generate reports.
Thanks you.