I am consuming a REST API from PowerBuilder 2019 R2. For this I use the HttpClient class.
When running the API from Posman, Insomnia and SoapUI the response is immediate (thousandths of a second)
However, when I run it from PowerBuilder, at best it takes 10 seconds and many times over 60 seconds and the app freezes.
inv_httpClient.ClearRequestHeaders()
// Establecer propiedades en el Header
inv_HttpClient.SetRequestHeader("Content-Type", "application/json; charset=UTF-8")
inv_httpClient.setRequestHeader( "Authorization", "Bearer" + " " + is_accessToken)
inv_HttpClient.SetRequestHeader("Content-Length", String(ll_contentLength))
inv_httpClient.Timeout = 10
lt_begin = now()
// Ejecutar el request
li_rc = inv_httpClient.sendRequest( "POST",ls_URL,lblb_data)
lt_end = now()
IF li_rc <> 1 THEN
of_setMessage( of_getErrorHttp( li_rc ))
RETURN -1
END IF
The problem occurs when running from the sources and from the executable and I have even tried with PB 2017 R3.
As a test, I have created a WebService in Java from which I run the API and returns an XML that I collect via SOAP from PowerBuilder and with this the response improves considerably and the screen does not freeze. However, bringing this scenario to production implies having a Glassfish or Tomcat web server, deploying the service, etc. and it is not viable; so I have to look for a solution to slow when executing the HttpClient.sendRequest. If you have had a similar problem I will appreciate your recommendations.
Gracias
The tests were performed with Postman, Insomnia and SoapUI on the same PowerBuilder development machine.
I have disabled the "Automatically detect settings" checkbox in the proxy settings and thus the response is fast, just like Posman (does not exceed 1 second). This test was done on two computers and the response was satisfactory; however, on a third machine, speed did not depend on this configuration.
At the moment, until finding the source of the problem, it has been decided to create an intermediate Web Service and in this way the response is quick and does not depend on the proxy configuration.
Thank you very much, I will inform if I find any other alternative.
Jorge
Thanks for your confirmation.
It seems that this issue relates to the proxy configuration of your environment.
We look forward to hearing back from you!