Skip to Main Content
  • Questions
  • How to Call Fusion REST api in PLSQL using apex web service

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Praveen.

Asked: September 07, 2021 - 12:17 pm UTC

Last updated: September 23, 2021 - 5:41 am UTC

Version: 19c

Viewed 100+ times

You Asked

Hi,

I'm trying to consume Oracle fusion rest web service's in PLSQL using apex_web_service. I'm getting the below error. could you please guide me on this.

also Pls suggest how to enable the basic authentication in web service like how to set the basic auth.


ORA-20987: APEX - One or more cookies set in apex_util.g_request_cookies contain an invalid value. - Contact your application administrator.
Details about this incident are available via debug id "49001

CREATE OR REPLACE FUNCTION ATP_REST RETURN CLOB AS 
l_clob    CLOB;
  l_result  VARCHAR2(32767);
BEGIN

APEX_WEB_SERVICE.g_request_cookies.delete();
APEX_WEB_SERVICE.g_request_cookies(1).name := '';---i'm passing the username (baisc auth)
APEX_WEB_SERVICE.g_request_cookies(1).value := '';---pwd 

  l_clob := APEX_WEB_SERVICE.make_rest_request(
    p_url         => 'https://ehpv-dev8.fa.em2.oraclecloud.com/bpm/api/4.0/tasks',
    p_http_method => 'GET'
--    p_parm_name   => APEX_UTIL.string_to_table('p_int_1:p_int_2'),
--    p_parm_value  => APEX_UTIL.string_to_table(p_int_1 || ':' || p_int_2)
  );

  DBMS_OUTPUT.put_line('l_clob=' || l_clob);

  RETURN l_clob;
END;
/




Regards,
Praveen Paulraj

and we said...

I don't know much about cookies and their relationship to Fusion, but cookies are a key-value pair, so

APEX_WEB_SERVICE.g_request_cookies(1).name := '';---i'm passing the username (baisc auth)
APEX_WEB_SERVICE.g_request_cookies(1).value := '';---pwd 


would not be the way you would pass this information. It would be more along the lines of:

APEX_WEB_SERVICE.g_request_cookies(1).name := 'username'
APEX_WEB_SERVICE.g_request_cookies(1).value := 'connor';  -- the *value* of the username
APEX_WEB_SERVICE.g_request_cookies(1).name := 'password'
APEX_WEB_SERVICE.g_request_cookies(1).value := 'secret';  -- the *value* of the pasword


But its rare for cookies to be used for authentication, because the MAKE_REQUEST and MAKE_REST_REQUEST both support username/parameters for authentication

Rating

  (1 rating)

Comments

Below comments also not working

Praveen Paulraj, September 21, 2021 - 1:00 am UTC

Hi Conor,

Still i'm facing same challenge, it's not working.

Error:
ORA-20987: APEX - One or more cookies set in apex_util.g_request_cookies contain an invalid value. - Contact your application administrator.
Details about this incident are available via debug id "63015".
ORA-06512: at "APEX_200200.WWV_FLOW_WEB_SERVICES", line 1157
ORA-06512: at "APEX_200200.WWV_FLOW_WEB_SERVICES", line 757
ORA-06512: at "APEX_200200.WWV_FLOW_ERROR", line 1040
ORA-06512: at "APEX_200200.WWV_FLOW_ERROR", line 1407
ORA-06512: at "APEX_200200.WWV_FLOW_WEB_SERVICES", line 695
ORA-06512: at "APEX_200200.WWV_FLOW_WEB_SERVICES", line 998
ORA-06512: at "APEX_200200.WWV_FLOW_WEB_SERVICES", line 1346
ORA-06512: at "APEX_200200.WWV_FLOW_WEBSERVICES_API", line 608
ORA-06512: at "XXHR.ATP_REST", line 18

Connor McDonald
September 23, 2021 - 5:40 am UTC

Can you get it to work with standard authentication, so at least we can confirm that you have everything else configured correctly?

More to Explore

APEX

Keep your APEX skills fresh by attending their regular Office Hours sessions.