ObjectStore Active Toolkit Tutorial

Chapter 6

Using ATK ActiveX Server from DCOM

Introduction
If you are developing a distributed web application that uses ActiveX controls, you can use Distributed COM (DCOM) to access them and query a particular ATK ActiveX Server. For example, the ATK grid control has a Server property with which you can specify the ActiveX server host machine.

By working with a remote ATK ActiveX server, you can build applications that can display data from remote ObjectStore databases without direct access to an ObjectStore client. For example, you can use the ATK ActiveX grid control to display an ObjectStore data view even if no ObjectStore client or server is running on your local machine, and the ObjectStore database is not directly reachable from your machine.

Software requirements
To complete the exercises in this chapter, you need these software resources:
ResourceWhere to Find It
Database

\odi\ATK6.0\Examples\demodbs\
carsdemo.db


ActiveX grid control

\odi\ATK6.0\bin\ATKCtrls.ocx

Internet Explorer Version 4.0 or later

http://www.microsoft.com

Microsoft Front Page Version 2.0 or later

http://www.microsoft.com



In this chapter
In this chapter, you configure DCOM and test its remote connection between an ATK ActiveX grid control and an ATK ActiveX server. This chapter contains the following sample exercises:
ExerciseDescription
Create an HTML Page Using the ATK Grid Control

Create an HTML page containing an ATK ActiveX grid control, and write a script that loads the control with data. Run the application locally.

Access the Page Remotely

Access the page from a remote client.

Create an HTML Page Using the ATK Grid Control

Overview

In this exercise, you create an HTML page that contains an ActiveX grid control. Then you write a script that queries the ATK ActiveX server and loads the ATK ActiveX grid control with data.

Process

To create this application, follow these steps:

  • Create an HTML page that contains an ActiveX control.
  • Write a script that loads the ATK grid control with data.
  • Test the application.

    1 Create an HTML page that contains an ActiveX control.

  • Using FrontPage, create a new, blank HTML page. (This page is displayed in Microsoft Explorer.)
  • Insert an ActiveX control by clicking Insert | Advanced | Active X Control on the menu bar. The ActiveX Control Properties dialog box appears.

  • Select the ObjectStore ATK Grid Control from the list of available ActiveX controls.

  • Set the control Name to ATKGrid, and edit the control properties.
  • Modify these three property values:
          Database = c:\odi\ATK6.0\Examples\demodbs\carsdemo.db
    
          DataView = work-table-simple
    
          Server = PC-SERVER
    
    where

    Database is the complete path of the ObjectStore database you want to inspect, relative to the server machine.

    DataView is the name of the data view you want to display inside the ATK grid control, and work-table-simple is the data view defined as an example in the carsdemo database shipped with ATK.

    Server is the name of the machine where the ATK ActiveX kernel is running, such as PC-SERVER.

  • Click OK to create the control and close the Properties dialog box.

    2 Write a script that loads the ATK grid control with data.

    Write a small script that instructs the ATK grid control to load its content whenever the HTML page is loaded.

  • In FrontPage, select Insert | Advanced | Script from the menu bar.
  • In the Script box, enter this code:
          Sub window_onLoad()
    
                ATKGrid Reload
    
          End Sub 

    ATKGrid exposes the Reload method, which connects the ActiveX control to the specified server and fills the control's cells with the contents of the specified data view. Internet Explorer executes the window_onLoad() procedure automatically whenever the HTML page is loaded.

  • Select OK.
  • Save the new page in the InetPub\ASPSamp\ATK\Tutorial6 directory as tut_ocx1.htm.

    3 Test the application.

    If you stored this page on the PC-SERVER machine (the same specified in the Server property of the ATK grid control), you can open it from a server running on PC-SERVER. Because the page and server are on the same machine (that is, everything runs locally), there is no need to configure DCOM.

  • Open the URL http://localhost/ASPSamp/ATK/Tutorial6/tut_ocx1.htm.

    Access the Page Remotely

    Overview

    You can access the same HTML page that contains an ActiveX control and resides on a server, such as PC-SERVER, remotely from a client machine, such as PC-CLIENT. This exercise shows you one way to do this.

    Prerequisite
    In order to access an HTML page from a client machine, the client must have the ATK ActiveX controls installed. This option is available in the ATK installation.

    Process

    To create this application, follow these steps:

  • Check the DCOM configuration of the server.
  • Test the application.

    1 Check the DCOM configuration of the server.

  • From the Start menu, run the Windows DCOM configuration utility, dcomcnfg. The Distributed COM Configuration Properties dialog box appears.

  • On the Applications sheet, select the ATKKer.Document application (that is, the ID that identifies the ATK ActiveX server), and click the Properties button to view and edit the DCOM settings of the ATK ActiveX server. The ATKKer Document Properties dialog box appears.

  • Click the Identity tab and specify the user account that remotely runs the ATK ActiveX server. The default is the launching user, which means that the user who is running the remote client must also have an account on the server machine. Use this setting when you are developing an Intranet application, and there is a Windows NT server that handles all the user accounts.

    You can also enter a specific client user account, or make ATK ActiveX server run as the user who is currently logged on to the server.

    In this exercise, run the ATK ActiveX server using a launching user account.

  • Click the Security tab and customize the access, launch, and configuration permissions of the ATK ActiveX server.

  • Click OK to use the default settings and to return to the Distributed COM Configuration Properties dialog box.
  • Click the Default Properties tab and set the default properties for DCOM on the server.

  • Select the Connect authentication level and the Impersonate impersonation level to provide acceptable security, and click on OK.
  • Click the Default Security tab and specify which users can remotely access and launch the ActiveX servers on your server machine.

  • Verify that the Everyone user account is included in both the Default Access Permissions and Default Launch Permissions: Click the Edit Default button to display the Registry Value Permissions dialog box

  • Click OK to exit from the DCOM configuration utility on the PC-SERVER.

    2 Test the application.

    Connect to the PC-SERVER ATK ActiveX server from the PC-CLIENT workstation.

    Open the URL http://pc-server/ASPSamp/ATK/Tutorial6/tut_ocx1.htm.

    Remote access provides the same result as local access:

    Summary

    In this chapter, you built an HTML page containing an ATK ActiveX control, and set up your server machine to make the ATK ActiveX server remotely accessible by means of DCOM.

    The source code for the HTML page described in this chapter is located in \ATK\Examples\Tutorial6\tut_ocx1.htm.


    Copyright © 1998 Object Design, Inc. All rights reserved.

    Updated: 05/11/99 12:01:50