UTL_HTTP Exceptions → Table 96-5 lists the exceptions that the UTL_HTTP package API can raise. By default, UTL_HTTP … regardless of the setting). Table 96-5 UTL_HTTP Exceptions Exception Error Code Reason Where Raised … illegal_call 29267 The call to UTL_HTTP is illegal at the current state of the HTTP request
UTL_HTTP Examples → The following examples demonstrate how to use UTL_HTTP. Example: Using UTL_HTTP SET serveroutput ON … UTL_HTTP CREATE OR REPLACE FUNCTION save_cookies RETURN BINARY_INTEGER AS cookies utl_http.cookie_table … my_session_id; END; REM Retrieve cookies from UTL_HTTP CREATE OR REPLACE PROCEDURE restore_cookies
96 UTL_HTTP → The UTL_HTTP package makes Hypertext Transfer Protocol (HTTP) callouts from SQL and PL/SQL. You can … use it to access data on the Internet over HTTP. With UTL_HTTP, you can write PL/SQL programs that … communicate with Web (HTTP) servers. UTL_HTTP also contains a function that can be used in SQL … Guide for more information on
UTL_HTTP Flow → The UTL_HTTP package provides access to the HTTP protocol. The API must be called in the order … shown in Figure 96-1, or an exception will be raised. Figure 96-1 Flow of the Core UTL_HTTP Package Text … APIs that manipulate attributes and configurations of the UTL_HTTP package in the current session … retrieve the last detailed
About the UTL_HTTP Package → Package UTL_HTTP allows your PL/SQL programs to make hypertext transfer protocol (HTTP) callouts
UTL_HTTP Exception Conditions → exceptions: create or replace package utl_http is function request (url in varchar2) return varchar2 … RESTRICT_REFERENCES enables display of exceptions: create or replace package utl_http is type html_pieces is
Summary of UTL_HTTP Subprograms → Table 96-6 UTL_HTTP Subprograms--Simple HTTP Fetches in a Single Call Subprogram Description … pieces of the data retrieved from the given URL. Table 96-7 UTL_HTTP Subprograms--Session Settings … cookie support settings SET_FOLLOW_REDIRECT Procedure Sets the maximum number of times UTL_HTTP follows … Sets the UTL_HTTP
UTL_HTTP Constants, Types and Flow → UTL_HTTP Constants Table 96-1 UTL_HTTP Constants Constant and Syntax Purpose HTTP_VERSION_1_0 … ; - HTTP_VERSION_NOT_SUPPORTED CONSTANT PLS_INTEGER:= 505;- UTL_HTTP Types Use the following types with UTL_HTTP. REQ Type Use … private_. The fields are private and are intended for use by implementation of the UTL_HTTP
Pragmas → pragma restrict_references (request, wnds, rnds, wnps, rnps);
Example → SQLPLUS> SELECT utl_http.request('http://www.my-company.com/') FROM dual; UTL_HTTP.REQUEST('HTTP://WWW.MY-COMPANY.COM/') My Company Home Page If you are behind a firewall, include the proxy parameter. For example, from within the Oracle firewall, where there might be a proxy server named www-proxy. my-company.com: SQLPLUS> SELECT utl_http.request('http://www.my-company.com', 'www-proxy.us.my-company.com')
Parameters → … When the UTL_HTTP package is executed in the Oracle database server, the wallet is accessed from the
Session Settings → Session settings manipulate the configuration and default behavior of UTL_HTTP when HTTP requests
Parameters → Table 96-18 GET_COOKIE SUPPORT Procedure Parameters Parameter Description enable (OUT) Indicates whether future HTTP requests should support HTTP cookies ( TRUE ) or not ( FALSE ) max_cookies (OUT) Indicates the maximum total number of cookies maintained in the current session max_cookies_per_site (OUT) Indicates the maximum number of cookies maintained in the current session for each Web site
Parameters → set to NULL, UTL_HTTP uses the latest HTTP protocol version that it supports to send the request. The
Syntax → UTL_HTTP.set_persistent_conn_support( r IN OUT NOCOPY req, enable IN BOOLEAN DEFAULT FALSE);
WRITE_TEXT Procedure → This procedure writes some text data in the HTTP request body. As soon as some data is sent as the HTTP request body, the HTTP request headers section is completed. Text data is automatically converted from the database character set to the request body character set.
Usage Notes → before the chunk is sent. UTL_HTTP performs chunked transfer-encoding on the request body transparently … HTTP 1.1 chunked transfer-encoding format, where UTL_HTTP handles the length of the chunks transparently.
WRITE_RAW Procedure → This procedure writes some binary data in the HTTP request body. As soon as some data is sent as the HTTP request body, the HTTP request headers section is completed.
Parameters → Table 96-43 GET_RESPONSE Procedure Parameters Parameter Description r (IN/OUT) The HTTP response