Hi,
I'd need to implement a REST service that generates a pdf file and send it back to the web browser.
Besides, I want the browser to show the pdf file in a viewer. So it's not a direct download.
I'm currently working on Developer Studio 11.7.1.
My attemps were unsuccesful. The browser show the pdf viewer but the file can not be read.
The pdf file generation is done. The file is valid and readable via pdf viewer. Then I tried to use the URI resource editor so that my GET service returns the pdf file with the following properties:
HTTP headers:
I also played with Content-Encoding and Content-Disposition.
HTTP body:
I did the base64 conversion because OpenEdge does not support blob objects as an output of a business entity method.
I'm afraid that base64 conversion is the culprit.
Is there a way to achieve it properly on progress server side or do I need to embed the result in a JSON and let the client decrypts the file ?
Thanks for your help.
Best regards
Thank you David for the quick reply !
I'll try to implement this solution today.
Thierry
The "legacy" $DLC/servlet/rest with the OE AppServer can be hotwired to run XML, whether it can do PDF I don't know... but...
But once you have a WAR look for:
/TOMCAT/webapps/MyServiceName/WEB-INF/adapters/MyServiceName.paar (that's just a ZIP)
inside you'll have a resourceModel.xml
<?xml version="1.0" encoding="UTF-8"?>
<prgs:model xmlns:prgs="www.progress.com/.../prgrs" id="resourceModel">
<prgs:resource consumes="application/json" name="_OrderEnquiry" path="/OrderEnquiry" produces="application/json">
<prgs:operation consumes="application/json" idls="MyServiceName.restoe::com.progress.openedge.pdt.bpmbindings" name="OrderEnquiry..pMain" produces="application/json" verb="POST"/>
</prgs:resource>
</prgs:model>
By default it's JSON this can be changed to XML (100% know that works as we do it) but PDF might be worth testing.
<prgs:resource consumes="application/XML" name="_OrderEnquiry" path="/OrderEnquiry" produces="application/XML">
I manage to do it using a web handler. It works flawlessly.