[stackoverflow] [progress Openedge Abl] Error In Downloading Pdf File From Abl Code

Status
Not open for further replies.
E

Eduardo Silva

Guest
When I run a test with the routine indicated by Progress to download a PDF file, I have the following problem. Some files download correctly, others bring only one part, and therefore the file is invalid.

I did the test with 2 random links, where one of them is correct, and the other one has an error.

Has anyone ever come across this situation?

Reference: http://knowledgebase.progress.com/articles/Article/How-to-download-PDF-files-from-ABL-code

Thanks!

My Code:

/* http://knowledgebase.progress.com/articles/Article/How-to-download-PDF-files-from-ABL-code */
/* Article Number 000080110 */

USING OpenEdge.Core.*.
USING OpenEdge.Net.HTTP.*.
USING OpenEdge.Net.HTTP.Lib.ClientLibraryBuilder.

DEFINE VARIABLE oRequest AS IHttpRequest NO-UNDO.
DEFINE VARIABLE oResponse AS IHttpResponse NO-UNDO.
DEFINE VARIABLE oRequestBody AS WidgetHandle NO-UNDO.
DEFINE VARIABLE oResponseMemptrEntity AS OpenEdge.Core.Memptr NO-UNDO.
DEFINE VARIABLE oByteBucket AS OpenEdge.Core.ByteBucket NO-UNDO.


/*IT'S OK*/
oRequest = RequestBuilder:GET ("http://www.pdf995.com/samples/pdf.pdf"):Request.
oResponse = ClientBuilder:Build():Client:Execute(oRequest).

oByteBucket = CAST(oResponse:Entity,OpenEdge.Core.ByteBucket).
oResponseMemptrEntity = oByteBucket:GetBytes().

COPY-LOB FROM oResponseMemptrEntity:Value TO FILE "c:\temp\FILE-OK.pdf".



/*IT'S ERROR*/
oRequest = RequestBuilder:GET ("http://www.axmag.com/download/pdfurl-guide.pdf"):Request.
oResponse = ClientBuilder:Build():Client:Execute(oRequest).

oByteBucket = CAST(oResponse:Entity,OpenEdge.Core.ByteBucket).
oResponseMemptrEntity = oByteBucket:GetBytes().

COPY-LOB FROM oResponseMemptrEntity:Value TO FILE "c:\temp\FILE-ERROR.pdf".

Continue reading...
 
Status
Not open for further replies.
Top