#1 2016-04-16 05:47:05

igors233
Member
Registered: 2012-09-10
Posts: 234

Returning binary files (pdf) from interface based service

Hi,

I'm working with SMS as a client and trying to implement download as pdf (for example invoice as pdf)/
I've created an interface based service that returns pdf (uses TServiceCustomAnswer) and it works, data is returned, but browser doesn't recognize it as a file.
I believe problem is that browser requires file to be received via GET method but code in SynCrossPlatformREST only uses POST when working with services.

Solution I have for now is to use method based service since that would be called via GET but I would like to avoid methods, if possible, since interfaces are more flexible. AFAIK services can be called via GET from Delphi Client, but it would be good to have that flexibility for cross platform clients (SMS), are there perhaps plans to implement it or is there some other (inteface based) solution?


Thanks,
Igor

Offline

#2 2016-04-16 07:03:46

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,272
Website

Re: Returning binary files (pdf) from interface based service

AFAIK if you make a GET to the interface URI, the interface based service would execute like with a POST.
You can even embed the input parameters to the URI, as regular GET URI-encoded parameters.

Please check the documentation about routing.
See http://synopse.info/files/html/Synopse% … #TITLE_437

Offline

Board footer

Powered by FluxBB