SAP / PyRFC

Asynchronous, non-blocking SAP NW RFC SDK bindings for Python
http://sap.github.io/PyRFC
Apache License 2.0
500 stars 132 forks source link

Registering Pyrfc-Server does not work #369

Open Nordmaennchen opened 2 months ago

Nordmaennchen commented 2 months ago

Describe the bug Starting from the python server example with registration I was able to connect to the SAP backend, BUT the sample stated zero as the registrationscount. I was also NOT able to ping my RFC-Destination with a conneciton test in SM59. A test with the rfcexec program contained in the sapnwrfc package connected successfully to the backend with the same connection parameters. Pyrfc also connected succesfully to the backend in an RFC-client setup.

To Reproduce Prerequisites: Correctly installed SAP NW RFC SDK and pyrfc a) In SAP Start transaction SM59, create a tcp/ip RFC destination ZCM_TEST with registration with program_id ZCM_TEST b) First try to start the successfull scenario: open a terminal and run the rfexec program located in the bin directory of the nwrfc sdk installation directory: ./rfcexec -a ZCM_TEST -g /H//S/3299/H/ -x 3300

and are the hostnames of your sap-gateway and sap-router. The sap-gateway can also be maintained in sm59, like the gateway service (number after the -x argument). In this example the sap-router is accessible via the port 3299. c) try to connect now with the server program - I tried different settings passing the GWHOST including the saprouter, as well as trying to pass it to the server with the SAPROUTER argument. None of those worked. Here a code snipped ... \# create server server = pyrfc.Server( server_params={ "SERVER_NAME":"ZCM_TEST", "PROGRAM_ID":"ZCM_TEST", \#"SAPROUTER":"/H//S/3299", \#this was option one: saprouter "GWHOST":"/H//S/3299/H/", "GWSERV":"3300"}, \#I used the same client params as with a successfull client test client_params=TEST, }, ) ... I also found out, that the server sample tries to print a server.options - Attribute, that is not contained any more in the Server-class. I therefore assume that there might also be different handling needed, or that there is a bug in the Server-class, or the example is outdated. Thank you for your help. **Screenshots** RFC-Destination ![grafik](https://github.com/SAP/PyRFC/assets/173772703/1d9cad8f-c89e-4897-b06f-341510e06190) Successfull PING after registraction of with rfcexec: ![grafik](https://github.com/SAP/PyRFC/assets/173772703/06494635-01df-4483-a8c8-076cc3c880be) After running the above registration with the VSCode the output of the server-example an registering the function STFC_STRUCTURE: ![grafik](https://github.com/SAP/PyRFC/assets/173772703/0e458ecb-4090-4464-a0fa-fb26fe74961a) This is the output of a print(server.get_server_attributes()) after the server.addfunction and server.start - call and waiting for the key press to stop the server. The connection test then shows: ![grafik](https://github.com/SAP/PyRFC/assets/173772703/f237e40e-b734-4f1e-b6bf-98d4553c6017) A call to STFC_STRUCTURE with destination ZCM_TEST also show a communication error: ![grafik](https://github.com/SAP/PyRFC/assets/173772703/c20e5398-c95d-41e9-9fb0-027b6eacbf02) **Environment** - Mac-OS Sonoma 14.3.1, MacBook Pro M1 Chip 32 GB - Not running in docker - PyRFC version 3.3.1 - SAP Netweaver RFC SDK 7.50.13 - SAP Setup: SAP_Basis release 7.58 SP0001, Connection goes throug a load balancer, saprouter to the SAP. **Additional context** It would be good to have also a sample in pyrfc that has direct connection parameters, because the configuration file containing the parameters for the give destination in the current sample is not provided.