Skip to Main Content

SQL & PL/SQL

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!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

utl_http.begin_request versus utl_http.request

veritasFeb 12 2025

Hello everyone,

On Oracle19, I'm calling some api from a site like this :

select utl_http.request('https://site_name.com/path/v1/api?accessToken=xxxxxxxxxxx',null,'file:/oracle/path/ora_wallet','xxxxx') from dual;

and it works just fine.

Problem occur when I try to do this in a pl/sql block :

....
begin
utl_tcp.close_all_connections;
utl_http.set_wallet('file:/oracle/path/ora_wallet', 'xxxxx');  
l_http_request := utl_http.begin_request(url => l_host_name, method => 'GET', http_version => 'HTTP/1.1');  
utl_http.set_header(l_http_request, 'Content-Type', 'application/json; charset=UTF-8');    
utl_http.set_header(l_http_request, 'Content-Length', LENGTH(l_string_request));    
utl_http.write_text(l_http_request, l_string_request);
l_http_response := UTL_HTTP.get_response(l_http_request);    
DBMS_OUTPUT.put_line('Response> status_code: "' || l_http_response.status_code || '"');    
DBMS_OUTPUT.put_line('Response> reason_phrase: "' ||l_http_response.reason_phrase || '"');    
DBMS_OUTPUT.put_line('Response> http_version: "' ||l_http_response.http_version || '"');     
.....

The server/site answer's is :

Response> status_code: "400"
Response> reason_phrase: "Bad Request"
Response> http_version: "HTTP/1.1"
Response> length: "699"
[00]: <html style="height:100%"><head><META NAME="ROBOTS
[01]: " CONTENT="NOINDEX, NOFOLLOW"><meta name="format-d
[02]: etection" content="telephone=no"><meta name="viewp
[03]: ort" content="initial-scale=1.0"><meta http-equiv=
[04]: "X-UA-Compatible" content="IE=edge,chrome=1"></hea
[05]: d><body style="margin:0px;height:100%"><iframe id=
[06]: "main-iframe" src="/_Incapsula_Resource?CWUDNSAI=2
[07]: 4&xinfo=9-8837669-0%200NNN%20RT%281739378424246%20
[08]: 63%29%20q%28-1%20-1%20-1%20-1%29%20r%280%20-1%29%2
[09]: 0b1&incident_id=0-38992745431434697&edet=3&cinfo=f
[10]: fffffff&pe=1454&rpinfo=0&mth=GET" frameborder=0 wi
[11]: dth="100%" height="100%" marginheight="0px" margin
[12]: width="0px">Request unsuccessful. Incapsula incide
[13]: nt ID: 0-38992745431434697</iframe></body></html>

So the question is how does the utl_http.begin_request differ from utl_http.request with respect to how the site/server is handling the requests it receive ?

Thank you.

This post has been answered by Paulzip on Feb 13 2025
Jump to Answer

Comments

chonewell Nov 12 2024

My Oracle Cloud tenant, cloud account, and secure email have no issues. Why haven't I received my password reset email for Oracle Cloud? This is very strange, and our attempts have not been able to solve the problem. May I ask who I should turn to for help?

L. Fernigrini Nov 12 2024

If your account is a paid one, open a Support ticket.

If it is a Free Tier then you will have to rely on help from the community. Most probable cause that you did not receive the password reset email is that your account has been stolen and the email has been changed.

chonewell Nov 13 2024

Thank you for your reply!
But when I chatted with the online customer service, they told me that my Oracle Cloud tenant, account, and email were all fine. So, there shouldn't be a problem of theft.
I have a free account, but who can I contact on the forum? I can only post, but no one on the forum can view my account permissions, right. I am currently trying to reset MFA, I don't know if it works.
It's quite ridiculous that I have a free account and can't enjoy any services, but how can I become a paid user if I can't log in to my account.

1 - 3

Post Details

Added on Feb 12 2025
4 comments
124 views