OE 11.7.5 Trying to achieve a sample REST WebService to upload binary data from an ABL http client Request.
On the client side, I prepare a POST request this way:
@openapi.openedge.export(type="REST", useReturnValue="false", writeDataSetBeforeImage="false").
METHOD PUBLIC VOID PostBinSmallFile (pmptr AS MEMPTR):
COPY-LOB FROM pmptr TO FILE "./received.zip" NO-CONVERT.
FINALLY:
SET-SIZE(pmptr) = 0.
END FINALLY.
END METHOD.
This always results in HTTP Error 415 Unsupported Media Type
The AppServer access log says:
"POST /AKQRest/rest/AKQRestService/PostBinSmallFile HTTP/1.1" 415
A few articles advise to convert the binary content to text with BASE64-ENCODING, but I really would like to avoid that for performance sake (that service will be used intensively).
I've tried the application/zip content type with the same result. The http client is happy to send, but I have not yet found how to define, bind and code the server side.
Any hint of piece of doc I may find for that?
So far, I know how to GET or PUT json stuff for simple parameters or temp-tables. I am missing how to handle binary data.
Hi Sébastien
OE REST Webservices can only do json :(
If you hack a little, you might do anything not binary.
But for binary you will have to go web handlers.
I'm using URL Rewrite so that my web handkers URIs are consistent with the REST ones.
Regards
JC
JC is right, application/json only for the REST adapter. Now of course you can base64 encode the data since you seem to control both ends.
Now, since in modern days example code turns into production code amazingly quickly, you might want to go for the WebHandlers straight away.
All the definitions of REST are stored in the .services folder in PDSOE and they a genuine nightmare, not to mention all sorts of limitations with the REST adapter.
had I known the limitations of the REST adapter, I would have done everything using web handlers...
Hi Sébastien
OE REST Webservices can only do json :(
If you hack a little, you might do anything not binary.
But for binary you will have to go web handlers.
I'm using URL Rewrite so that my web handkers URIs are consistent with the REST ones.
Regards
JC
Hi Sébastien
OE REST Webservices can only do json :(
If you hack a little, you might do anything not binary.
But for binary you will have to go web handlers.
I'm using URL Rewrite so that my web handkers URIs are consistent with the REST ones.
Regards
JC
JC is right, application/json only for the REST adapter. Now of course you can base64 encode the data since you seem to control both ends.
Now, since in modern days example code turns into production code amazingly quickly, you might want to go for the WebHandlers straight away.
All the definitions of REST are stored in the .services folder in PDSOE and they a genuine nightmare, not to mention all sorts of limitations with the REST adapter.
Thank you Bronco and Jean-Christophe,
I had also heard about the WebHandlers but started to play with the nice little REST wizards at first. I can imagine many other benefits of doing all with the WebHandlers technique. I suppose it might be easier to deploy.
had I known the limitations of the REST adapter, I would have done everything using web handlers...
Is it that much work to transfer from previous REST interface, to use web Handler?
Update from Progress Community
Jean-Christophe Cardot had I known the limitations of the REST adapter, I would have done everything using web handlers...
You received this notification because you subscribed to the forum. To unsubscribe from only this thread, go here.
Flag this post as spam/abuse.
> Is it that much work to transfer from previous REST interface, to use web Handler?
May be not so much, but once you have developped a lot of REST adapter web services already, it is some work to be done, with possible regressions and necessary testing, and no budget for that ;)