You are not logged in.
Pages: 1
hi, i use sample 10 - Background Http service.
is it possible use client side procedure to save the image from blob to server folder?
Offline
thanks, i see sample, but dont understand how it works. all samples have client and server files, but 26 - RESTful ORM\RESTServerClass.pas have only server side
Offline
Did you at least search in the documentation do get how REST works?
To consume it from a client, use a regular HTTP client, then call root/notefile/blob, you can retrieve a blob with GET, modify it with POST/PUT, and delete it with DELETE methods.
It is pretty clear when you look at the TNoteServer.Blob() method implementation.
Offline
problem how "call root/notefile/blob"
i run server from 26 sample and if i run client i get "<h1>Bad Request (Invalid Hostname)</h1>"
/// minimal REST client for a list of Persons from RESTserver.exe
program RESTclient;
{$APPTYPE CONSOLE}
uses
SynCommons, // framework core
mORMot, // RESTful server & ORM
mORMotHttpClient, // HTTP client to a mORMot RESTful server
SynGdiPlus,
RESTData; // data model unit, shared between server and client
var aModel: TSQLModel;
aClient: TSQLHttpClient;
aRootURI, response: RawUTF8;
jpg: TJPEGImage;
jpgRaw: RawByteString;
begin
Gdip := TGDIPlusFull.Create;
aModel := DataModel(aRootURI);
try
aClient := TSQLHttpClientWinHTTP.Create('localhost','888',aModel);
jpg := TJPEGImage.Create;
jpg.LoadFromFile('d:\scans\1.jpg');
SaveAsRawByteString(jpg, jpgRaw, gptJPG);
aClient.CallBackGet('root/notefile/blob', [], response, TSQLNoteFile);
write(response);
aClient.CallBackPut('root/notefile/blob', jpgRaw, response, TSQLNoteFile);
write(response);
write(#10'Press [Enter] to quit');
readln;
finally
aModel.Free;
end;
Gdip.Free;
end.
Offline
before it was, but still does not work.
aClient.CallBackGet('blob', [], response, TSQLNoteFile);
write(response);
aClient.CallBackPut('blob', jpgRaw, response, TSQLNoteFile);
dont understand why, please try run this client with sample 26 server.
Last edited by noobies (2015-03-02 08:12:51)
Offline
I've added a RESTClient GUI project to sample "26 - RESTful ORM".
See http://synopse.info/fossil/info/6fb0736f8a
Offline
big big thanks for sample!
Offline
Pages: 1