SAP / node-rfc

Asynchronous, non-blocking SAP NW RFC SDK bindings for Node.js
Apache License 2.0
251 stars 73 forks source link

Change we change the default port 3300 in the connection parameter #146

Closed guptar85 closed 4 years ago

guptar85 commented 4 years ago

Hello,

My ABAP system has RFC port 3300 open but to secure this we have set up a reverse proxy by which we are routing all the traffic from xxxx port to 3300. I need to know can we change the default port to xxxx so that from outside when we call RFC FM it should work.

Locally when I execute Node-RFC with default host everything works fine but with the proxy rule it didn't.

{ "alive": true, "name": "RfcLibError", "code": 1, "codeString": "RFC_COMMUNICATION_FAILURE", "key": "RFC_COMMUNICATION_FAILURE", "message": "\nLOCATION CPIC (TCP/IP) on local host with Unicode\nERROR partner '0.tcp.ngrok.io:3300' not reached\nTIME Wed May 27 21:38:01 2020\nRELEASE 753\nCOMPONENT NI (network interface)\nVERSION 40\nRC -10\nMODULE D:/depot/bas/753_REL/src/base/ni/nixxi.cpp\nLINE 3449\nDETAIL NiPConnect2: 3.137.63.131:3300\nSYSTEM CALL connect\nERRNO 10060\nERRNO TEXT WSAETIMEDOUT: Connection timed out\nCOUNTER 3" }

My connection parameters are below but seems like there is no parameter called PORT hence giving above error:

// ABAP system RFC connection parameters const abapSystem = { ..... ashost: "0.tcp.ngrok.io", port: "17309", .... };

guptar85 commented 4 years ago

By looking other closed issues I understand the port range can be between 00-99 (using sysnr). But I am looking some other high range port like 17309 (example).

bsrdjan commented 4 years ago

The standard reverse proxy can't redirect SAP NWRFC protocol, you need saprouter.

guptar85 commented 4 years ago

Hi @bsrdjan - Sorry if I misunderstood your answer. My question is within node-rfc library, is there any way I can customize the PORT number (say 17309) before making an RFC call to ABAP server. From sysnr field the PORT can vary from 3300-3399 but is there any possibility to have a customize port (not in above range).

Cheers,

bsrdjan commented 4 years ago

Sorry for misunderstanding. The port can be changed in connection parameters, there is a PORT parameter. The parameters are documented in sapnwrfc.ini file, in the demo folder of SAP NWRFC SDK. See also PyRFC/#79.

guptar85 commented 4 years ago

Thanks @bsrdjan. But unfortunately for me it is not working. I am using Windows where I have updated this file C:\WINDOWS\system32\drivers\etc\services with value sapgw99 17550/tcp.

My connection parameters are:

// ABAP system RFC connection parameters const abapSystem = { user: "DEVELOPER", passwd: "Down1oad", ashost: "0.tcp.ngrok.io", sysnr: "99", client: "001", lang: "EN", };

Below error which I am getting - Still the request is going to 3399 port but not to 17309 (which was configured in services file)

{ "alive": true, "name": "RfcLibError", "code": 1, "codeString": "RFC_COMMUNICATION_FAILURE", "key": "RFC_COMMUNICATION_FAILURE", "message": "\nLOCATION CPIC (TCP/IP) on local host with Unicode\nERROR partner '0.tcp.ngrok.io:3399' not reached\nTIME Thu May 28 19:44:33 2020\nRELEASE 753\nCOMPONENT NI (network interface)\nVERSION 40\nRC -10\nMODULE D:/depot/bas/753_REL/src/base/ni/nixxi.cpp\nLINE 3449\nDETAIL NiPConnect2: 3.17.202.129:3399\nSYSTEM CALL connect\nERRNO 10060\nERRNO TEXT WSAETIMEDOUT: Connection timed out\nCOUNTER 6" }

Thanks,

bsrdjan commented 4 years ago

If C:\WINDOWS\system32\drivers\etc\services are properly adapted, then the port 17550 should be selected, with the parameters you are using.

If the error message regarding 3399 still occurs, there could be two reasons:

1) In etc/services there is still 3399 (ie. did not save correctly, etc.) Note: to change etc/services you need Administrator rights. You can for example start a CMD shell with "Run as Administrator" and use the Notepad from there

2) Python process has not yet been restarted after changing the etc/services. (The operating system already cached hosts and services for a period of time.) Python restart might help the process see the changed value.

If none of this helps, try instead of sysnr = 99, to enter the port directly: gwserv = 17550, should always work.

guptar85 commented 4 years ago

Thanks @bsrdjan for your help. gwserv parameter works.

vishalshingate commented 10 months ago

I can't change the connection string that is a parameter(gwserv ). Is there any way to do this? I have tried to do it by changing it to etc/services file sapdp70 3600/tcp, but it's not working for me.

bsrdjan commented 7 months ago

Hello @vishalshingate,

connection parameters depend on ABAP backend system configuration. in SAP NW RFC SDK include folder there is sapnwrfc.ini file ($SAPNWRFC_HOME/include/sapnwrfc.ini). It contains connection parameters' examples for various ABAP system configuration. Can you check with ABAP system admin which connection parameters combination should work in your case?