XPRIM_HttpRequest

This Q&A forum allows users to post and respond to "How Do I Do ....." questions. Please do not use to report (suspected) errors - you must use your regional help desk for this. The information contained in this forum has not been validated by LANSA and, as such, LANSA cannot guarantee the accuracy of the information.
Post Reply
soa
Posts: 289
Joined: Mon Dec 07, 2015 3:15 pm

XPRIM_HttpRequest

Post by soa » Wed Jul 03, 2019 12:22 pm

Hi

I have the following code fragment

#TempFile.CreateTemporaryFile

#Request.Response.AsFile Autodelete(True) Path(#TempFile)

#FileStream.Path := #TempFile

Which all works beautifully but I've noticed my \tmp folder is filling up with files like

QACXCAYX2M
QACXCR5FHZ
QACXC1W4KL
QACXDCA0W2
QACXDKR36C

Which contain the json I'm getting back in my response

Isn't the Autodelete supposed to take care of this or have I missed something?

tsupartono
Posts: 74
Joined: Wed Jan 25, 2017 11:12 am

Re: XPRIM_HttpRequest

Post by tsupartono » Wed Jul 03, 2019 12:48 pm

The original code I provided was not correct - my apology for that.

Providing the path when calling AsFile is the culprit as that stops the auto delete from doing its job.

Can you change the #TempFile type to #PRIM_ALPH

Code: Select all

Define_Com Class(#PRIM_ALPH) Name(#TempFile)
And change the AsFile invocation like so:

Code: Select all

#Request.Response.AsFile Autodelete(True) Result(#TempFile)
That should delete the file when #Request goes out of scope.
Take special care when you are using the file as an output of a web service - as that require to file to live beyond the normal runtime scope.

Post Reply