Chapter 13: COM Web Programming

Overview

Component Object Model (COM) is a specification developed by Microsoft and used for building software components that can be consumed by programs or existing Windows-based programs to enhance functionality. Using COM, software written in one language (such as C++) can also use software written in another language (such as Visual Basic) without having to recompile either piece of software. This means, for example, that a dynamic-link library (DLL) written in C++ code could be called by an executable written in Visual Basic, or in the case of Active Server Pages (ASP), VBScript could call a function from a COM object written in VB, C++, or any language. COM web programming is accomplished by using ASP to call functions in COM objects.

The D in DCOM stands for distributed. DCOM works the same way as COM from the software construction and consumption perspective, and it differs from COM only in terms of deployment and server configuration. Using DCOM simply means that COM objects hosted on other physical hosts are consumed.

Note 

Consumed, or “to consume,” is the term that is often used when referring to software calling functions in a DLL other type of library. You can view it as an adaptation of the client-server terminology used to describe the interaction with a database client (software that requests data or inputs data) and a database. The terms consumer and provider have become the nomenclature used to describe the software entities that exist in an interaction between software that relies on other software to function and software that is designed to serve other software.

Constrasted to conventional ASP programming (described in Chapter 12), COM web programming uses ASP as a dispatching system. ASP marshals Hypertext Transfer Protocol (HTTP) requests into commands, consumes COM objects that perform work, and returns a response to the client. The advantage of this system is that the software in the COM object is encapsulated as a single discrete entity that may be added or removed from a system as a whole. The software may be coded, tested, documented, and deployed so that other programmers can use the software and not change it, as the source code is not available in the software distribution. Depending on the language that was used to build the COM object, the machine instructions inside are likely to be binary instructions that are executed with greater performance than can be expected with a scripting language such as VBScript in an ASP.

The architecture of a typical COM web application is shown in Figure 13-1.

click to expand
Figure 13-1: COM web application architecture

The most common way that COM web programming is used today is by writing ActiveX DLLs using Visual Basic version 6 (VB6). Although COM objects can be written in many different languages, this chapter will feature the use of VB6. VB6 will compile into a native language binary, and the programmer is totally insulated from the complexities of working with the COM Interface Description Language (IDL) or managing the architecture of the object itself. VB6 is a well-known language, and the VB Integrated Design Environment (IDE) is easy enough to use that anyone can write, compile, and run the program without being very astute in the ways of building software.

Note 

An Active X DLL is a project template in VB6 that allows a programmer to produce a COM object.




IIS 6(c) The Complete Reference
IIS 6: The Complete Reference
ISBN: 0072224959
EAN: 2147483647
Year: 2005
Pages: 193

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net