当我使用Progress指示的例程运行测试以下载PDF文件时,我遇到以下问题。有些文件下载正确,有些文件只带一部分,因此文件无效。
我用2个随机链接进行了测试,其中一个是正确的,另一个是错误的。
有没有人遇到过这种情况?
参考:http://knowledgebase.progress.com/articles/Article/How-to-download-PDF-files-from-ABL-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".
答案 0 :(得分:1)
我在OpenEdge 11.7(64位)上尝试过您的示例代码,它似乎可以下载这两个文件而没有任何问题。
OpenEdge.net.pl已在OpenEdge 11.6服务包中进行了更新。 11.6.3是最近的一个。我建议你尝试升级到11.6.3(OpenEdge 11.6的Service Pack 3)并重试。