You are not logged in.
Please add the ability to send binary data in raw mode (without base64 encoding) in interface-based services. Maybe some dedicated type like TBinaryBlob or TRAWData?
This would be very useful in some cases!
Offline
I agree, very useful.
Offline
I agree.
Delphi XE4 Pro on Windows 7 64bit.
Lazarus trunk built with fpcupdelux on Windows with cross-compile for Linux 64bit.
Offline
Will be very useful, i agree.
Offline
I fully agree and I would love to see this functionality
Offline
Hurrah! :-)
Thx!
Offline
Okay, okay, I will add it!
Thanks a lot!
Offline
If your purpose is to upload some binary data, RawByteString and TSQLRawBlob input parameters will by default be transmitted as Base64 encoded JSON text.
You may define Client-Server services via methods to transmit raw binary, without the Base64 encoding overhead. It would allow low-access to the input content type and encoding, even with multi-part file upload from HTTP.
As an alternative, if you use default TSQLRestRoutingREST routing, and defined a single RawByteString or TSQLRawBlob input parameter, it will be processed as a raw POST with binary body defined with mime-type 'application/octet-stream'. This may be more optimized for remote access over the Internet.
See https://synopse.info/fossil/info/4cfc722c69
Offline
Does this mean that the method can have only one parameter? Eg.
procedure SendBlob (const aBlob: RawByteString);
And if I write the method:
Procedure SendBlob(aBlobKind: Integer; const aBlob: RawByteString);
then aBlob will be encoded with Base64?
Offline
Offline
With one parameter this is not very useful :-( There is no way to tell what is in the blob, probably need to use http header for additional info.
It would be useful to tag/register a method so that its parameters are not serialized.
Maybe worth consider to expand TServiceFactoryServer interface by adding method:
function DoNotEncodeParams(const aMethod: array of RawUTF8): TServiceFactoryServer;
Is it possible to realize?
Offline
I found problem on this topic.
I get exception:
TSQLRestRoutingREST.Error:
{"errorCode":406, "errorText":"sicShared execution failed (probably due to bad input parameters) for TMyService.SendFilePart"}
See for reason:
Offline
How is your service defined?
One input parameter without JSON encoding is NOT supported yet, as documented and stated above in this forum thread.
Use a method-based service instead to upload some binary content from the client.
Offline
Not supported?
Then why you wrote above:
"As an alternative, if you use default TSQLRestRoutingREST routing, and defined a single RawByteString or TSQLRawBlob input parameter, it will be processed as a raw POST with binary body defined with mime-type 'application/octet-stream'. This may be more optimized for remote access over the Internet.
See https://synopse.info/fossil/info/4cfc722c69"
?
And what changes has this commit? https://synopse.info/fossil/info/4cfc722c69
btw on other (text) files this way acts properly (send without json and base64 encoding)
Last edited by jaclas (2018-02-12 13:15:38)
Offline
I forgot about this commit.
This is event documented in https://synopse.info/files/html/Synopse … l#TITL_197
Are you sure you use the proper mime type, with raw binary content (no base64 encoding)?
Try to find out using the debugger why TSQLRestRoutingREST.ExecuteSOAByInterface doesn't understand your client query.
Offline
For send PDF file header is:
POST /server/SomeService.SendFilePart HTTP/1.1
Accept: */*
FILEID: 84317faa3d2516d189da1e356e12e4fe5f55eeea8970a09d26739ec690e0c4fb
Content-Type: application/pdf
User-Agent: Mozilla/5.0 (Windows; mORMot 1.18 TWinINet)
Host: localhost:8090
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Content-Length: 1048576
%PDF-1.4
%ŕáâă
2 0 obj
<</Filter /FlateDecode
/Length 11656951
>>
stream
xśĚÝÁŽćHš¬ç}_ĹÜŔNŇé$·
[...]
for XML:
POST /server/SomeService.SendFilePart HTTP/1.1
Accept: */*
FILEID: 8472f3d762a2f42ebde6a9bf9fba0806d9c8e59221fc0dafd3fe05dd1a94050c
Content-Type: application/octet-stream
User-Agent: Mozilla/5.0 (Windows; mORMot 1.18 TWinINet)
Host: localhost:8090
Connection: Keep-Alive
Accept-Encoding: gzip, deflate
Content-Length: 1048576
<?xml version="1.0" encoding="UTF-8"?>
<Migration>
<Session Type="Online">
<Platform Type="Source">
[...]
Content-Type is different for PDF and for XML, how to force properly value of Content-Type?
Offline
But how to set it? For now I don't set the Content-Type header.
Offline
is not exactly like you wrote:
"if you use default TSQLRestRoutingREST routing, and defined a single RawByteString or TSQLRawBlob input parameter, it will be processed as a raw POST with binary body defined with mime-type 'application/octet-stream'"
Can you correct it?
Offline
Yes, you are right, this is an issue.
Even if setting 'application/pdf' is the right way on the client side.
I guess that the server side is to be fixed.
Please try https://synopse.info/fossil/info/26d3008868
Offline
Now is ok (probably ;-)
Thx Arnaud
Offline
@jaclas what font do you use in the IDE?
Offline
@Junior/RO
Source Code Pro Semibold
Offline