XML Application on a Unix Server
by Zuzana Kolduková
- Zuzana is from the Czech republic. She studied
mathematics and informatic at Charles University in Prague. Now she is an
analyst and developer.
This article explains how we used XML
and XSL to allow our users to run applications viewed in HTML, from a Unix
server. This architechure is very similar to a SOAP implementation,
except that we used our own message calls between the front end
and the server.
The architechure's backend used an Informix database stored on a
Unix server.
Originally we developed a client-server application running on Unix.
Each user runs the Unix applications via our Unix terminal emulation on their PC.
We
then decided to move over to an intranet applications based on the ASP technology. Due
to Unix not supporting ASP, we programmed our own modules and the application servers (cgi programs running on
Unix).
Each
user runs the applications from his PC by calling the URL address of the ASP pages (these
pages were saved on the Unix server).
We developed the intranet
applications, which communicates with the XML application servers, which are scgi programs running on
the Unix system.
Before I continue, the following diagram outlines the
architechure we used:
The application's principle
Unix server contents:
- HTML
- xsl
- css
- js
- scgi programs (the so called "XML application servers")
- informix database
Web server on the Unix server
The web server is on the
Unix server and
the user calls the HTML page from IE5.
This page is displayed with a form binding to some XML data. The user chooses one of the actions from the menu of the displayed
HTML.
The javascript function that generates the "communication XML structure" (the so-called
"XMLforsever") is executed . The instance of XMLHTTP object is created. This object sends
"XMLforserver" to receiver - XML application server - via the web server.
The XML application server (scgi program running on the Unix) gets structure
"XMLforserver" to its standard input, handles it via the classes for the work with
XML, and stores "XMLforserver" structure to own objects.
The content of "XMLforserver" says to the XML application server which operation to execute, which parameters to use.
XML application server executes specified operation (the format of output for each operation has
XML application server encoded inside) and generates new XML communication
structure("XMLforclient"). This structure contents result type of operation, retrieved data
and message for user .
The structure "XMLforclient" goes back to the HTML page via XMLHTTP object
again. Then the javascript function analyses
content of retrieved structure (via XMLDOM objects) and runs corresponding
xsl transformations to display result of action chosen by user.
Example code
Communication with xml application server Input data:
("xmlforserver")
For each operation on the server the xml structure from the
client:
Structure:
<?xml version="1.0"
encoding="windows-1250"?> <FOR_SERVER>
<OPERATION> the name of
operation [| the name of operation]*
</OPERATION>
<DATA> [<the name of xml
structure> xml structure </the name of xml
structure] </DATA>
</FOR_SERVER> |
For each operation tags OPERATION and
DATA have another content
Output data: ("xmlforclient")
|
For each operation on the server server generate xml
structure for client:
Structure:
<?xml version="1.0" encoding="windows-1250"?>
<FOR_CLIENT>
<RESULT_TYPE>[ERROR|OK|DATA|NO_DATA]</RESULT_TYPE>
<MESSAGE>message for user</ MESSAGE > <DATA>
[<the name of xml structure>xml
structure< /the name of xml structure
>]*
</DATA> </FOR_CLIENT> |
|