Nota! 2

Proyectos de AVR en este ejemplo: 2

Programas de AVR en este ejemplo: 3

Páginas de ASP en este ejemplo: 3

La aplicación CLIENTE. 4

Componentes de las Normas de Negocios. 5

Los Proyectos. 6

La Clase. 8

Presentación - un Cliente Sencillo de AVR 13

Corriendo en un ambiente 3-Tier 18

Configurando para procesar 3-Tier en forma distribuida. 20

Una Aplicación 3-Tier. 27

Hagámoslo de nuevo, Pero desde un Navegador! 28

Paso 1 - Crear un sitio web. 28

Paso 2 - Use FrontPage/Dreamweaver para trabajar con archivos ASP's. 31

Paso 3 – Correr la Aplicación Web. 34

Apendice. 36

Appendix 1 – Instalando un Paquete MTS. 36

Appendix 2 – Exportando la aplicación COM+. 39

Appendix 3 – Detección de errores y reportes en el Middle Tier. 40

Appendix 4 - Crear un Sitio Web con PWS. 41

Appendix 5 – Dónde encontrar documentación de VBScript. 42


 

Nota!

Para poder correr este ejemplo como una aplicación Web y/o 3-Tier, debe obtener una licencia de "Datagate Web Server" para la PC que usará como su servidor de su aplicacion web.  Esta documentación asume que usted está usando su propia PC de desarrollo para hacer este ejercicio. Licencias temporales de "Datagate Web Server" pueden ser obtenidas de su Distribuidor Regional de ASNA.

Windows NT y 9X Users:

Las narrativas y diagramas en esta documentación aplican a Windows XP, Internet Information Server (IIS) y FrontPage 2002.  Favor refiérase a Appendix 1…. Para ilustraciones del Personal Web Server y FrontPage 97/2000, refiérase al Appendix.

Microsoft XML Parser

Todos los proyectos de AVR en este ejercicio usan Microsoft XML Parser Version 2.0. Refiérase a este vínculo si desea bajar una versión más reciente en   Microsoft’s Download Center: http://www.microsoft.com/downloads/search.asp. 

Proyectos de AVR en este ejemplo:

Middle_Tier_Component (..\Examples\AVR40\Web\Code) Este compila en un DLL que es la porción de las "reglas de negocios" de el ejemplo.   Su método GET returna el nombre del cliente, dirección, etc, más datos de ventas.  El método UPDATE permite actualizar un simple registro del cliente  El DLL se installa/registra en COM Services (COM+) en un Windows 2K ó servidor XP.

Aplicación_Cliente          (..\Examples\AVR40\Web\Code)  Este es un EXE que consume el DLL creado arriba.   Su propósito es demostrar las differencias entre el modelo Cliente Servidor (cliente gordo) y el modelo 3-Tier (cliente delgado).  También demuestra el uso de Propiedades y XML como medios para transportar datos. 

Aplicación_ClienteServidor (..\Examples\AVR40\Web\Code)  Este es un EXE que ilustra la típica aplicación cliente/servidor con todas sus reglas de negocios contenidas en la Aplicación_Cliente.  Esta es la antitesis del modelo 3-Tier.

             


Programas de AVR en este ejemplo:

Customer.VRC  (..\Examples\AVR40\Web\Code)  Este programa llamado Clase es usado en el  Componente_Middle_Tier.  Debido a que las normas de negocios son las mismas en los dos componentes, es apropiado, en este caso, usar la misma clase en varios componentes.

Métodos:

Get; GET_XML; Update; Update_XML

Propiedades Principales:

XML_Document; WhichDB

 

Nombre, Direccion1, Ciudad, Estado…

CustMaint.VRF  Esta no es una verdadera aplicación cliente ya que su objetivo principal es demostrar las tecnologías.

 

Páginas de ASP (Active Server Page) en este ejemplo:

Cust_Details.asp

(..\Examples\AVR40\Web\ASP)  Active Server Page para

Enter_cust_no.asp

(..\Examples\AVR40\Web\ASP)  Active Server Page para solicitar númeri Cliente.

Cust_Details.asp

(..\Examples\AVR40\Web\ASP)  Active Server Page para mostrar Nombre Cliente, Dirección, etc. y datos de ventas.  Permite que el detalle del cliente sea modificado y actualizado. 

Update_details.asp

(..\Examples\AVR40\Web\ASP)  Active Server Page para actualizar el nombre del cliente, dirección, etc.

Todos los ASP's arriba usan el Middle_Tier.DLL.


La aplicación CLIENTE

Inicie familiarizándose con esta aplicación "ejercicio".  Mediante varias opciones, usted selecciona los métodos de procesos.  En todos los casos, sin importar las opciones, el programa ejecuta exactamente la misma función: obtener la información del cliente y actualizarla.

Cuando usted mira el código, notará que no hay oraciones de DCLDISKFILE (en los F-Specs).  Esto se debe porque todo el manejo de la data es ejecutada por los dos componentes de normas de negocios que referencia:

      DCLFLD  Cust  Type(AVR_3_Tier_40.Customer_Class)  // declarar objeto Middle Tier

Usted puede correr la Aplicacion_Cliente al abrirla de la caja.  Cuando inicie, se verá asi:

Rounded Rectangular Callout: Select “Data Exchange” to instruct the program to use either properties or XML as the mechanism for data presentation from the mddle tier component to the client application.Rounded Rectangular Callout: Select “Data Source” relative to the "server" on which the middle tier DLL is running.  Initially, Middle_Tier.DLL is registered on your mahcine.

 

.

Esencialmente, el usuario pasa el número del cliente como un parámetro del método GET.  Si el cliente es encontrado en el maestro, su nombre, dirección, ciudad, estado, etc. serán puestos dentro de las propiedades de nombre "Name", "Address1", "City", etc.  El archivo histórico de ventas es leído para el cliente seleccionado para desarrollar los totales numéricos como también editarlos.

Notar que las propiedades fueron deliberadamente not nombradas igual a sus nombres de campos del archivo de donde sus datos fueron extraídos (e.g., CMNAME, etc.).  Esto es para que el usaurio (i.e., el programador usando su componente) esté inmune a los métodos que usted pueda seguir para nombrar sus campos y que pueda demostrar la data con nombres sencillos y descriptivos.  (Observe la lista de campos en su archivo de datos, y estará de acuerdo que probablemente no sean sencillos!)

El método UPDATE toma la data presentada por la aplicacion como propiedades y los postea al archivo maestro de clientes. 

Nota.  Este ejercicio no pretende emplear buenas prácticas de procesamiento de datos como chequeo y validación de datos.  El objetivo es enfocarse en los mecanismos de de implementación de 3-Tier y demostrar como difiere del cliente servidor, especialmente en rendimiento.  Esta es una aplicación "sin estado", y debido a esto no existe bloqueo de registro.

 

Componentes de las Normas de Negocios

Middle_Tier Component.VRM

La lógica de negocio usada en este ejercicio es virtualmente la misma en customer.vrc y CustMaint CS.VRF.  La demostración aquí es que sin importar la implementación como Cliente Servidor o 3-Tier, la lógica del negocio es la misma.  Las diferencias entre en Cliente Servidor y 3-Tier son escalabilidad, rendimiento y eficiencia en la red.

La configuración del proyecto para Middle_Tier Component.VRM ordena al IDE a registrar Middle_tier.dll con COM Services (COM+ Application name is “AVR40 Examples”) en la PC donde usted creó el DLL.  Así, cuando Middle_tier.dll fue instalado con el IDE, fue registrado en su PC para que pueda exitósamente abrir el proyecto en el IDE.  La primera vez que usted hace un DLL, será puesto en la aplicación COM+ mencionada antes.

Tome cierto tiempo para entender las propiedades y métodos definidos en customer.vrc. Usted puede enfocarse en XML más tarde, si usted desea, después que haya termidano de armar las piezas.

Veamos estos dos proyectos y luego la clase misma.

 


El Proyecto Middle Tier

Client Component.VRM

Middle Tier Component.VRM

 

Library Name es parte del “Program ID” para cada Clase contenida en este proyecto.

 

 

Note Project Compatibility y directivas de Registration.

 

 

 

 

 

 

 

 

Una “Clase” programa tiene una extensión de VRC.  Es como cualquier programa procedural (e.g., usted notará las especificaciones del archivo).

Sin embargo, el programa "Clase" mismo, tiene una serie de propiedades incluyendo su nombre que, cuando es "prepended" por su nombre de librería produce el Program ID (i.e., AVR_Client_40.CustomerClass; ., AVR_Client_40.CustomerClass).

Finalmente, una Clase es donde usted define Propiedades, Métodos y Eventos.

 

 


La Clase

Rectangular Callout: Database to access is a variable that is set with the WhichDB property.

 

 

 

 

Rectangular Callout: Declaration of the static Properties in this application.

Rectangular Callout: The *GET event is executed when the user assigns the property to another variable, as:
myDB = myobj.WhichDB      or
msgbox msg(myobj.WhichDB)
Rectangular Callout: This is a Property “function” where the *SET event is executed when the user assigns a value to the property.

 

Rectangular Callout: Attributes of each Property declared (optional) provides additional documentation in the Object Browser.

 

 

 

Rectangular Callout: Note: Customer number is passed as parameter.  Usage:
If NOT myObj.Get (myCustno)
	Msgbox “Invalid Cust” etc.
Rectangular Callout: Setting Properties.  Here is where the customer details  form the file are set into the properties.Rectangular Callout: GET Method.  It could have been a BEGSR, but as a Function, it can return True (*ON or TRUE) if successful or False (OFF or *FALSE) if not successful. 

 

 

Rectangular Callout: Get all the sales records and accumulate Sales & Returns 

Rectangular Callout: Note.  The GET subroutine is used internally to fetch the customer details.Rectangular Callout: GET_XML Method.  Same as GET method, except that all the details are returned as a well-formed XML document in the 2nd  parameter.

 

Rectangular Callout: Note.  The developer of the business rules is accountable, as always, for the integrity of the data.  Such tests should be done here and return False if error(s).Rectangular Callout: UPDATE  Method.  Just the Reverse of the GET method: Properties are assigned to the fields and the record is updated.

Rectangular Callout: Note.  Here we execute the Update subroutine to finish up the update process!Rectangular Callout: UPDATE_XML  Method.  It extracts the data passed back and places into the property fields (why not? they are internal variables) so that…

Presentación - un Cliente Sencillo de AVR

La mejor manera de entender la interacción entre la presentación y las normas de negocios es tener que hechar un vistazo a la Client Application.VRM.  Utiliza el componente arriba.  Es un programa normal de AVR, excepto que que no está al tanto de dónde ni cómo la data que solicita es derivada.  Como puede ver, la presentación no es necesariamente el lugar a implementar las normas de negocios.

 

Esto es llamado un “exerciser” porque usted puede seleccionar el uso del componente que desea emplear; aunque use los métodos GET y UPDATE versus los métodos GET_XML y UPDATE_XML; y cual fuente de datos (Data Source)[1] desea emplear.

Cuando el Get Info botón es clicked, el GET o GET_XML metodo es llamado, y porque es una función, retorna True si el cliente es encontrado, else False.  El programa se trata principalmente con el aspecto presentativo de la aplicación sin considerar el lado de procesamiento de datos.  Verá ciertos tipos de "editing" para demostración solamente.

Cuando el UPDATE botón es clicked, cualquier cambio a los campos de entrada son actualizados no por el programador de la presentación, pero por las normas de negocios en el UPDATE o UPDATE_XML Método.

En cualquier momento que usted use el XML data exchange, usted podrá ver el "string" XML haciendo click en el botón “View XML Doc”.

Note que también existe un botón llamado “Release” y un parámetro "*entry" llamado "RelObj".  Estos serán discutidos más adelante.

Algunas notas acerca de Client Application.VRM. :

Rectangular Callout: Note the location tells you which file path that is part of the DLL’s registration.Rectangular Callout: Go to Projects>References.  To use DLLs, you must reference them in the IDE.  Consider it similar to placing an OCX onto the Control Palette.

Rectangular Callout: From the IDE, View>Object Browser brings up the Object Browser.  Any component (Control or Class) can be examined for its members*.
Drop down the list of libraries to select AVR_3_Tier_40.

* "Members" are properties, methods, events  
 

Cloud Callout: Copy ButtonRectangular Callout: When Customer_Class is selected from the list of Classes for the object, the AVR code to declare the object name is presented at the bottom of the object browser which may be copied and pasted into your source.  
Select what you want copied (select nothing to copy all source shown) and use either the copy button or Ctrl+C.
 

 

Rectangular Callout: Cust is the name declared for the 3_Tier class. 
This is an “early bound” object.  Merely reference it in your code and AVR will create the instance of it if not already created.
 

Rectangular Callout: If Data Exchange option is “Properties”, execute Get method, and load details/sales properties into respective fields on form.Rectangular Callout: If Data Exchange option is “XML”, execute Get_XML method, and load details/sales from the XML document into respective fields on form. 

 

Rectangular Callout: Parsing XML is easily done with Microsoft’s XML Parser (MSXML2)

Rectangular Callout: If Data Exchange option is “XML”, modify the XML string from the form’s ioField controls and execute Update_XML method, passing to it the modified XML document.Rectangular Callout: If Data Exchange option is “Properties”, load the properties from the form’s ioField controls and execute Update method,

 

Rectangular Callout: Moving the ioFields’ contents into the original XML document is straightforward using Microsoft’s XML parser.


Corriendo en un Ambiente 3-Tier

Aunque Web es una implementación clásica 3-Tier, no es la única implementación.  A través de un utilitario de Microsoft llamado Distributed Computing Object Model (DCOM) usted puede distribuir este ejemplo como una aplicación 3-Tier.

Aquí es donde usted emplea los Servicios COM de Microsoft’s[2] (MTS en Windows NT).  Primero, dejaremos que el IDE empaque el Middle_Tier.dll en su PC para que usted pueda ver que está pasando: 

Meramente abra el proyecto "Middle_Tier_Component.vrm" en su IDE y corra File > Make Middle_Tier.dll. El IDE empaquetará el componente en una Aplicación nombrada “AVR 40 Examples”.   Usted puede correr "Component Services" y verá ésta aplicación recién creada.  Se verá como la ilustración siguiente:

Rectangular Callout: Select “Status” view.  It will be useful in a moment.

Ahora corra Client Application.exe, pero seleccione 3-Tier como el componente a usar.  Cuando usted haya procesado el primer cliente, heche un vistazo a "Component Services":

Rectangular Callout: 1 object is instanced.  The last “call” executed in 101 mSec.

Ha este punto, usted ha corrido una aplicación 3-Tier donde COM+ está "hosting" el Middle_Tier.dll y no el executable.  Corra otra copia de Client Application.exe (así usted tiene dos procesos al mismo tiempo).  Note la cuenta del objecto es ahora “2” – un objeto es instanciado por cada proceso del cliente.  Ahora haga click en el botón "Release" en la Aplicación Cliente y observe el conteo del objeto bajar.  Esto ilustra como objetos son liberados cuando usted finaliza con ellos – el primer paso para el entendimiento de "escalabilidad".


Configurando para 3-Tier Distributed Processing

Ahora que tiene todas las partes trabajando okay, es tiempo de trabajar con "distributed processing" usando COM+.  Las instrucciones debajo le muestra la instalación de la aplicación "middle tier" en otra PC seguido por la distribución de los programas Aplicación Clientes en una PC diferente.   (Usted puede usar su PC como una de las PCs funcionando como el middle tier server o el cliente.)

Los pasos para distribuir una aplicación 3-Tier son similares a la distribución de una aplicación Client-Server, así que usted podrá ver esto trabajar en un momento.

El poder de 3-Tier sobre client-server es que la lógica de negocios - Middle Tier - es frecuentemente intensiva en aplicaciones comerciales no es ejecutada en cada cliente como suele ser el caso de client-server.  En vez, es ejecutada en un servidor central.  Substancialmente menos datos son pasados por la red (LAN, WAN and Extranet), la cual lo hace más eficiente.   El 3rd Tier – Data Store – es frecuentemente otro Servidor(es) como un AS/400s, y aunque el Middle Tier es un cliente para el servidor de datos, la conexión de red entre éstas máquinas puede ser fácilmente implementada como banda ancha.

Paso 1 – Empacando el Middle Tier en Otro Servidor

Empacando su DLL en otra máquina es un proceso sencillo, y usted pasará sobre estos pasos cuando esté listo para distribuir su propia aplicación Web/3-Tier en su Win 2000 o XP Server ( para NT, vea Appendix 1 – Instalando un paquete MTS).

Iniciar por copiar Middle_Tier.dll[3] a la PC que usará como su middle tier component.  No lo registre.  Próximamente, corra Component Services[4]. 

Rectangular Callout: Drill down to arrive here.
Right mouse click on “COM+ Applications” and select:
New > Application
 

Rectangular Callout: After starting the Wizard, click here to create an empty application.

 

Rectangular Callout: Be certain “Server Application” is selected.Rectangular Callout: Give the Application a unique name.

Rectangular Callout: Running as logged-on-user is okay when running on your machine. 
However, when running in production on a server, you should run a under a specific user, as often there is no ‘logged on” user on most servers.

 

Rectangular Callout: Drill down into your new application and select “Components”.  As you can see, there are none at this time.
Right mouse click and from the pop-up menu, select New > Component.  This will launch the Component Install Wizard.

Rectangular Callout: Because the component is not registered on this machine, this is the option to choose.

 

Rectangular Callout: Select your DLL(s) to install into the Application

Rectangular Callout: The wizard confirms that you have installed a valid COM object.  
Click on Next if finished, else you can Add additional components to the Application.

 

Usuarios XP :  Cuando empaque un componente desarrollado en AVR con COM+, el siguiente diálogo erróneo es mostrado.  Click OK para continuar, y el paquete procederá correctamente.

 

Rectangular Callout: COM+ won’t allow this component to be packaged into any other application, so any executable served by this machine that instantiates this object will execute an instance of this component.Rectangular Callout: Click here for Status View

 

Cuando usted quiera cargar nuevas versiones de su middle tier components, favor recuerde que los archivos pueden estar en uso. Por ejemplo, siempre y cuando existan cualquier número de objetos instanciados – aún “zero” – el DLL es considerado en uso y no puede ser reemplazado.  Para reemplazar el DLL, utilize Component Services para “shut down” la aplicación antes que reemplaze el DLL, y de nuevo desde Component Services usted “refresca” los componentes.

Paso 2 – Exportando la aplicación COM

Although Middle Tier.DLL is not executed on the client machine, like any other ActiveX component, it still must be registered on the client.  Part of the information stored in the registry for a component is where the component is located and which machine will execute it.  Component Services provides a function that creates an installation package that becomes part of your overall deployment package for the client.  (MTS also provides this service.  The differences are revealed below.)

Beginning with Component Services:

 

Rectangular Callout: Right click on the Application and select Export from the pop-up menu.
This launches the Export wizard.

Rectangular Callout: You may need to select this option to create an export to Operating Systems prior to Windows XP.  Rectangular Callout: Be sure to select Application proxy.
Click Browse or enter path and file name for the installation.

Rectangular Callout: If you clicked Browse above, this is the dialog to instruct the wizard where to output the installation files.

 

Rectangular Callout: Be sure to deploy both .MSI and .MSI.cab files.

You can copy these files to the client machine, then run the MSI file.  Alternatively, you can use Explorer to point to the MSI file on the server and run at the client.  In any case, the installation of the middle tier components is complete.

What now remains is to install the AVR deployment on the client PC and to copy “Test Middle Tier.exe” to the client machine.  Once that step is completed, you are ready to run your 3-Tier application!

Notes about MTS on Windows NT and executing MSI Files on 9X and NT

The process of exporting the middle tier application is about the same on NT as it was above.  The greatest difference is that MTS creates an installation that is an EXE file.  This EXE can be run on any Windows machine, including Win2000 and Win XP.

The MSI file created by Component Services is a Microsoft Installer file that is associated with the Windows Installer engine on the target computer.  Windows 2000 and XP include this engine, so all you need to do to run an MSI on these machines is to double-click it  from Explorer.

Windows Installer is not native to prior Windows machines, but you can download installations of the Windows Installer Runtimes for Win 9X and Win NT from Microsoft.  Search the Microsoft Downloads using the keywords “Windows Installer Runtime”.  Install the runtime on the client machine and you are ready to run MSI files.

A 3-Tier Application

Now back to the client machine where you have installed AVR deployment[5]; Client Application.exe; the COM+ export; and optionally[6], Client_Component.dll and MiscCtls.OCX.

It will make it easier to experiment with this example if you would make a desktop shortcut for Client Application.exe.  Now, run the application program.  You may even want to run the EXE several times concurrently.  While the test EXEs are running, you can run Component Services at the server[7].  There you will see there is an instance of the component running for each Client Application.exe that is requesting the component.  For example:

 

In the scenario above, if you had, say, 500 users running executables that use this component, you would theoretically see 500 objects activated!  Such a load on the processor would be impractical, if not intolerable.

The correct way to use a middle tier component is to “release” it when you have finished the transaction.  This is called “stateless” processing.  Click the “Release” button on the Text EXEs and you’ll see the object count drop.  Get more customer information and object get activated again and remain so until released.

As you continue to work with 3-Tier application development, you will begin to see the value of running in a stateless mode.  ASNA continues to develop technologies to make this high performance processing readily attainable. 

You now have the basics of 3-Tier application processing, both on the Web and in your network.  New multi-threaded versions of database access with “connection pooling” for the middle tier are now available from ASNA. 

Let’s Do It Again, But From A Browser!

Now that you understand the relationship between the client and the business rules component, it’s time to see how this works with a web application using Active Server Pages (ASP).  The following steps apply to Windows 2000/XP Component Services and Internet Services Manager, but you will find a parallel with Microsoft Transaction Server and  Personal Web Server for Windows 9X and NT.

·       Step 1 - Create a Web Site on Machine with AVR40 Examples Package

·       Step 2 - Use FrontPage to work with ASPs

·       Step 3 – Run the Web Application

Step 1 - Create a Web Site

Conduct this step on any machine used to date where you have packaged the Middle Tier.dll. Using Internet Services Manager, create a Virtual Directory referencing the examples Web\ASP folder[8].  You can name the virtual director anything you wish, although this illustration will name it as AVR-Demo.

Rectangular Callout: Right Click on the “root” and select New > Virtual Directory.

Rectangular Callout: “Browse” to easily locate the Directory

 

Rectangular Callout: Accept the default settings

Rectangular Callout: Done!

Rectangular Callout: You now have a web site named “AVR-Demo” containing three Web Pages.
Right click and select “Properties” to setup the default web page.  (Although this step is optional, it makes using the web site easier.)

Rectangular Callout: Click “Add” to enter “enter_cust_no.asp” as one of the default web pages for your web site.  
You can optionally remove the remaining default documents if you wish.

 

Step 2 - Use FrontPage to work with ASPs

This step will help you visualize what’s in an Active Server Page.  You don’t need to change anything.  It’s just important at this stage to see what an ASP looks like.  Start Microsoft FrontPage (2002 used here) and from the drop down menu, select File > Open Web:

 

Rectangular Callout: Navigate to this path.

 

 

Rectangular Callout: Open each page and have a look at what is going on.  The order of processing will be:
enter_cust_no:	User enters customer number  & selects data source
cust_details: 	Display info and enable changes
update_details:	Post changes to file and return
App_Style_Sheet:  Cascading style sheet

 

 

Rectangular Callout: Note the initial values for each of these input fields is ASP script that will write the contents of the named property to the browser! 
(You can also see this in the HTML view below)

Rectangular Callout: Create instance of the “Customer_Class” objectRectangular Callout: GET method used exactly as in AVR  Test_Middle_Tier .exe!

ASP script is displayed in red.  HTML is displayed in blue and black. 

Rectangular Callout: Note how the initial value is set by ASP script that writes the contents of the “Name” property to the browser!

As you can see, the bulk of an ASP page is nothing more than HTML.  See Appendix 5 – Where to Find VBScript Documentation for more information regarding Windows Scripting.
 

Step 3 – Run the Web Application

Now you can use your web browser to run the application.  Note the “web server” is your machine, “LocalHost”.  If you want to run this from another machine’s browser, just substitute “LocalHost” with your machine’s name on the network (e.g., “http://johnspc/avr-demo”).

 

Above is the default web page (enter_cust_no.asp) you had set up earlier in the Web Site’s properties.  You can select which data source to use.

 

This page is accessing the component’s properties similar to Client Application.exe.

Note that the AVR component is unaware that it is being used by AVR or ASP (or VB for that matter).

 

Rectangular Callout: Looking at the component status, you’ll see the count of objects currently instantiated returns to zero and that the time consumed by the last “call” is recorded.
Although you are still running from the Browser, ASP “releases” the object once the page is finished. 
 

 

 

 

 

 

Now, run the Client Application with the 3-Tier option  (..\Examples\AVR40\Web\Code\Client Application.exe).  Note that after you have requested a customer’s information, the new object’s instance continues running.  You can see this more dramatically when you run Client Application two or more times concurrently.  The reason for this is that the AVR program was coded to not release the object between each transaction.  Click the Release button in any of the Test programs and you’ll see the number of objects is reduced.  Click “Get Info” again and the object is re-instanced.

 


Appendix

Appendix 1 – Installing an MTS Package

On Win NT, Microsoft Transaction Server is found in Start > Programs > Windows NT 4.0 Option Pack > Microsoft Transaction Server > Transaction Server Explorer.

Rectangular Callout: Drill down to arrive here.
Select “Packages Installed” then right mouse click.  Select: New > Package.

Rectangular Callout: After starting the Wizard, click here to create an empty application.

 

Rectangular Callout: Complete as shown.

Rectangular Callout: Running as logged-on user is okay when running on your machine.
However, when running in production, you should run under a specific user, as often there is no “logged on” user on most servers.

Rectangular Callout: Drill down into your package and select Components.  
Then right mouse click and from the pop-up menu, select New > Component.  This launches the Component Install Wizard.

Rectangular Callout: Because the component is not registered on this machine, this is the option to choose.

 

Rectangular Callout: Click Add Files to find the DLL you are installing.
In this case, the file is our Middle Tier.dll example.

Rectangular Callout: Your component is now installed within the AVR40 Examples package.


 

Appendix 2 – Exporting the COM Application

 

The same packaging rules apply here as with COM+ on Windows 2000 and XP, except that MTS will create an EXE rather than MSI file.

 

Rectangular Callout: The setup exe is contained in the “clients” folder.
Run MyMiddleTier.exe on the client to install reference to the components in AVR40 Examples package.


 

Appendix 3 – Middle Tier Error Detection and Reporting

When running the Business Rules on the Middle Tier Server, consideration must be taken with regard to err handling and reporting.  Imagine your middle tier application  stopping on a runtime error or a message box.  Usually there’s nobody at the server to respond to errors.  Web users would finally time out waiting for runtime error dialogs to be handled by an operator.

AVR works in tandem with Windows XP, 2000 and NT Servers by automatically responding to runtime dialogs and message boxes – provided you check the “no user interaction” option for the DLL’s project settings, as shown below.

 

Rectangular Callout: No User Interaction
Be certain this is checked.

 

When No User Interaction is checked, runtime errors are logged by AVR into a special log file called $$AVRERR.TXT.  Additionally, any use of MSGBOX output in the component will be automatically responded to and logged into $$AVRERR.TXT.  This makes a great application logging or debugging tool.

$$AVRERR.TXT is located in “..\Program Files\Common Files\ASNA Shared”.  Below is an example generated by “Middle Tier.dll”.

Note the last error in the example above was “Database Name not found”.  This is a common error when running on Windows NT or when running under a specific user for whom the database names were not created (refer to COM+/MTS “Set Application Identity).

For more information, refer to related articles ASNA Knowledge base:

http://support.asna.com/kb/acceler8db/kb000021.asp

http://support.asna.com/kb/acceler8db/kb000182.asp

http://support.asna.com/kb/generic/kb000166.asp

 

Appendix 4 - Create a Web Site with PWS

Using Personal Web Server, create a Virtual Directory referencing the examples Web\ASP folder.  You can name the virtual director anything you wish, although this illustration will name it as AVR-Demo.

 

Rectangular Callout: Select “Advanced”

Rectangular Callout: Select Home.  Click Add button.

Rectangular Callout: “Browse” to easily select the Directory

Rectangular Callout: Add “enter_cust_no.asp” to list of Default Documents

 

Appendix 5 – Where to Find VBScript Documentation

As of the date this document was published, the download link for VBScript documentation is:

 http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/vtoriVBScript.asp

 

You can also locate this page as follows:

 

·       Search for "Visual Basic"

·       Select link for Visual Basic Language Center

·       Select VBScript link

·       Select VBScript Features link

·       Select VBScript Documentation lnk

 

 

 



[1] “ASNA Local DB” refers to the Acceler8DB database installed on any machine where AVR examples are installed.

   “ASNA 400 DB” refers to the iSeries or AS/400 DataGate/400 is installed.  Be sure to update this database name with the correct server name or IP address of  the machine, and a valid user ID and Password.

    “ASNA SQL DB” refers the SQL Server 2000 database to use.  Be sure to update this database name with the correct server name or IP address of  the machine, and a valid user ID and Password.  To attach the Example files library (database) to your SQL Server instance, refer to “How to Install.txt” in the folder:

“..\Program Files\ASNA\Examples\Example Files For SQL Server”

[2] You can confirm you have COM Services on your machine by looking in Control Panel > Administrative Tools > Component Services.

[3] Middle_Tier.dll uses “..\Program Files\Common Files\ASNA Shared\miscctls.ocx” - ASNA Miscellaneous Controls component:.  Be certain to copy this to the server and register it.  Do not include it in the COM+ application.

[4] Control Panel > Administrative Tools > Component Services.

 

[5] When setting up the Database Name for “ASNA 400 DB”, be certain to enable Connection Pooling.

[6] You only need these components if you want to compare Client Server versus Middle Tier performance.

[7] You can also run Com Services for the Server from other machines provided you have sufficient authority.

[8] If you are working with, say, a server, you’ll need to copy the examples folder, ..\Program Files\ASNA\Examples\Avr40\Web\ASP to the server.