Skip to Main Content

Database Software

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Accessing url using utl_http

801619Sep 1 2017

Hi Experts,

My database version is 11g, i have requirement to access URL and getting token. steps followed.

url to access: http://www.abc.net/token (sample url)

1. Created ACL

2. Added connect and resolve privileges

3. assigned host 'www.abc.net' to ACL.

pl/sql code:

declare

DECLARE

  l_http_request   UTL_HTTP.req;

  l_http_response  UTL_HTTP.resp;

  l_text           VARCHAR2(32767);

BEGIN

  -- Make a HTTP request and get the response.

  l_http_request  := UTL_HTTP.begin_request('http://www.abc.net/token');

  -- Use basic authentication if required.

    UTL_HTTP.set_authentication(l_http_request, 'username', '2d4apq3xb5227xxxxxxxxxxxxxxx');

  l_http_response := UTL_HTTP.get_response(l_http_request);

  -- Loop through the response.

  BEGIN

    LOOP

      UTL_HTTP.read_text(l_http_response, l_text, 32766);

      DBMS_OUTPUT.put_line (l_text);

    END LOOP;

  EXCEPTION

    WHEN UTL_HTTP.end_of_body THEN

      UTL_HTTP.end_response(l_http_response);

  END;

EXCEPTION

  WHEN OTHERS THEN

    UTL_HTTP.end_response(l_http_response);

    RAISE;

END;

I'm getting error 'logon failure', Authorization required (401).

They have given password in some format what i mentioned above, i doubt that's is causing issue, could somebody help me on this, what could be issue, if password is the issue, any built ins to convert to readable format and pass.

Thanks

Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 29 2017
Added on Sep 1 2017
0 comments
1,004 views