
Corporate.Net
The Soup's On With Web-Base
d APIs
By Barry Nance
CGI, ISAPI, ICAPI and NSAPI: One cluster combination in this alphabet soup might be too hot, another too cold. Which is the right one to serve your Web guests? Too often, developers choose complicated approaches over simple ones because they suspect something must be wrong with the simple approach. The vendor must have had some reason for
creating the complicated product, right? Spending time and effort on suspected problems (which you later find out never existed) can be costly. "I've known a great many troubles in my lifetime," Mark Twain said. "Fortunately, most of them never happened."
Anticipating a performance problem with a proposed Common Gat
eway Interface (CGI) application, for instance, might push you in the direction of a lower-level interface, such as Microsoft Corp.'s Internet Server Application Programming Interface (ISAPI), IBM Corp.'s Internet Connection API (ICAPI), Netscape Communications Corp.'s Netscape API (NSAPI) or other server APIs. If you're thinking of foregoing CGI in favor of something with a reputation for better performance, here's what you'll need to know before you begin designing your application.
In general, vendors offer a rich set of tools for Web-based development, and the ever-growing array of choices can bewilder even veteran programmers. CGI is prevalent today, but it suffers from a well-deserved reputation for slowness. Java and JavaScript are getting a lot of attention, but they also suffer from the same reputation. ISAPI, NSAPI and ICAPI are competing programming interfaces for connecting directly to a Web server, processing HTML streams inside the Web server and modifying Web server behavior. In each case,
performance (measured in terms of fast response times from a Web server) will always be a key criterion for developers.
We evaluated these interfaces to find out when it's appropriate to use these interfaces, and our testing unearthed som
e interesting conclusions. While basing a computer program on ISAPI, ICAPI or NSAPI rather than tried-and-true CGI can make the program perform better, development costs will be higher, testing will be more rigorous, the risk of crashing the Web server itself will be higher, and the choice of Web server platform will be narrower. On the other hand, server-specific APIs give you the opportunity to perform extra processing steps (during user authentication, for example) within the Web server process.
Key Characteristics
CGI, ISAPI, ICAPI and NSAPI are programming interfaces, rather than development environments or full-fledged programming languages. CGI, available on most Web server platforms, is simpler, more popular, easier to program and safer to use than
ISAPI, ICAPI or NSAPI. With CGI, a Web server launches a computer program, perhaps written in C or Perl, when the user clicks a submit button on a Web page containing an HTML "form" statement.
CGI defines the environment in which the server-launched computer program runs. Identifying information about the user (browser, server or port number, for example), as well as data entered on the form, appear as environment variables and STDIN (standard input stream) file contents to the CGI-based computer program. A CGI program runs as a separate process outside the Web server, and returns data (perhaps a dynamically created Web page) to the Web server via STDOUT (standard output stream).
ISAPI, NSAPI and ICAPI give you direct control over the behavior of the Web server. ISAPI is Microsoft's exposing of functions and services within Microsoft's Internet Information Server (IIS) Web server. NSAPI is Netscape's exposing of functions and services within Netscape Web servers. Similarly, ICAPI is IBM's exposing of
functions and services within IBM's Internet Connection Server product. In every case, you write code the Web server invokes as "user exit routines," or "user hooks." The Web server itself, at certain well-known (published) points during its execut
ion, calls functions within your code. Instead of writing a separate program, you write library functions that act as extensions to the Web server's processing.
|