There is a REST Web Service which returns data in raw data type format. It is basically a file of the format application/octet-stream. Is there a way to parse this response and store it in an APEX table as BLOB/CLOB.
Tried two approaches.
1. Using apex_web_service.make_rest_request. In this approach, it can handle only CLOB/BLOB responses. It throws an error - 'ORA-29273: HTTP request failed.ORA-44102: unknown or unsupported algorithm'.
Also tried with apex_web_service.make_rest_request_B. Same error
declare
l_resp CLOB;
l_dimension VARCHAR2(100);
l_status VARCHAR2(10);
begin
apex_web_service.g_request_headers (1).name := 'Content-Type';
apex_web_service.g_request_headers(1).value := 'application/octet-stream';
l_resp := apex_web_service.make_rest_request(
p_url => 'https://edmcs-##################/epm/rest/v1/files/temp/(fileId)',
p_http_method => 'GET',
p_username => 'username',
p_password => 'password);
end;
2. Using utl_http package. In this approach, it gives an error - 'ORA-29273: HTTP request failed.ORA-29106: Cannot import PKCS #12 wallet.'
declare
l_http_request UTL_HTTP.req;
l_http_response UTL_HTTP.resp;
l_text VARCHAR2(1000);
p_url VARCHAR2(500) := 'https://edmcs-/##################/epm/rest/v1/files/temp/(fileId) ';
BEGIN
DBMS_OUTPUT.enable(1000000);
DBMS_OUTPUT.put_line('Before set_wallet');
UTL_HTTP.set_wallet('file:///u01/app/oracle/product/12.1.0/dbhome_1/wallet', 'wallet_pwd');
DBMS_OUTPUT.put_line('Before begin_request');
l_http_request := UTL_HTTP.begin_request(p_url,'GET');
DBMS_OUTPUT.put_line('Before get_response');
l_http_response := UTL_HTTP.get_response(l_http_request);
LOOP
DBMS_OUTPUT.put_line('Before read_text');
UTL_HTTP.read_text(l_http_response, l_text, 999);
DBMS_OUTPUT.put_line('After read_text');
DBMS_OUTPUT.put_line (l_text);
END LOOP;
EXCEPTION
WHEN UTL_HTTP.end_of_body THEN
UTL_HTTP.end_response(l_http_response);
WHEN OTHERS THEN
UTL_HTTP.end_response(l_http_response);
RAISE;
end;