Dwane James
Dwane James

Reputation: 1

Using UTL_HTTP to call a Webservice from PL/SQL Procedure - Error 403 Forbidden access is denied

I need your help.It's been almost 2 months that I am trying to call a webservice from a PL/SQL procedure.

I can call the webservice using Chrome Extension ARC.

But when I use the UTL_HTTP Oracle API, it is not working.

Here is my code (some lines are missing but I managed to show you the major lines)

DECLARE
http_method VARCHAR2(10)          := 'POST';
CONTENT_TYPE_HEADER VARCHAR2(30)  := 'Content-Type';
CONTENT_TYPE_LENGTH VARCHAR2(30)  := 'Content-length';
CONTENT_TYPE_VALUE VARCHAR2(30)   := 'text/plain';
v_param_length NUMBER :=12;
    BEGIN
    UTL_HTTP.SET_TRANSFER_TIMEOUT(request_timeout);
    req := UTL_HTTP.BEGIN_REQUEST (url => UTL_URL.ESCAPE(v_url_1), method => http_method);
  utl_http.set_authentication(req, 'myuser',  '1234',  'Basic', FALSE);
    UTL_HTTP.SET_HEADER (r => req, name => CONTENT_TYPE_HEADER, value =>     CONTENT_TYPE_VALUE);
    UTL_HTTP.SET_HEADER (r => req, name => CONTENT_TYPE_LENGTH, value => v_param_length);
    resp := UTL_HTTP.GET_RESPONSE(r => req);
    UTL_HTTP.END_RESPONSE(resp);
    EXCEPTION
    WHEN UTL_HTTP.END_OF_BODY THEN
      BEGIN
        UTL_HTTP.END_RESPONSE(resp);            
      END;
    WHEN UTL_HTTP.TOO_MANY_REQUESTS THEN
      UTL_HTTP.END_RESPONSE(resp);
END;

This is the error :

<div id="header"><h1>Server Error</h1></div>
<div id="content">
 <div class="content-container"><fieldset>
  <h2>403 - Forbidden: Access is denied.</h2>
  <h3>You do not have permission to view this directory or page using the credentials that you supplied.</h3>
 </fieldset></div>

The administrator told me that this error is not caused by the proxy :

DISABLE PROXY

[myuser@myserver ~]$ export https_proxy=

[myuser@myserver ~]$ export http_proxy=

TEST CONNECTION

[myuser@myserver ~]$ wget http://my-server-ws:1234 --2017-02-28 13:14:17-- http://my-server-ws:1234/ Resolving my-server-ws (my-server-ws)... 10.10.5.70 Connecting to my-server-ws (my-server-ws)|10.10.5.70|:1234... connected. HTTP request sent, awaiting response... 403 Forbidden 2017-02-28 13:14:17 ERROR 403: Forbidden.

Upvotes: 0

Views: 2099

Answers (1)

M Zippka
M Zippka

Reputation: 103

403 response generally indicates one of two conditions:

Authentication was provided, but the authenticated user is not permitted to perform the requested operation.

->check if your user have all necessary permissions

The operation is forbidden to all users. For example, requests for a directory listing return code 403 when directory listing has been disabled.

->check the settings from your webserver.

Upvotes: 1

Related Questions