Oracle REST Data Services is based on Java EE and was developed as a substitute for other normally used web services options. Since REST Data Services is built on the Java EE, it provides many features by default, among which RESTful web services is the feature we will be concentrating on for this chapter. Oracle REST Data Services can also support deployments using Oracle WebLogic Server, GlassFish Server, Apache Tomcat, and a run in a standalone mode.
The Oracle Application Express installed in our database satisfies some of the requirements for implementing REST Data Services. Oracle REST Data Services simplifies the deployment process because there is no Oracle home required and connectivity is provided using an embedded JDBC driver.
This chapter is written with the assumption that you already have Oracle Apex installed in your machine. The setup steps provided are provided next to create an example that you can delete later on.
The latest release of REST Data Services can be downloaded from http://www.oracle.com/technetwork/developer-tools/rest-data-services/downloads/index.html. Oracle REST Data Services 3.0.2 is the latest release available for you to download and the filename is ords.3.0.2.294.08.40.zip
.
If you are new to Application Express, you can refer to Chapter 11, Working with Application Express.
The preceding diagram briefly shows how a middle tier isolates the database server from the web browser access directly by creating a proxy layer. The middle tier can be a standalone REST Data Service on top of a Tomcat server, which would not require the help of a PL/SQL embedded gateway or mod_plsql
. RESTful services connections are made through the APEX_REST_PUBLIC_USER
user, while invoking PL/SQL Gateway operations, and for the database user APEX_LISTENER
, which is used to query RESTful services definitions stored in Oracle Application Express.
SQL Developer gives us an easy way to install and run REST Data Services. The navigation you need to follow to install REST Data Services is Tools | REST Data Services | Install. The installation wizard takes us through four steps for having the connection creation. The ORDS (Oracle REST Data Service) ords.war
file is used for the installation. In step 2 of the installation process, we will be choosing the option of using the ords.war
file that comes with SQL Developer for installation.
There are a few main ORDS configuration files that require a location for storage, we can specify any available space for keeping all the configuration files in one place.
For example, since we have SQL Developer installed on Windows, we can create a C:ORDS
directory to place all the configuration files during the installation.
Some of the major configuration files and the directory structure are shown in the following:
./ | +-defaults.xml +-apex.properties* +-url-mapping.xml | +conf/ | +-apex.xml +-apex_al.xml +-apex_rt.xml +-apex_pu.xml | ... +-(db-name).xml +-(db-name)_al.xml +-(db-name)_rt.xml +-(db-name)_pu.xml
Oracle REST Data Services includes a web server that enables you to run in standalone mode. Standalone mode is designed for use only in development and test environments, and is not supported for use in production environments. We need to fill in a few details such as HTTP Port, Static Resources Location, Database Connection details, and ORDS Users.
Step 2 of the ORDS installation wizard prompts us for the static resources location and also an option to run ORDS in standalone mode after installation, basically the standalone mode is the production mode where the ORDS services are not in editable mode, which is desirable for the production environments.
Before we proceed with the installation, the summary of the options selected in the wizard screens are displayed and when we click on the Finish button, ORDS progresses. The sample summary of my installation is shown in the following screenshot:
Once the installation of ORDS is complete, we can have two options under the View menu, which are as follows:
If Administration is selected, the REST Data Services Administration window opens, which enables us to add or edit new ORDS connections. How to create new connections is explained in the upcoming sections of this chapter.