- Alfredo Santibanez
- PowerBuilder
- Tuesday, 18 February 2020 05:24 PM UTC
Hi,
I am having an issue with an specific web-service GET, that seems to return me results from a cache, unless I exit from PB dev enviroment or close the application.
The process to make the call looks normal to others I use and follows most PB samples, code is included bellow.
On the same computer, using POSTMAN the web-service returns a new result each time. Finding more values in this tool, I found that it adds more headers, called "temporary headers" autogenerated, but including them made no changes.
The first time is executed after initialization app or PB then getallResponseHeaders, returns content type, transfer encoding and date/time, plus the correct Body. All subsequent calls only returns only conten type and transfer encoding, no date/time and always the first Body. It will only change after a new start of the PB or the application.
Any idea of what is happening and how to correct it? Some more headers?
I can be a problem with the web-service, but works on Postman.
Best Regards
Alfredo
CODE:
try
loo_xmlhttp = CREATE oleobject
loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP.6.0")
// loo_xmlhttp.ConnectToNewObject("Msxml2.XMLHTTP")
loo_xmlhttp.open("GET", requestendpoint, false)
loo_xmlHTTP.setRequestHeader("Content-Type","application/x-www-form-urlencoded")
loo_xmlHTTP.setRequestHeader("Authorization",authorization)
loo_xmlHTTP.setRequestHeader("correlationId",referencia)
loo_xmlHTTP.setRequestHeader("posId",posid)
loo_xmlHTTP.setRequestHeader("merchantId",merchantid)
loo_xmlHTTP.setRequestHeader("Accept","*/*") //postman autogenerated
loo_xmlHTTP.setRequestHeader("Cache-Control","no-cache") //postman autogenerated
loo_xmlHTTP.setRequestHeader("Connection","keep-alive") //postman autogenerated
loo_xmlhttp.send()
ls_status_text = loo_xmlhttp.StatusText
ll_status_code = loo_xmlhttp.Status
ls_html = loo_xmlhttp.getAllResponseHeaders()
// ls_html =string( loo_xmlhttp.ResponseBody(),EncodingUTF8!)
// ls_html = loo_xmlhttp.responseText
if ll_status_code<>200 then
destroy loo_xmlhttp
return -1
end if
catch (OLERuntimeError oer)
MessageBox("OLE Error", Oer.GetMessage())
catch (runtimeerror er)
MessageBox("Runtime Error", er.GetMessage())
CATCH (Throwable lth_exception)
MessageBox("T Error", lth_exception.GetMessage())
FINALLY
loo_xmlhttp.DisconnectObject()
destroy loo_xmlhttp
end try
Find Questions by Tag
Helpful?
If a reply or comment is helpful for you, please don’t hesitate to click the Helpful button. This action is further confirmation of their invaluable contribution to the Appeon Community.