Send A Pdf File Through Webstream Using A Cgi Wrapper Webspeed

maretix

Member
Hi to all.
I need to send a PDF File through WEBSTREAM using a CGI Wrapper ...

I work with WebSpeed ... OpendEdge 10.2.B on Windows Server
Our ERP is written in OpenEdge Progress 10.2.B on AIX System ..

I am not an expert in WEBSPEED framework.

In my CGI Wrapper i retrieve PDF File stored in AIX system , running a procedure .p using an APPSERVER that output a temp-table with a BLOB Field.

i.e

....
....
....

define temp-table tt-outpdf no-undo
field file-number AS INTE
field file-date AS DATE
field file-content AS BLOB.

RUN <my_appserver_program> ON hAppSrv ( INPUT NumberInvoice,
INPUT DateInvoice,
OUTPUT TABLE tt-outpdf) NO-ERROR.

Doing that, i obtain PDF File stored in tt-outpdf.file-content field.

Now it is beginning my doubts.
I have so 2 questions ...

1) How can i write 4GL Code to send the content of tt-outpdf.file-content field to WEBSTREAM ???
That is how to send content of PDF File TO WEBSTREAM...
I read of a OUT-LONG include or something like this...
2) In my CGI WRAPPER , what i have to write in OUTPUT HEADER Section.. ???
Ie. OUTPUT-CONTENT-TYPE(" WHAT I HAVE TO SPECIFY ??? ").

Output will be manipulate from a third software company , they ask to me to send the content of a PDF File to webstream.
Never i did something of similar.

Regards in advance.
 

maretix

Member

Hi Stefan ...
Thanks for your kind reply.
I will test as soon as possible your sample.

I have some questions again ...

I have no file PDF in my WEBSPEED Server.
The sample suppose file PDF is on the disk of WEBSPEED Server.
I will retrieve PDF file running a procedure .p through APPSERVER.
(File PDF is on another UNIX Server)

Like i wrote previuosly ,,, i will obtain binary content of it in <table><field> (blob data type).

Then what do you suggest ???

Create a copy of PDF File using a COPY-LOB statement and then try to use your sample...
OR
If i do not want create a copy of PDF ... is it possibile read blob content (MEMPRT Variable) and put in WEBSTREAM ????


Thanks in advance.:):):)
 

maretix

Member
Hi Stefan,
You are right it is what i need ....
I use currently GOOGLE to search PROGRESS KB Articles.
I am newbie of this kind of programs...I only needed an advice.
Thanks a lot !!!

Regards.:):):)
 

maretix

Member
You do know that you can google the progress knowledge base? Start google and enter:

site:knowledgebase.progress.com webspeed download

A more modern article which uses copy-lob etc: Progress KB - How to send CLOB or BLOB objects in a web stream using the WebSpeed

Hi Stefan.
Only today i was able to have time to test that sample ..'How to send CLOB or BLOB objects in a web stream'

I put a file PDF in a directory and i tried to download from a CGI Wrapper...like in the example above.
I obtain message OPEN or SAVE file PDF but with both choices , program writes PDF File empty. (0 kb) !!!
No error i received.
If i try to open with ACROBAT READER source pdf file "C:\Mydir\test\maumar_yvendbo_54441015.pdf" . ... it was opened correctly.
If i try to open output pdf file ,that CGI Wrapper writes in Download folder , ACROBAT READER tell me file corrupted (impossible because source file is correct) or that file was as attachment in a mail (?????)

Where am i wrong ???
Is it this example correct or contains any error ???

/*---------------*/
/* PROGRAM */
/*---------------*/

ASSIGN cDownLoadFileName = "C:\Mydir\test\maumar_yvendbo_54441015.pdf" .

RUN OutputHttpHeader IN web-utilities-hdl ("content-disposition", "attachment~; filename=" + cDownLoadFileName) .
output-content-type ("application/x-download").

DEFINE VARIABLE mObject AS MEMPTR NO-UNDO.


COPY-LOB FILE cDownLoadFileName TO mObject .


{&OUT-LONG} mObject .


SET-SIZE(mObject) = 0 .


I hope you can help to understand.

Regards.
 

Stefan

Well-Known Member
could you add:

Code:
MESSAGE "{&OUT-LONG}".

you can add a reference to the include that defines it by adding

Code:
{ src/web/method/wrap-cgi.i }
 

maretix

Member
could you add:

Code:
MESSAGE "{&OUT-LONG}".

you can add a reference to the include that defines it by adding

Code:
{ src/web/method/wrap-cgi.i }

Good Evening Stefan...
Now it works fine.

I was able to call a procedure on APPSERVER and obtain size and content of bianry file.

Thanks again.;)
 
Top