The following code returns a timeout message even though we receive a valid response from the API sandbox.
Any idea why we would get a timeout when the httpapi_debug.txt file shows we received a valid response?
Our RtnValue contains blanks after the timeout.
Marvin
-----------------------------------------------------
Url = 'https://apitest.test.com/payments/';
Payload = 'some confidential information';
http_debug(*on);
http_setAuth(HTTP_AUTH_NONE: '': '');
http_xproc(HTTP_POINT_ADDL_HEADER: %paddr(#AddHeaders));
http_setOption('timeout': '10');
http_setOption('debug-level': '2');
RtnValue = http_string('POST': Url: %trimr(Payload): 'application/json');
-----------------------------------------------------
This line of code times out even though the httpapi_debug file in the IFS show we received a response;
Httpapi service program
8852 if %parms >= 3 and %addr(SendStr) <> *null;
8853 rc = http_req(Type: URL: *omit: Output: *omit: SendStr: ct );
------------------------------------------------------
http_debug.txt
2024-05-24-15.10.19.155035: senddoc(): entered
2024-05-24-15.10.19.155061: senddoc(): data left=548, chunk size=548, timeout=10, calling comm_blockWrite...
2024-05-24-15.10.19.155085: CommSSL_BlockWrite(): gsk_secure_soc_write socket fd=2, flags=00000084, blocking=0
2024-05-24-15.10.19.155120: CommSSL_BlockWrite(): gsk_secure_soc_write rc=0, len=548
{"clientReferenceInformation":{"code":"test_payment"},"processingInformation":{"commerceIndicator":"internet"},"orderInformation":{"billTo":{"firstName":"John","lastName":"Doe","address1":"1 Market St","postalCode":"94105","locality":"san francisco","administrativeArea":"CA","country":"US","phoneNumber":"","company":"Visa","email":"test@test.com"},"amountDetails":{"totalAmount":"102.21","currency":"USD"}},"paymentInformation":{"card":{"expirationYear":"2031","number":1","securityCode":"123","expirationMonth":"12"}}}
2024-05-24-15.10.19.155152: senddoc(): comm_blockWrite returned 548
2024-05-24-15.10.19.155175: recvresp(): entered
2024-05-24-15.10.19.155202: recvresp: reading response header, space left=32767
2024-05-24-15.10.29.185271: SetError() #43: CommSSL_read: timeout!
http_string is timing out
Re: http_string is timing out
I mistakenly thought that the httpapi_debug.txt file was displaying the response, but it was actually just displaying the request body.
We've updated the library to version 1.49 and we still get the same timeout error.
The error happens on this line of code in COMMSSLR4:
0006.23 c eval rc = poll( pfd: 1: peTimeout * 1000)
We've updated the library to version 1.49 and we still get the same timeout error.
The error happens on this line of code in COMMSSLR4:
0006.23 c eval rc = poll( pfd: 1: peTimeout * 1000)
-
- Site Admin
- Posts: 872
- Joined: Sun Jul 04, 2021 5:12 am
Re: http_string is timing out
You have written an "additional header" callback. Is it possible that you wrote that incorrectly? This is a common reason for a timeout.
Re: http_string is timing out
You are right. There was a mistake in the additional header callback. I didn't put a CRLF in between each header, which was the cause of the problem. Thanks!