PyRFC: Connect via mshost (not ashost)

淺唱寂寞╮ 提交于 2019-12-13 08:34:42

问题


I would like to use PyRFC to do remote procedure call on SAP using the Python programming language.

conn = pyrfc.Connection(user='foouser', passwd='xxxx',
    mshost='sap.example.com', sysid='TE1', client='220',
    group='EXAMPLE',
    )

But it fails like this:

RFC_COMMUNICATION_FAILURE (rc=1): key=RFC_COMMUNICATION_FAILURE, message=
ERROR       service 'sapmsTE1' unknown
TIME        Tue Dec 18 15:49:40 2018
RELEASE     753
COMPONENT   NI (network interface)
VERSION     40
RC          -3
MODULE      /bas/753_REL/src/base/ni/niuxi.c
LINE        1833
DETAIL      NiPGetServByName: 'sapmsTE1' not found
SYSTEM CALL getaddrinfo
COUNTER     1
 [MSG: class=, type=, number=, v1-4:=;;;]

What's wrong?

I guess sapmsTE1 gets looked up in /etc/services. But this file is the default (unmodified) file of my linux server.


回答1:


I found the answer myself. You need to supply the parameter "msserv". AFAIK this is a constant value. This worked:

conn = pyrfc.Connection(user='foouser', passwd='xxxx',
    mshost='sap.example.com', sysid='TE1', client='220',
    msserv='3600',
    group='EXAMPLE',
    )


来源:https://stackoverflow.com/questions/53835695/pyrfc-connect-via-mshost-not-ashost

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!