Forum Stats

  • 3,757,089 Users
  • 2,251,194 Discussions
  • 7,869,721 Comments

Discussions

APEX_WEB_SERVICE.MAKE_REST_REQUEST giving ORA-29267: illegal call if provided with username & pwd

turuvekere_pk-Oracle
turuvekere_pk-Oracle Member Posts: 8
edited Oct 11, 2017 10:47AM in APEX Discussions

Hi Buddies,

I have a ws request which has basic authentication set.

First, i tried without giving username & pwd. It gave me authorisation failed. (that means i am able to hit the target url succesfully).

WS_RESPONSE := APEX_WEB_SERVICE.MAKE_REST_REQUEST

(

p_url => <target url>,

p_http_method => 'POST',

p_body => '{ field1:value1 }',

p_wallet_path => <wallet_path>,

p_wallet_pwd  => <wallet_pwd>

);

o/p :

i get html response beginning with :  <TITLE>Error 401--Unauthorized</TITLE>

Next, I am giving both userrname & pwd. BUT now it throws ORA-29267: illegal call ERROR.

WS_RESPONSE := APEX_WEB_SERVICE.MAKE_REST_REQUEST

(

p_url => <target url>,

p_http_method => 'POST',

p_body => '{ field1:value1 }',

p_username => <username>,

p_password => <pwd>,

p_wallet_path => <wallet_path>,

p_wallet_pwd  => <wallet_pwd>

);

o/p:

ORA-29273: HTTP request failed

ORA-06512: at "SYS.UTL_HTTP", line 1185

ORA-29267: illegal call

FYI : I am calling the API inside a stand alone procedure.

Kindly provide me some inputs on this.

Thanks,

Praveen

Tagged:
turuvekere_pk-OracleRichard Dalvi

Answers

  • Pavel_p
    Pavel_p Member Posts: 2,305 Gold Trophy
    edited Aug 11, 2017 10:08AM

    Hi Praveen,

    is the service by any chance public or at least could you share some more details about its documentation? At least the full response with error description would be highly helpful (not just "<TITLE>Error 401--Unauthorized</TITLE>").

    From your example it's not obvious how exactly should the service call look like, so the only thing that comes to my mind is that your JSON request body is not valid (double quotes are missing in your JSON object - it should be either { "field1":"value1" } or { "field1": numeric_value}), so I suggest to validate your JSON with some online JSON validator first.

    If this does not help, try to invoke the service with some REST service client and eventually share description/screenshots of your successful call and then we could adjust your code accordingly.

    Regards,

    Pavel

    turuvekere_pk-Oracle
  • turuvekere_pk-Oracle
    turuvekere_pk-Oracle Member Posts: 8
    edited Oct 11, 2017 10:47AM

    Thanks Pavel for your inputs.

    the webservice works fine in POSTMAN.

    also, i have tried calling the WS with valid json but didn't help.

    Later i had to raise an SR to Oracle DBA to check on this. and i have some useful info on this.

    This is a bug with "Apex Version 5.0.0.00.31 as per MOS Note : 2280378.1".

    So, I had to upgarde my APEX version to v5.1.1 now.  and WS call works fine now

    Richard Dalvi
This discussion has been closed.