The Utl_Http package pre-Oracle9i allowed a basic implementation
of the sending site. It allowed an arbitrarily large response to be handled
piecewise in a PL/SQL VARCHAR2. But it supported just the "GET"
method, i.e. did not support sending arbitrarily large messages in the body
of the request. And it did not support authentication, setting the header
of the request, inspecting the status code and header of the response, or
dealing with cookies. Oracle9i adds support for all these (including optionally
fetching the response "as is" into a PL/SQL RAW), and beyond that
provides full support for the semantics that can be expressed via HTTP. For
example, persistent HTTP connections are now supported. Use of these gives
dramatic speed and scalabilty improvement for applications that repeatedly
and frequently make HTTP requests to the same site. And users now have full
control over the encoding
of character data.
HTTP relies on an underlying transport layer. Thus the Utl_Http package
(written in PL/SQL) is implemented on top of the Utl_Tcp package. (The
Utl_Smtp package for sending email from the database is the same.)
Pre-Oracle9i, Utl_Tcp was implemented in Java. At Oracle9i
it has been reimplemented natively, i.e. in C directly on top of the
socket layer to improve its performance.
The code sample shows how to model the
message sender at SQL*Plus, and can be used to inspect the return status and
content of an arbitrary password protected URL.
A code sample implementing both the sending site and the receiving site in
a complete self-contained B2B simulation presented here