Timeout occurred while trying to connect to server!

Discussions related to HTTPAPI (An HTTP Client Package for RPG programming.) http://www.scottklement.com/httpapi/
Post Reply
KKT
Posts: 8
Joined: Thu Apr 28, 2022 8:05 am

Timeout occurred while trying to connect to server!

Post by KKT »

Hi,
I am using HTTPAPI Ver 1.42 released 2020-10-12 .
We have a requirement where we need to post information to Azure. For this we are using http_response, also there is an x-functions-key that needs to be passed to connect to server. I am not able to connect to the server getting "Timeout occurred while trying to connect to server! " error. Please find below the code snippet.
Could you please tell me where I am going wrong?

http_debug(*On: '/tmp/httpdebug.txt');

http_xproc( HTTP_POINT_ADDL_HEADER : %paddr(addSpecialHeaders) );

Monitor;
http_response = http_string('POST':Url:P1data:'application/json');
On-Error;
errorMsg = http_error( xErrorNo );
http_comp('Error! xErrorNo: ' + %char(xErrorNo) +
' errorMsg: ' + errorMsg );

EndMon;

PaddSpecialHeaders...
P B
DaddSpecialHeaders...
D PI
D headersToAdd 32767a varying
*

headersToAdd = 'x-functions-key:' + 'uniquekey'
+ CRLF ;

Return;
PaddSpecialHeaders...
P E


Error-log:
************Beginning of data**************
HTTPAPI Ver 1.42 released 2020-10-12
NTLM Ver 1.4.0 released 2014-12-22
OS/400 Ver V7R3M0

http_persist_open(): entered
http_long_ParseURL(): entered
DNS resolver retrans: 2
DNS resolver retry : 2
DNS resolver options: x'00000136'
DNS default domain: XXX.COM
DNS server found: 10.250.1.1
DNS server found: 10.250.2.2
DNS server found: 10.178.200.20
Nagle's algorithm (TCP_NODELAY) disabled.
SetError() #7: Timeout occurred while trying to connect to server!
http_close(): entered
************End of Data********************
Scott Klement
Site Admin
Posts: 635
Joined: Sun Jul 04, 2021 5:12 am

Re: Timeout occurred while trying to connect to server!

Post by Scott Klement »

It is unable to connect.

The most common reason would be that there is a firewall blocking you from connecting out to the Internet.
KKT
Posts: 8
Joined: Thu Apr 28, 2022 8:05 am

Re: Timeout occurred while trying to connect to server!

Post by KKT »

Hi Scott,
Thanks for your response. Because of that we were finally able to figure out that there was a firewall blocking both from IBM and Azure end. Finally we were able to establish the connection.
Post Reply