Webservice with PDF output

Four Stars

Webservice with PDF output

Hi all,
I need to display a pdf in a browser. The pdf datas are stored in an oracle db (LOB).
Is it possible to achieve this with a REST Service ? I don't see which output type to use...
I'm using 5.1.1 with DI + ESB Edition.

Employee

Re: Webservice with PDF output

You can use the content type: application/pdf.
It may also help to add a Content-Disposition header with "attachment; filename=myfile.pdf".
Four Stars

Re: Webservice with PDF output

Thanks for your answer cschneider, but I didn't understand where I have to setup this content-type in the tRestResponse. Well, I guess I have to load my PDF datas in the body of the response, but how ?
.. I didn't find any example of what the XML answer should looks like.
Highlighted
Four Stars

Re: Webservice with PDF output

Hi cschneider, for your information :
https://jira.talendforge.org/browse/TESB-8351?focusedCommentId=260364&page=com.atlassian.jira.plugin...
Indeed yesterday I tried with 5.2.1 and http headers but I noticed that PDF binary data (Byte[] out from tOracleInput) are not supported by tRESTResponse, the PDF file I get in the browser is empty
Employee

Re: Webservice with PDF output

Hi Sylvain
Yes, tRESTResponse only supports Document & String for now.
Indeed, expanding a list of supported response types (byte[], possibly Object, and may be in the future: InputStream) will help.
Let us think a bit about it.
Cheers, Sergey
Four Stars

Re: Webservice with PDF output

Hi, any update about this feature ?
Employee

Re: Webservice with PDF output

Hi - unfortunately it did not make it into 5.3.1.
This enhancement request was reviewed exactly yesterday :-), I believe byte[] will be supported by tRESTResponse in few weeks time; I'm also positive that byte[] will be supported by tRESTRequest.
Thanks for driving this enhancement request,
Sergey
Employee

Re: Webservice with PDF output

By the way, is it something that is a bit of a blocker for you ?
Dietmar had a workaround idea: get byte[] Base64-encoded in tJavaFlex and link the resulting String to tRESTResponse 'string' field and then get this string Base64-decoded in a browser-hosted script. This of course requires a bit of manual coding, but may help in the short term.
If you do decide to go this route, please check if Talend Studio ships a Base64 encoder, otherwise load it with tLoadLibrary (use the library of your choice).

Cheers, Sergey
Four Stars

Re: Webservice with PDF output

Hi talend team, is this feature included in the 5.3.1 ?

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Talend API Designer – Technical Overview

Take a look at this technical overview video of Talend API Designer

Watch Now

Getting Started with APIs

Find out how to get started with APIs

Read