Make COM extensions cloud-ready with COM Forwarding
Operating mode
Cloud Suite
|ON-PREMISES
Modules
Services & CRM
Budget & Phases
Purchases
Resource Planning
Business Intelligence
Some Vertec extensions to third-party programs are based on a COM interface to the external 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, as of Vertec 6.7.0.7 there is a system with which COM objects of the external system can also be accessed from the cloud Cloud App.
For example, COM Forwarding objects can be used in the server Python Code side Python code, whose actions are then forwarded to the Cloud App where they are applied to the actual COM objects of the third-party program.
The functionality for COM forwarding is included in the Vertec Python 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
). This corresponds to the previous use of COM objects from Python.Extensions that use COM Forwarding also work in the Desktop App.
If you use third-party COM extensions in Vertec (other than the ones supplied by default) and want to adapt them to COM Forwarding, you need to make the following changes:
The COM objects are invoked using vtccom.createobject(identifier)
instead of win32com.Dispatch
.
To do this, the module vtccom must be imported and the calls must be changed as follows:
As of Vertec 6.7.0.7 | Before |
---|---|
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 backwards compatibility, vtccom.createobject()
called in the Desktop App provides the original COM object.
In order for the extensions with COM Forwarding to work with restricted scripting, calls to modules such as sys or pywintypes must be removed. Only modules that are on the whitelist may be used.
Depending on the implementation of the third-party product used (COM Server), COM Forwarding may cause incompatibilities. In these cases, the COM Server can only be used in the Desktop App.
To prevent a COM Forwarding script on the server from “unnoticed” executing code in the Cloud App, the client user is asked for permission once when a COM server on the client is called, and this permission is saved on the client for future calls.
When accessing a COM server via COM Forwarding (calling 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. This means that this query does not arrive with them even when they are called up for the first time.
The authorized COM servers are saved in the registry key HKEY_CURRENT_USER\SOFTWARE\Vertec\ComObjectWhitelist
.