Make COM extensions cloud-ready with COM Forwarding
Product line
Standard
|Expert
Operating mode
CLOUD ABO
|ON-PREMISES
Modules
Services & CRM
Budget & Phases
Purchases
Resource Planning
Business Intelligence
Some Vertec extensions to third-party programs are based on a Com extension to the third-party system. However, since the connection only works locally, i.e. on the same computer, these extensions are not cloud-ready and can only be used with the Vertec desktop app and therefore only on-premises.
With COM Forwarding we are introducing with Vertec 6.7.0.7 a system with which COM objects of the external system can also be accessed from the cloud app.
For example, COM forwarding objects can be used in the server-side Python code, whose actions are then forwarded to the cloud app and applied there to the actual COM objects of the third-party program.
The functionalities for COM forwarding are included in the module vtccom , which is also available as a Stub File .
The feature vtccom.createobject(<progid>)
returns a COM object that can be used in Python (see example below).
win32com.client
) was created. This corresponds to the previous use of COM objects from Python.Extensions that use COM forwarding also work unchanged in the desktop app.
If you use extensions with COM access to third-party programs in Vertec (other than the standard ones) and want to adapt them to COM forwarding, you need to make the following changes:
The COM objects are called by means of vtccom.createobject(identifier)
instead of win32com.Dispatch
.
To do this, the module vtccom must be imported and the calls changed as follows:
New | Previously |
---|---|
import vtccom self.invoice = vtccom.createobject('ThirdPartyAPI.Invoice') |
from win32com.client import Dispatch self.invoice = Dispatch('ThirdPartyAPI.Invoice') |
import vtccom word = vtccom.createobject("Word.Application") word.Visible = True doc = word.Documents.Add() doc.SaveAs(r"C:\temp\Test Document.docx") |
from win32com.client import Dispatch Word = Dispatch('Word.Application') Word.Visible = True doc = Word.Documents.Add() doc.SaveAs(r"C:\temp\Test Document.docx") |
To ensure backward compatibility, vtccom.createobject()
in the desktop app the original Com object
.
In order for the extensions to work with COM forwarding also with Restricted Scripting , calls to modules such as sys or pywintypes must be extended. Only modules that are on the Whitelist may be used.
Depending on the implementation of the third-party product used (COM Server), incompatibilities may occur with COM Forwarding. In these cases, the COM Server can only be used in the desktop app.
To prevent a script with COM forwarding on the server from running code in the cloud app unnoticed, the client user is asked for permission once each time a COM server is called on the client, and this permission is saved for future calls on the client.
When accessing a COM server via COM Forwarding (call of vtccom.createobject()
) a dialog appears in the cloud app that a server script tries to access this object on the client.
The accounting interfaces with COM Forwarding supplied by us are already stored. Therefore, this query does not come to them even when they are called up for the first time.
The approved COM servers are saved in the registry key HKEY_CURRENT_USER\SOFTWARE\Vertec\ComObjectWhitelist
.