- Daniel Grenier
- PowerBuilder
- Wednesday, 12 May 2021 08:48 PM UTC
Hello Appeon Community. Been using Powerbuilder for quite some time. Had been using Powerbuilder 12.5 for the past few years and I finally migrated an application to Powerbuilder 2019 R3.
By migrating, I was happy to see that I could use the HTTPCLient object in order to get/download files rather than use third-party programs to access those files.
One of the implementations of HttpClient we do is to read an XML file that's hosted on our website.
Here is the code
HttpClient lnv_HttpClient
lnv_HttpClient = Create HttpClient
lnv_HttpClient.SetRequestHeader("Content-Type", "text/xml;charset=UTF-8")
li_rc = lnv_HttpClient.SendRequest("GET", "https://ouwerbsite.com/Software/Software_update.xml")
IF li_rc = 1 THEN
li_StatusCode = lnv_HttpClient.GetResponseStatusCode()
IF li_StatusCode = 200 THEN
lnv_HttpClient.GetResponseBody(lblb_blob) // Obtain the response data and convert to a blob
ll_file = FileOpen(gs_application_path+"\Updates\Software_update.xml", StreamMode!, Write!, LockWrite!, Replace!)
FileWriteEx(ll_file, lblb_blob)
FileClose(ll_file)
RETURN TRUE
ELSE
RETURN FALSE
END IF
ELSE
RETURN FALSE
END IF
As you can see, It's a simple GET request for an XML file that is hosted on our website in that particular Software folder. The weird thing that is happening, is that the data that is downloaded and written into the file locally remains the same even though I change the content of the file on the website.
For example, if the XML file contains the following
<Software_Update>
<Software_Update_row>
<version> 45011 </version>
</Software_Update_row>
</Software_Update>
If I run the code above, It will retrieve the data and write the local file exactly as is above. If I change that XML file (let's say I change the version to 45012 instead of 45011) and I upload it to the website (replacing the previous file). If I go ahead and run the same code above, it will still write the local file with version 45011. It almost feels like Powerbuilder is using some kind of cached data instead of getting the new data from the file. Even if I remove the file completely, it will still download and write that same data.
This is really strange. Anything come to mind? is Powerbuilder using a browser in the background which would leverage cache? Why doesn't it recognize the new values in my file?
Thanks
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.