Previous Topic: CM DLLNext Topic: Calling the COM Proxy from a Web Server


Executing the VB and ASP Sample Code

The VB generated code has sections for:

To use the generated code fragment in a VB program, make sure to reference the <component>1.0 Type Library in the VB project or the VB code fragment does not compile properly. If the <component>1.0 Type Library does not appear in the VB project reference dialog, make sure that the <component>ax.dll and the <component>cm.dll DLLs are properly registered. The generated VB code fragment file has a name based upon the procedure step name with a .bas extension.

Of the two generated client codes, the ASP client code is the most useful. This generated code contains an HTML form with HTML fields for each import attribute (all fields are TEXT fields except for text attributes with permitted values which are SELECT fields) and a SUBMIT button containing the label Run Procedure Step for each procedure step of a component.

When you enter data into the form and click the Run button, the data is posted to the web server using an HTTP POST. At the server, the generated ASP file calls the COM Proxy by first initializing import properties to values passed in the HTTP POST and then calling the COM Proxy Execute method.

If an error occurs with the Execute method call, the generated ASP file displays the HTTP formatted error message. Otherwise, it displays the operation's exports in a similar way to the import's form except for the fact that the export's form fields are non-editable. There are several ASP files created for a component. These files are listed as follows:

Note: With IIS, to share the generated ASP files directory, right click the directory in Explorer and choose properties, then select the Internet tab and click Add. Type a virtual directory alias, select read and execute access (ASP files need execute access to work properly), and click OK twice.

Neither the VB nor ASP generated client code files make any reference to COM Proxy common properties ClientId, ClientPassword, CommandSent, ExitStateSent, Location, CommandReturned, ExitStateReturned, and ComCfg. If required, you can modify the generated code to refer these properties.