SAS IOM Bridge with Python

377 Views Asked by At

I'm making a connection to a remote SAS Workspace Server using IOM Bridge:

import win32com.client

objFactory = win32com.client.Dispatch("SASObjectManager.ObjectFactoryMulti2")

objServerDef = win32com.client.Dispatch("SASObjectManager.ServerDef")
objServerDef.MachineDNSName = "servername"
objServerDef.Port = 8591    # workspace server port
objServerDef.Protocol = 2   # 2 = IOM protocol
objServerDef.BridgeSecurityPackage = "Username/Password"
objServerDef.ClassIdentifier = "workspace server id"

objSAS = objFactory.CreateObjectByServer("SASApp", True, objServerDef, "uid", "pw")

program = "ods listing;proc means data=sashelp.cars mean mode min max; run;"

objSAS.LanguageService.Submit(program)

_list = objSAS.LanguageService.FlushList(999999)
print(_list)

log = objSAS.LanguageService.FlushLog(999999)
print(log)

objSAS.Close()

It work fine. But I cant seem to find the right attribut for CreateObjectByServer, when trying with a Stored Process Server (when I change 'Port' and 'ClassIdentifier'):

import win32com.client

objFactory = win32com.client.Dispatch("SASObjectManager.ObjectFactoryMulti2")

objServerDef = win32com.client.Dispatch("SASObjectManager.ServerDef")
objServerDef.MachineDNSName = "servername"
objServerDef.Port = 8601    # stored process server port
objServerDef.Protocol = 2   # 2 = IOM protocol
objServerDef.BridgeSecurityPackage = "Username/Password"
objServerDef.ClassIdentifier = "stp server id"

objSAS = objFactory.CreateObjectByServer("SASApp", True, objServerDef, "uid", "pw")

objSAS.StoredProcessService.Repository("path", "stp", "params")

_list = objSAS.LanguageService.FlushList(999999)
print(_list)

log = objSAS.LanguageService.FlushLog(999999)
print(log)

objSAS.Close()

When trying the above I get:

AttributeError: CreateObjectByServer.StoredProcessService

I cant seem to find much documentation IOM to Stored Process Servers. Anyone got any suggestions?

0

There are 0 best solutions below