Skip to Main Content
  • Questions
  • Accessing HTTPS link from the plsql block

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Joe.

Asked: May 22, 2017 - 5:00 am UTC

Last updated: May 22, 2017 - 8:32 am UTC

Version: 11.2.0.4.7

Viewed 10K+ times! This question is

You Asked

Hello There,

I hope you're doing well.

I'm trying to access a HTTPS link but I'm facing some errors


DECLARE
req UTL_HTTP.REQ;
resp UTL_HTTP.RESP;
name VARCHAR2(256);
value VARCHAR2(1024);
BEGIN
UTL_HTTP.SET_PROXY('proxy.sys.test.uat.com', 'sys.test.uat.com');
req := UTL_HTTP.BEGIN_REQUEST(' https://sys.test.uat.com/yoghu/vicgap/updateStatus.json?id=1000'||'&'||'status=COMPLETED'||'&'||'userId=db' );
resp := UTL_HTTP.GET_RESPONSE(req);
DBMS_OUTPUT.PUT_LINE('HTTP response status code: ' || resp.status_code);
DBMS_OUTPUT.PUT_LINE('HTTP response reason phrase: ' || resp.reason_phrase);

UTL_HTTP.END_RESPONSE(resp);
END;
/

Error report -
ORA-29273: HTTP request failed
ORA-06512: at "SYS.UTL_HTTP", line 1130
ORA-29259: end-of-input reached
ORA-06512: at line 8
29273. 00000 - "HTTP request failed"
*Cause: The UTL_HTTP package failed to execute the HTTP request.
*Action: Use get_detailed_sqlerrm to check the detailed error message.
Fix the error and retry the HTTP request.



and Connor said...

For https, there are a few more setup steps involved.

Tim Hall has a nice writeup on this here

https://oracle-base.com/articles/misc/utl_http-and-ssl


Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library