Notes
Outline
Simple Example of a Web-based Interface to Ada Programs
Richard Conn
12 September 1999
Views
Premise
The Big Picture (Client Side/Server Side)
What You Have to Create
Setting Up the Ada Data Server
Ada Source Code (4 slides)
Web Page HTML Code (2 slides)
Before the Form’s SUBMIT Button is Pressed
Fill Out the Form
After the Form’s SUBMIT Button is Pressed
Message Received After Data Sent
Interpreting the Data
References
Premise
The Big Picture
Client Side
A form written in HTML is filled in by the user
When the SUBMIT button on the form is pressed, the data on the form is encoded and sent to the data server on the Web Server
Server Side
The Web Server receives the URL of the Data Server and launches it as a normal program, passing the encoded data onto it via standard input (if the POST method is used on the Client Side) or the command line (if the GET method is used on the Client Side)
What You Have to Create
Setting Up the Ada Data Server
Copy the Ada Source Code to the Computer Hosting the Web Server and Place it into a Common Gateway Interface (CGI) Binary Directory (BIN)
Compile the Ada Source Code (it has to run on this machine)
Edit the HTML in the Web page, changing the ACTION attribute of the FORM tag to contain the URL of the compiled Ada program
You are DONE!  You can now load the Web page into any client that can access the Web Server
Ada Source Code, 1 of 4
Ada Source Code, 2 of 4
Ada Source Code, 3 of 4
Ada Source Code, 4 of 4
Web Page HTML Code, 1 of 2
Web Page HTML Code, 2 of 2
Before the Form’s SUBMIT Button is Pressed
Fill Out the Form
After the Form’s SUBMIT Button is Pressed
Message Received After Data Sent
Interpreting the Data
The encoded data consists of ASCII characters as follows:
Normal characters (e.g., A, B, C, 1, 2)
The = sign (used to separate the name and the value from a name=value pair)
The & symbol (used to separate one name=value pair from another)
A hexadecimal value for the form %xx, where xx is a 2-character hexadecimal code (e.g., 0D, 1C, AB)
There are at least two approaches to writing Ada packages that do this conversion for you on the ASE CDROM
References
Musciano and Kennedy, HTML: The Definitive Guide, 3rd Edition, O’Reilly, 1998, ISBN 1-56592-492-4 – contains authoritative reference information on forms and encoding types
Ada and Software Engineering Update 2 CDROM, Ada User’s Bookshelf, Walnut Creek CDROM, October 1999, ISBN 1-57176-235-3 – contains Ada95 Reference Manual and Ada95 Packages supporting CGI-BIN Interfaces