【问题标题】:Siebel COM interface - PythonSiebel COM 接口 - Python
【发布时间】:2017-06-20 06:14:58
【问题描述】:

我被要求探索访问 Siebel COM 接口的各种方法,以便评估可能的最佳解决方案。

到目前为止,我们已经能够通过 Excel (VBA) 和 PHP 访问 COM 接口,现在我需要探索在 Python 中是否可以这样做。根据我最初的研究,我知道 python 确实提供了使用 win32 api 对 DLL 的访问,但没有全面的教程可供我入门。

下面是我们用于 excel 和 php 的代码 sn-ps。

Excel sn-p::

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;
}
}

?>

谁能帮我用示例 sn-p for python 来完成同样的事情,即创建连接? 谢谢

【问题讨论】:

    标签: python-2.7 com siebel


    【解决方案1】:

    了解更多可以参考Python Programming on Win32

    首先你可以试试代码 sn-p

    import win32com.client
    oSiebelApp = win32com.client.Dispatch("SiebelDataControl.SiebelDataControl.1")
    oSiebelApp.Login("Connection String")
    

    【讨论】:

    • 谢谢,我安装了win32库并尝试了代码,它成功了。
    猜你喜欢
    • 2012-08-20
    • 2018-12-21
    • 2016-01-29
    • 2011-02-19
    • 2010-11-22
    • 2020-12-23
    • 2011-02-07
    • 2011-12-09
    • 2011-08-23
    相关资源
    最近更新 更多