我被要求探索访问Siebel COM接口的各种方法,以便评估可能的最佳解决方案。
到目前为止,我们已经能够通过 Excel (VBA) 和 PHP 访问 COM 接口,现在我需要探索在 Python 中是否可以实现相同的功能。根据我最初的研究,我知道 python 确实提供了使用 win32 api 对 DLL 的访问,但没有全面的教程可供我入门。
下面是我们用于 excel 和 php 的代码片段。
Excel 片段::
Private Function CreateConn(strConnect As String, strEnterprise As String, strPort As String, strPass As String) As Boolean
Dim errCode As Integer
Dim errText As String
Dim SiebelApp As SiebelDataControl
Set SiebelApp = CreateObject("SiebelDataControl.SiebelDataControl.1")
CreateConn = True
SiebelApp.Login "host=""siebel://" & strConnect & ":" & strPort & "/" & strEnterprise & "/EAIObjMgr_enu""", _
"sadmin", strPass
errCode = SiebelApp.GetLastErrCode()
If errCode <> 0 Then
errText = SiebelApp.GetLastErrText
CreateConn = False
Exit Function
PHP 片段::
<?php
function CreateConn($strConnect, $strEnterprise, $strPort, $strPass) {
global $errText;
$SiebelApplication = new COM('SiebelDataControl.SiebelDataControl.1') or die("Unable to instantiate SiebelDataControl");
$ConnStr = "host=\"siebel://".$strConnect.":".$strPort."/".$strEnterprise."/EAIObjMgr_enu\"";
$SiebelApplication->Login($ConnStr, "sadmin", $strPass);
$errCode = $SiebelApplication->GetLastErrCode();
if ($errCode != 0) {
$errText = $SiebelApplication->GetLastErrText();
return false;
} else {
return true;
}
}
?>
有人可以帮我用python的示例片段来完成同样的事情,即创建连接吗?谢谢