Hi,
As I understand, the main issue that you can’t specify content type for received file?
these are several ways how to specify content type.
- use GetDispatchInfo. here you can set aTransport.ContentType for specific method:
if aMessage.MessageName = 'GetReport' then
(aTransport as IROHTTPTransport).ContentType := id_ContentType_application_pdf;
- Using OnCustomResponseEvent in a ROSDK Server. After processing, you can use
aResponse.ContentType := id_ContentType_application_pdf;
- use TROHTTPFileDispatcher for receiving pre-generated file. by default, we use
RegisterContentTypeForExtension('.pdf', id_ContentType_application_pdf);
- use HttpAPI and TROHttpApiResult. here you also can specify content type:
[ROServiceMethod]
[ROCustom('HttpApiPath', 'test')]
function TestMethod(): Binary;
...
function TMyService.TestMethod(): Binary;
begin
Result := TROHttpApiResult.Create(HTTP_200_code, id_ContentType_application_pdf,'report.pdf',false);
Result.LoadFromFile('report.pdf');
end;