RAD Studio |  |

Creating multi-tiered applications
Collapse All
Topics

Name | Description
Connecting to the Application Server | To establish and maintain a connection to an application server, a client application uses one or more connection components. You can find these components on the DataSnap or WebServices category of the Tool Palette. Use a connection component to Identify the protocol for communicating with the application server. Each type of connection component represents a different communication protocol. See Choosing a connection protocol for details on the benefits and limitations of the available protocols. Indicate how to locate the server machine. The details of identifying the server machine vary depending on the protocol. See the following topics for details: Specifying... more
Creating Multi-tiered Applications: Overview | A multi-tiered client/server application is partitioned into logical units, called tiers, which run in conjunction on separate machines. Multi-tiered applications share data and communicate with one another over a local-area network or even over the Internet. They provide many benefits, such as centralized business logic and thin client applications. In its simplest form, sometimes called the "three-tiered model," a multi-tiered application is partitioned into thirds: Client application: provides a user interface on the user's machine. Application server: resides in a central networking location accessible to all clients and provides common data services. Remote database server: provides the relational database... more
Connecting to the Server | To locate and connect to the application server, you must first set the properties of the connection component to identify the application server. This process is described in Connecting to the application server. Before opening the connection, any client datasets that use the connection component to communicate with the application server should indicate this by setting their RemoteServer property to specify the connection component. The connection is opened automatically when client datasets try to access the application server. For example, setting the Active property of the client dataset to True opens the connection, as long as the RemoteServer property... more
Advantages of the Multi-tiered Database Model | The multi-tiered database model breaks a database application into logical pieces. The client application can focus on data display and user interactions. Ideally, it knows nothing about how the data is stored or maintained. The application server (middle tier) coordinates and processes requests and updates from multiple clients. It handles all the details of defining datasets and interacting with the database server. The advantages of this multi-tiered model include the following: Encapsulation of business logic in a shared middle tier. Different client applications all access the same middle tier. This allows you to avoid the redundancy (and maintenance cost)... more
Brokering Connections | If you have multiple COM-based servers that your client application can choose from, you can use an Object Broker to locate an available server system. The object broker maintains a list of servers from which the connection component can choose. When the connection component needs to connect to an application server, it asks the Object Broker for a computer name (or IP address, host name, or URL). The broker supplies a name, and the connection component forms a connection. If the supplied name does not work (for example, if the server is down), the broker supplies another name, and so... more
Building a Multi-tiered Application |
Building an InternetExpress Application | The following steps describe one way to build a Web application using InternetExpress. The result is an application that creates HTML pages that let users interact with the data from an application server via a javascript-enabled Web browser. You can also build an InternetExpress application using the Site Express architecture by using the InternetExpress page producer (TInetXPageProducer).
Building Web Applications Using InternetExpress | A client application can request that the application server provide data packets that are coded in XML instead of OleVariants. By combining XML-coded data packets, special javascript libraries of database functions, and the Web server application support, you can create thin client applications that can be accessed using a Web browser that supports javascript. This combination of features is called InternetExpress. Before building an InternetExpress application, you should understand the Web server application architecture and the multi-tiered database architecture. These are described in Creating Internet Server Applications and Creating multi-tiered Applications An InternetExpress application extends the basic Web server... more
Calling Server Interfaces | Applications do not need to call the IAppServer or IAppServerSOAP interface directly because the appropriate calls are made automatically when you use the properties and methods of the client dataset. However, while it is not necessary to work directly with the IAppServer or IAppServerSOAP interface, you may have added your own extensions to the remote data module's interface. When you extend the application server's interface, you need a way to call those extensions using the connection created by your connection component. Unless you are using SOAP, you can do this using the AppServer property of the connection component. AppServer... more
Choosing a Connection Protocol | Each communications protocol you can use to connect your client applications to the application server provides its own unique benefits. Before choosing a protocol, consider how many clients you expect, how you are deploying your application, and future development plans. The following topics describe the unique features for each connection protocol: Using DCOM Connections Using Socket Connections Using Web Connections Using SOAP Connections
Configuring TMTSDataModule | To add a TMTSDataModule component to your application, choose FileNewOther and select Transactional Data Module from the Multitier page of the new items dialog. You will see the Transactional Data Module wizard. You must supply a class name for your remote data module. This is the base name of a descendant of TMTSDataModule that your application creates. It is also the base name of the interface for that class. For example, if you specify the class name MyDataServer, the wizard creates a new unit declaring TMyDataServer, a descendant of TMTSDataModule, which implements IMyDataServer, a... more
Configuring TRemoteDataModule | To add a TRemoteDataModule component to your application, choose FileNewOther and select Remote Data Module from the ActiveX page of the new items dialog. You will see the Remote Data Module wizard. You must supply a class name for your remote data module. This is the base name of a descendant of TRemoteDataModule that your application creates. It is also the base name of the interface for that class. For example, if you specify the class name MyDataServer, the wizard creates a new unit declaring TMyDataServer, a descendant of TRemoteDataModule, which implements IMyDataServer, a... more
Configuring TSOAPDataModule | To add a TSoapDataModule component to your application, choose FileNewOther and select SOAP Server Data Module from the WebServices page of the new items dialog. The SOAP data module wizard appears. You must supply a class name for your SOAP data module. This is the base name of a TSoapDataModule descendantthat your application creates. It is also the base name of the interface for that class. For example, if you specify the class name MyDataServer, the wizard creates a new unit declaring TMyDataServer, a descendant of TSoapDataModule, which implements IMyDataServer, a descendant of... more
Connecting to an Application Server That Uses Multiple Data Modules | If a COM-based application server uses a main "parent" remote data module and several child remote data modules, as described in Using multiple remote data modules, then you need a separate connection component for every remote data module on the application server. Each connection component represents the connection to a single remote data module. While it is possible to have your client application form independent connections to each remote data module on the application server, it is more efficient to use a single connection to the application server that is shared by all the connection components. That is, you... more
Creating an Active Form for the Client Application |
Creating the Application Server | You create an application server very much as you create most database applications. The major difference is that the application server uses a remote data module.
Creating the Client Application | In most regards, creating a multi-tiered client application is similar to creating a two-tiered client that uses a client dataset to cache updates. The major difference is that a multi-tiered client uses a connection component to establish a conduit to the application server.
Creating Web Pages with an InternetExpress Page Producer | Each InternetExpress page producer generates an HTML document that appears in the browsers of your application's clients. If your application includes several separate Web documents, use a separate page producer for each of them. The InternetExpress page producer (TInetXPageProducer) is a special page producer component. As with other page producers, you can assign it as the Producer property of an action item or call it explicitly from an OnAction event handler. For more information about using content producers with action items, see Responding to request messages with action items. The InternetExpress page producer has a default... more
Customizing the InternetExpress Page Producer Template | The template of an InternetExpress page producer is an HTML document with extra embedded tags that your application translates dynamically. Initially, the page producer generates a default template as the value of the HTMLDoc property. This default template has the form
Distributing a Client Application as an ActiveX Control | The multi-tiered database architecture can be combined with ActiveX features to distribute a client application as an ActiveX control. When you distribute your client application as an ActiveX control, create the application server as you would for any other multi-tiered application. When creating the client application, you must use an Active Form as the basis instead of an ordinary form. See Creating an Active Form for the Client Application for details. Once you have built and deployed your client application, it can be accessed from any ActiveX-enabled Web browser on another machine. For a Web browser to successfully launch your... more
Dropping or Changing a Server Connection | A connection component drops a connection to the application server when you set the Connected property to False. free the connection component. A connection object is automatically freed when a user closes the client application. change any of the properties that identify the application server (ServerName, ServerGUID, ComputerName, and so on). Changing these properties allows you to switch among available application servers at runtime. The connection component drops the current connection and establishes a new one. Note: Instead of using a single connection component to switch among available application servers, a client application can instead... more
Extending the Interface of the Application Server | Client applications interact with the application server by creating or connecting to an instance of the remote data module. They use its interface as the basis of all communication with the application server. You can add to your remote data module's interface to provide additional support for your client applications. This interface is a descendant of IAppServer and is created for you automatically by the wizard when you create the remote data module. To add to the remote data module's interface, you can Choose the Add to Interface command from the Edit menu in the IDE. Indicate whether you... more
Granting Permission to Access and Launch the Application Server | Requests from the InternetExpress application appear to the application server as originating from a guest account with the name IUSR_computername, where computername is the name of the system running the Web application. By default, this account does not have access or launch permission for the application server. If you try to use the Web application without granting these permissions, when the Web browser tries to load the requested page it times out with EOLE_ACCESS_ERROR. Note: Because the application server runs under this guest account, it can't be shut down by other accounts. To grant the Web application access and launch... more
Managing Server Connections | The main purpose of connection components is to locate and connect to the application server. Because they manage server connections, you can also use connection components to call the methods of the application server's interface. The following topics describe how to use a connection component for Connecting to the Server. Dropping or Changing a Server Connection. Calling Server Interfaces. Connecting to an Application Server that Uses Multiple Data Modules.
Managing Transactions in Multi-tiered Applications | When client applications apply updates to the application server, the provider component automatically wraps the process of applying updates and resolving errors in a transaction. This transaction is committed if the number of problem records does not exceed the MaxErrors value specified as an argument to the ApplyUpdates method. Otherwise, it is rolled back. In addition, you can add transaction support to your server application by adding a database connection component or managing the transaction directly by sending SQL to the database server. This works the same way that you would manage transactions in a two-tiered application. For more information... more
Overview of a Three-tiered Application | The following numbered steps illustrate a normal sequence of events for a provider-based three-tiered application: A user starts the client application. The client connects to the application server (which can be specified at design time or runtime). If the application server is not already running, it starts. The client receives an IAppServer interface for communicating with the application server. The client requests data from the application server. A client may request all data at once, or may request chunks of data throughout the session (fetch on demand). The application server retrieves the data (first establishing a database connection, if necessary),... more
Pooling Remote Data Modules | Object pooling allows you to create a cache of remote data modules that are shared by their clients, thereby conserving resources. How this works depends on the type of remote data module and on the connection protocol. If you are creating a transactional data module that will be installed to COM+, you can use the COM+ Component Manager to install the application server as a pooled object. Even if you are not using a transactional data module, you can take advantage of object pooling if the connection is formed using TWebConnection. Under this second type of object pooling,... more
Registering the Application Server | Before client applications can locate and use an application server, it must be registered or installed. If the application server uses DCOM, HTTP, or sockets as a communication protocol, it acts as an Automation server and must be registered like any other COM server. For information about registering a COM server, see Registering a COM Object. If you are using a transactional data module, you do not register the application server. Instead, you install it with COM+ or MTS. . When the application server uses SOAP, the application must be a Web Service application. As such, it must be... more
Setting Up the Remote Data Module | When you create the remote data module, you must provide certain information that indicates how it responds to client requests. This information varies, depending on the type of remote data module. See The Structure of the Application Server for information on what type of remote data module you need. The following topics describe how to configure each type of remote data module: Configuring TRemoteDataModule Configuring TMTSDataModule Configuring TSoapDataModule
Setting Web Item Properties | The Web items that you add using the Web page editor are specialized components that generate HTML. Each Web item class is designed to produce a specific control or section of the final HTML document, but a common set of properties influences the appearance of the final HTML. When a Web item represents information from the XML data packet (for example, when it generates a set of field or parameter display controls or a button that manipulates the data), the XMLBroker property associates the Web item with the XML broker that manages the data packet. You can further specify a... more
Specifying a Connection Using HTTP | You can establish a connection to the application server using HTTP from any machine that has a TCP/IP address. Unlike sockets, however, HTTP allows you to take advantage of SSL security and to communicate with a server that is protected behind a firewall. When using HTTP, include a TWebConnection component for connecting to the application server. The Web connection component establishes a connection to the Web server application (httpsrvr.dll), which in turn communicates with the application server. TWebConnection locates httpsrvr.dll using a Uniform Resource Locator (URL). The URL specifies the protocol (http or, if you are using SSL security, https),... more
Specifying a Connection Using DCOM | When using DCOM to communicate with the application server, client applications include a TDCOMConnection component for connecting to the application server. TDCOMConnection uses the ComputerName property to identify the machine on which the server resides. When ComputerName is blank, the DCOM connection component assumes that the application server resides on the client machine or that the application server has a system registry entry. If you do not provide a system registry entry for the application server on the client when using DCOM, and the server resides on a different machine from the client, you must supply ComputerName. Note: Even... more
Specifying a Connection Using SOAP | You can establish a connection to a SOAP application server using the TSoapConnection component. TSoapConnection is very similar to TWebConnection, because it also uses HTTP as a transport protocol. Thus, you can use TSoapConnection from any machine that has a TCP/IP address, and it can take advantage of SSL security and to communicate with a server that is protected by a firewall. The SOAP connection component establishes a connection to a Web Service provider that implements the IAppServerSOAP or IAppServer interface. (The UseSOAPAdapter property specifies which interface it expects the server to support.) If the server implements the IAppServerSOAP... more
Specifying a Connection Using Sockets | You can establish a connection to the application server using sockets from any machine that has a TCP/IP address. This method has the advantage of being applicable to more machines, but does not provide for using any security protocols. When using sockets, include a TSocketConnection component for connecting to the application server. TSocketConnection identifies the server machine using the IP Address or host name of the server system, and the port number of the socket dispatcher program (Scktsrvr.exe) that is running on the server machine. For more information about IP addresses and port values, see Describing sockets. Three properties... more
Supporting Master/detail Relationships | You can create master/detail relationships between client datasets in your client application in the same way you set them up using any table-type dataset. For more information about setting up master/detail relationships in this way, see Creating Master/detail Relationships. However, this approach has two major drawbacks: The detail table must fetch and store all of its records from the application server even though it only uses one detail set at a time. (This problem can be mitigated by using parameters. For more information, see Limiting records with parameters.) It is very difficult to apply updates, because client datasets... more
Supporting State Information in Remote Data Modules | The IAppServer interface, which client datasets use to communicate with providers on the application server, is mostly stateless. When an application is stateless, it does not "remember" anything that happened in previous calls by the client. This stateless quality is useful if you are pooling database connections in a transactional data module, because your application server does not need to distinguish between database connections for persistent information such as record currency. Similarly, this stateless quality is important when you are sharing remote data module instances between many clients, as occurs with just-in-time activation or object pooling. SOAP data modules must... more
The Structure of the Application Server | When you set up and run an application server, it does not establish any connection with client applications. Rather, client applications initiate and maintain the connection. The client application uses a connection component to connect to the application server, and uses the interface of the application server to communicate with a selected provider. All of this happens automatically, without your having to write code to manage incoming requests or supply interfaces. The basis of an application server is a remote data module, which is a specialized data module that supports the IAppServer interface (for application servers that also function as... more
The Structure of the Client Application | To the end user, the client application of a multi-tiered application looks and behaves no differently than a two-tiered application that uses cached updates. User interaction takes place through standard data-aware controls that display data from a TClientDataSet component. For detailed information about using the properties, events, and methods of client datasets, see Using Client Datasets. TClientDataSet fetches data from and applies updates to a provider component, just as in two-tiered applications that use a client dataset with an external provider. For details about providers, see Using Provider Components. For details about client dataset features that facilitate its... more
Understanding Multi-tiered Database Applications | Multi-tiered applications use the components on the DataSnap page, the Data Access page, and possibly the WebServices page of the Tool palette, plus a remote data module that is created by a wizard on the Multitier or WebServices page of the New Items dialog. They are based on the ability of provider components to package data into transportable data packets and handle updates received as transportable delta packets. The components needed for a multi-tiered application are described in the following table: Components used in multi-tiered applications
Using an XML Broker | The XML broker serves two major functions: It fetches XML data packets from the application server and makes them available to the Web Items that generate HTML for the InternetExpress application. It receives updates in the form of XML delta packets from browsers and applies them to the application server.
Using DCOM Connections | DCOM provides the most direct approach to communication, requiring no additional runtime applications on the server. DCOM provides the only approach that lets you use security services when writing a transactional data module. These security services are based on assigning roles to the callers of transactional objects. When using DCOM, DCOM identifies the caller to the system that calls your application server (COM+ or MTS). Therefore, it is possible to accurately determine the role of the caller. When using other protocols, however, there is a runtime executable, separate from the application server, that receives client calls. This runtime executable makes... more
Using Transactional Data Modules | You can write an application server that takes advantage of special services for distributed applications that are supplied by COM+ (under Windows 2000 and later) or MTS (before Windows 2000). To do so, create a transactional data module instead of an ordinary remote data module. When you use a transactional data module, your application can take advantage of the following special services: Security. COM+ (or MTS) provides role-based security for your application server. Clients are assigned roles, which determine how they can access the MTS data module's interface. The MTS data module implements the IsCallerInRole method, which you lets you... more
Using Multiple Remote Data Modules | You may want to structure your application server so that it uses multiple remote data modules. Using multiple remote data modules lets you partition your code, organizing a large application server into multiple units, where each unit is relatively self-contained. Although you can always create multiple remote data modules on the application server that function independently, a special connection component on the DataSnap category of the Tool palette provides support for a model where you have one main "parent" remote data module that dispatches connections from clients to other "child" remote data modules. This model requires that you use a... more
Using SOAP Connections | SOAP is the protocol that underlies the built-in support for Web Service applications. SOAP marshals method calls using an XML encoding. SOAP connections use HTTP as a transport protocol. SOAP connections have the advantage that they work in cross-platform applications because they are supported on both the Windows and Linux. Because SOAP connections use HTTP, they have the same advantages as Web connections: HTTP provides a lowest common denominator that you know is available on all clients, and clients can communicate with an application server that is protected by a "firewall." For more information about using SOAP to distribute applications,... more
Using Socket Connections | TCP/IP Sockets let you create lightweight clients. For example, if you are writing a Web-based client application, you can't be sure that client systems support DCOM. Sockets provide a lowest common denominator that you know will be available for connecting to the application server. For more information about sockets, see Working with Sockets. Instead of instantiating the remote data module directly from the client (as happens with DCOM), sockets use a separate application on the server (ScktSrvr.exe), which accepts client requests and instantiates the remote data module using COM. The connection component on the client and ScktSrvr.exe... more
Using the Javascript Libraries | The HTML pages generated by the InternetExpress components and the Web items they contain make use of several javascript libraries that ship in the source/webmidas directory: Javascript libraries
Using the Web Page Editor | The Web page editor lets you add Web items to your InternetExpress page producer and view the resulting HTML page. Display the Web page editor by double-clicking on a InternetExpress page producer component. Note: You must have Internet Explorer 4 or better installed to use the Web page editor. The top of the Web page editor displays the Web items that generate the HTML document. These Web items are nested, where each type of Web item assembles the HTML generated by its subitems. Different types of items can contain different subitems. On the left, a tree view displays all of... more
Using Web Connections | HTTP lets you create clients that can communicate with an application server that is protected by a firewall. HTTP messages provide controlled access to internal applications so that you can distribute your client applications safely and widely. Like socket connections, HTTP messages provide a lowest common denominator that you know will be available for connecting to the application server. For more information about HTTP messages, see Creating Internet Server Applications Instead of instantiating the remote data module directly from the client (as happens with DCOM), HTTP-based connections use a Web server application on the server (httpsrvr.dll) that accepts client requests... more
Writing Web-based Client Applications | If you want to create Web-based clients for your multi-tiered database application, you must replace the client tier with a special Web application that acts simultaneously as a client to an application server and as a Web server application that is installed with a Web server on the same machine. This architecture is illustrated in the following figure. There are two approaches that you can take to build the Web application: You can combine the multi-tiered database architecture with an ActiveX form to distribute the client application as an ActiveX control. This allows any browser that supports ActiveX to... more

Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
What do you think about this topic? Send feedback!