![]() |
![]() |
![]() |
![]() |
![]() |
• Oracle SALT adds features that enable Web Applications to run in Oracle Tuxedo and be accessed easily through HTTP server plug-ins. Using HTTP servers such as Apache 2, Oracle HTTP Server and iPlanet, you can directly expose applications to the World Wide Web. HTTP servers must use Oracle Tuxedo-specific plug-ins (referred to as mod_tuxedo) that translates HTTP requests into Oracle Tuxedo requests, and translates Oracle Tuxedo responses into HTTP responses.
Note: On HP platforms, plug-in libraries must be built with multi-threading enabled via the compiler -mt flag because the GWWS system server is a multi-threaded program.While mod_tuxedo provides the Oracle Tuxedo client part of Web requests serving, on the Oracle Tuxedo side one of the methods of processing the requests is to access them directly. This is permitted by documenting the format of the received buffer, which is an Oracle Tuxedo FML32 typed buffer.The relevant elements of an HTTP request are exposed (Method name, Query string URL, File name, POST data, etc.). As well as the return data to mod_tuxedo (HTTP Response Headers (if necessary), HTML document).
• An Apache2 or OHS process is configured to handle certain URLs using the mod_tuxedo module.
• mod_tuxedo intercepts the request.
• mod_tuxedo formats the request and sends it to an Oracle Tuxedo service, which name is derived from the SCRIPT_NAME value. In the examples that follow, the service in question is named TUXSVC.
•
• PATH_INFO may contain the resource accessed. In this example, it contains "/1234". The program can parse this value according to a documented convention between client and server to obtain the account number.
• QUERY_STRING or POST_DATA (for GET or POST) may contain additional parameters. Pre-determined conventions govern what the parameters look like and what they contain. This is determined by service developers and published as application documentation so client programs can be developed to communicate with these services.
•
•
•
• mod_tuxedo sends the response back to the client program.Listing 3‑1 Configure OHS or Apache2 (httpd.conf excerpt)Listing 3‑2 Oracle Tuxedo ServiceRequest URL: http://myhost/ACCOUNT/1234
Note: Listing 3‑3 XML ResponseListing 3‑4 JSON ResponseSimilar to how PHP applications can run inside the WEBHNDLR Oracle Tuxedo System Server, Oracle SALT allows writing applications for the Web in Python.Unlike PHP (where all scripts are designed to run in a CGI-like model), Python require running using a specific Web layer.The following sections describe how to configure WEBHNDLR to run Python WSGI applications (including using the Django framework).
•
• Python must be built with shared-libraries enabled. This is usually the case for out-of-the-box installations. If you are building from source, the --enable-shared options must be used in the configure step.Listing 3‑5 WSGI Application ExampleAny Python WSGI application may run inside the WEBHNDLR System Server by performing the following steps:
1. Configure Apache (or OHS) to forward requests to WEBHNDLR. This may require additional configuration to indicate the path to necessary static files (for example, images, CSS stylesheets or javascript files).
2. Add the application path to the PYTHONPATH environment variable.
3. Set APP_CONFIG for WEBHNDLR to load the application or middleware handler (for frameworks like Django).Listing 3‑6 shows an Apache configuration for a WSGI application example.Listing 3‑6 Stand-Alone Script/Application ExampleThe ubbconfig file and setting for a standalone WSGI application are located in a script named test_app.py (==module), in the /media/src/tests directory (PYTHONPATH must contain /media/src/tests):Before booting WEBHNDLR, you must either
•
• For an Apache Django-based application you must note the RewriteEngine rules and Alias. These are there to indicate the location of static files (for example, CSS, images or javascript), and also map the root URL to the application (see last RewriteRule) as shown in Listing 3‑7.Listing 3‑7 Django-Based ApplicationThe environment variable DJANGO_SETTINGS_MODULE must be set before booting WEBHNDLR. For example, for an application named mysite:The PYTHONPATH setting for a Django example, called mysite and located in the /media/src/test_django directory:Before booting WEBHNDLR, you must either:
• set APP_CONFIG to django.core.handlers.wsgi (WSGIHandler) ('export APP_CONFIG="django.core.handlers.wsgi (WSGIHandler)"' on Unix), or
• Similar to how PHP applications can run inside the WEBHNDLR Oracle Tuxedo System Server, Oracle SALT allows writing applications for the Web in Ruby.Unlike PHP (where all scripts are designed to run in a CGI-like model), Ruby requires running using a specific Web layer.There is an equivalent to WSGI (called Rack), which is done in the form of a library that installs separately. In Ruby, although applications may be written on top of Rack directly, complete application frameworks are available such as Rails. A rack application is an interface between application and servers for Ruby (similar to WSGI). It is usually installed as an add-on to the language, and is a pre-requisite to application server environments such as Rails. The sections below describe how to configure WEBHNDLR to run Ruby Rack-conformant applications, including using the Rails framework.
•
• Ruby must be built with shared-libraries enabled. This is usually the case for out-of-the-box installations. If building from source the '--enable-shared' options must be used in the configuration.Listing 3‑8 shows a simple Rack application example.Listing 3‑8 Simple Rack Application ExampleThe script in Listing 3‑8 is passed to the handler using a RackUp script that allows adding more functionality (such as pretty exceptions, LINT wrappers, etc.) to the application.Listing 3‑9 RackUp Script ExampleAny Ruby Rack-compliant application may run inside the WEBHNDLR system server by performing the following steps:
1. Configure Apache (or OHS) to forward requests to WEBHNDLR. This may require additional configuration to indicate the path to necessary static files (for example, CSS stylesheets or javascript files).
2. Configure WEBHNDLR to load the application or middleware handler (for frameworks like Rails).Listing 3‑10 shows an Apache (or OHS) configuration example.Listing 3‑10 Apache (or OHS) Configuration ExampleThe ubbconfig file WEBHNDLR setting is as follows:Set APP_CONFIG.For an Apache (or OHS) configuration, you must note e the RewriteEngine rules and AddHandler directive (as opposed to SetHandler). These are there to re-direct the HTTP server to static files (CSS, images, javascript, etc.) as shown in Listing 3‑11.Listing 3‑11 Ruby Rails ApplicationThe ubbconfig file WEBHNDLR setting (assuming the Rails application has been set up in the /media/src/rails_test directory and is named RailsTest) is as follows:Before booting WEBHNDLR, you must either:
• set APP_CONFIG to path to rack up script ('export APP_CONFIG=" /media/src/rails_test/config.ru"' on Unix), or use an ENVFILE with the value APP_CONFIG=" /media/src/rails_test/config.ru".PHP scripts are directly supported by WEBHNDLR and no specific changes are required for applications to run in an Oracle Tuxedo environment. Configuring the location of PHP scripts in the HTTP server is sufficient. Once the framework is configured to run PHP scripts in WEBHNDLR, PHP applications are automatically supported.
• PHP scripts are directly supported by WEBHNDLR; no specific changes are required for applications to run in an Oracle Tuxedo environment. Configuring the location of PHP scripts in the HTTP server is sufficient. Once the framework is configured to run PHP scripts in WEBHNDLR, PHP applications are automatically supported.Place a script named "test.php" (as shown in Listing 3‑12) in the document root folder of the HTTP server:Listing 3‑12 test. php ScriptPoint your browser to: http://<your_host>:<port>/test.php.