- Martin Eismann
- PowerBuilder
- Tuesday, 11 June 2024 04:06 PM UTC
Dear Appeon Powerbuilder guys,
I'm using PB 2022 (R1) MR 1900 32bit.
During processing the response of a HTTP-POST-Request using a loop, PB crashes unexpectedly during concatenation of the incoming Blob-data.
This is my code:
HTTPClient lrc_DocEngine
//....some code before....
lrc_DocEngine.AutoReadData = FALSE
li_Err = lrc_DocEngine.SendRequest("POST", ls_URL, blb_Multipart)
IF ( li_Err = 1 ) THEN
li_HTTP_Status = lrc_DocEngine.GetResponseStatusCode()
IF (li_HTTP_Status = 200) THEN
TRY
li_rc = 1
DO WHILE (li_rc = 1)
blb_NextData = Blob("")
li_rc = lrc_DocEngine.ReadData(blb_NextData, 1024*16)
blb_RawData += blb_NextData
LOOP
// THIS LINE IS NEVER REACHED
ls_ResponseBody = String(blb_RawData, EncodingUTF8!)
CATCH (RuntimeError lex_Runtime)
// ... does not throw anytime!
FINALLY
END TRY
END IF
END IF
The cought runtime exception does not throw anytime!
So I commented the concatenation and added some code to write the incoming Blob-data into a file, PB DOESN'T crash.
HTTPClient lrc_DocEngine
//....some code before....
lrc_DocEngine.AutoReadData = FALSE
li_Err = lrc_DocEngine.SendRequest("POST", ls_URL, blb_Multipart)
IF ( li_Err = 1 ) THEN
li_HTTP_Status = lrc_DocEngine.GetResponseStatusCode()
IF (li_HTTP_Status = 200) THEN
TRY
ls_Response_Test_File = "C:\TEMP\RESPONSE.DAT"
ll_FileHdl = FileOpen(ls_Response_Test_File, StreamMode!, Write!, LockWrite!, Replace!, EncodingUTF8!)
li_rc = 1
DO WHILE (li_rc = 1)
blb_NextData = Blob("")
li_rc = lrc_DocEngine.ReadData(blb_NextData, 1024*16)
FileWrite(ll_FileHdl, blb_NextData)
//blb_RawData += blb_NextData
LOOP
// THIS LINE WOULD BE REACHED (but blb_RawData is empty here)
ls_ResponseBody = String(blb_RawData, EncodingUTF8!)
CATCH (RuntimeError lex_Runtime)
// ... does not throw anytime!
FINALLY
FileClose(ll_FileHdl)
END TRY
END IF
END IF
The size of the generated file RESPONSE.DAT is approx. ~230 MB.
Does PB 2022 have limitations regarding to Blob size or is there a know issue regarding to concatenation?
Kind Regards
Martin
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.