1
I developed an application made in Web Service REST
, where the data is consumed at each client request, everything works perfectly, I created the Web Service REST
from the DataSnap REST Application
, with this becomes available a form to determine the port I will use, but I had to migrate this application to a Serviço
, the return of the image did not work with the same function that I use in the application of Web Service REST
, I can return the image in png/jpeg
. I created this service from DataSnap Server
, including the library JavaScript
.
I will post the source of how to return the image on Web Service REST
:
oFileStream:= TFileStream.Create(sCaminho, fmOpenRead or fmShareDenyWrite);
try
if oFileStream.Size > 0 then
begin
SetLength(Result, oFileStream.Size);
oFileStream.Read(Pointer(Result)^, oFileStream.Size);
end;
finally
FreeAndNil(oFileStream);
end;
s := CarregarImagem(sCaminho);
GetInvocationMetadata(True).ResponseContentType := 'image/png';
GetInvocationMetadata(True).ResponseCode := 200;
GetInvocationMetadata(True).ResponseContent := s;
GetInvocationMetadata(True).CloseSession := True;
I hope I made myself clear. Hugs!
From what I’ve seen you’re not working with
Encode64
. Try to encrypt the image and make a client to decode.– Andrey
@Andrey, I’ll do it, thanks for the tip
– Jefferson Rudolf
@Andrey, I managed to solve converting the image to Base64 and tested in the Postman application, I will use Base64 because it is the standard when sending images to the customer read and view.
– Jefferson Rudolf