A stub compiler for CGI

There are few tools to assist CGI programmers: they must explicitly parse the incoming data stream to extract parameters. This is analogous to CORBA programmers having to write their own unmarshaling routines for servers.

To alleviate this, we have developed a stub compiler for CGI. From a CORBA IDL description of the CGI program it generates a server stub, a client stub and a template HTML form (see figure 2). Currently all CORBA IDL primitives and data types are supported, except the "ANY" data type.

Figure 2: CGI CORBA IDL Compiler here

Server stubs make the job of the CGI programmer easier by unmarshaling the incoming data stream.

Client stubs encapsulate libwww (the underlying library used by many WWW applications) in much the same way as stubs encapsulate the CORBA programmer from the API of the underlying ORB. Consequently, it becomes very easy to write bespoke client applications for CGI services: we have written two line C programs which are CGI clients.

Template HTML forms are supported for the simplest CORBA data types (e.g. strings and longs). Template forms generated by the stub compiler are guaranteed to produce a parameter stream consistent with the CGI server stub generated from the same IDL definition. This helps to ease the problem of keeping an HTML form consistent with its corresponding CGI program. Template forms need to be annotated with text to explain the input fields to humans. As noted above, HTML forms can be thought of as primitive agents, so the stub compiler is generating a template agent.

The programming model provided by the stub compiler is very close to the CORBA programming model. The main difference is that CGI programs are stateless: they are forked for each invocation by the HTTP server. This means that any state change made by the client has to be stored externally (e.g. on the local file system).

Further details of the stub compiler are given in our programmer's guide [EDWARDS 95].


Next

ANSA home page, Introduction, Comparing CORBA and WWW, Integrating third party information services, A stub Compiler for CGI, A stub Compiler for HTTP, An application scenario, Conclusions, Acknowledgements, References


Nigel Edwards <nje@ansa.co.uk>, Owen Rees <rtor@ansa.co.uk>