Chapter 5 Using PowerDynamo with EAServer


EAServer and PowerDynamo architecture

Figure 5-1 demonstrates one scenario in which a Dynamo client connects to EAServer to process a Dynamo script, which contains a Methods As Stored Procedures (MASP) call to an EAServer component.

Figure 5-1: EAServer and Dynamo

These steps correspond to the numbers in the diagram:

  1. A browser requests a Web page. The Web page is a Dynamo script that contains HTML, SQL queries and a MASP call to an EAServer component in that order.
  2. The Web server passes the request to Dynamo.
  3. The script is retrieved from the Web site (not shown in the diagram). Processing of the script begins. The HTML and SQL queries within the Dynamo script are processed.
  4. An ODBC or Open Client connection is made to a database to retrieve the necessary information for the SQL query.
  5. The data is returned to Dynamo. Processing of the script continues until the EAServer component call is encountered.
  6. Because a MASP call is being made, an ODBC or Open Client connection is made to access the EAServer component and the called method.
  7. The component method is executed. If the method requires database access, a connection is made to a database to retrieve the appropriate data.
  8. The data is returned to EAServer through an ODBC, Open Client, or JDBC connection.
  9. The results from the EAServer function are returned to Dynamo through an ODBC or Open Client connection.
  10. Dynamo passes the results, in HTML format, back to the Web server.
  11. The results are passed back to the client through an HTTP connection.

Notes

A Web author can embed calls to EAServer components within a Dynamo script or template. The Dynamo script executes in the regular manner until it encounters the call to the EAServer component. At this point, a connection (through Dynamo) is made to EAServer, the appropriate method is executed, and the results are returned to Dynamo. Dynamo processes the information and returns HTML to the client.

Benefits of using EAServer components with PowerDynamo

You can call EAServer components from within a Dynamo script as though they were stored procedures, Java objects, or ActiveX objects. As long as the client has been set up properly to access the component, you can write Dynamo scripts to use EAServer components as though a stored procedure was being called (referred to as the MASP feature in EAServer), or by creating an instance of a Java or ActiveX object.

The three main benefits to using EAServer components in Dynamo scripts are:

The way in which EAServer components are independently accessible by clients such as Dynamo is advantageous because no restrictions have been put on the way in which the client can manipulate the component results. The component results are wholly controlled by the client which, in the case of Dynamo, is by HTML pages.

The ability to access these components at one central repository is appealing from a setup point of view. Setting up Dynamo to access EAServer components can be as simple as creating a connection to EAServer or installing the ActiveX proxy automation server. For detailed information on setting up clients that require EAServer access, see the EAServer Programmer's Guide.

Calling EAServer components from Dynamo scripts

You can call EAServer components from within a Dynamo script by using:

The SQL tag, COMPONENT tag, and the connection.CreateQuery and connection.CreateComponent methods allow Dynamo to call EAServer components as though they were MASP. Each MASP invocation creates an instance of the component, invokes the method and then destroys the component instance. You can also use the COMPONENT tag to access ActiveX and Java objects--however, just as with MASP, each invocation creates an instance of the component, invokes the method, and then destroys the component instance. The Dynamo CreateObject method allows you to create an instance of an ActiveX object and access its methods and properties from within a script. The ActiveX object exists until it goes out of scope or until the ActiveX variable is assigned a new value. The Dynamo java.CreateComponent method allows you to create an instance of a Java object and access its methods and properties from within a script. The Java object exists until it goes out of scope.

Using MASP verses ActiveX and Java

Within an application, there are a few benefits to creating an instance of an ActiveX (using the CreateObject method) or Java object (using the java.CreateComponent method) against an EAServer component instead of making a MASP method call:

If a script requires repeated use of an EAServer component, the creation of an ActiveX object or Java stub is the preferred method of working with an EAServer component and its methods. ActiveX, however, is a Microsoft technology, which means that it is available only on Microsoft operating systems. Java, on the other hand, is platform-independent, which means that Java objects can run anywhere. For a detailed explanation of MASP, see the EAServer Programmer's Guide.

 


Copyright © 2002 Sybase, Inc. All rights reserved.