Hi,
Is there any way to have a WebService similar with the RESTful WS where as a response for a request, instead of a JSON or XML, to send some binary data, i.e. an array of bytes?
Thanks,
Bogdan.
Hi,
Is there any way to have a WebService similar with the RESTful WS where as a response for a request, instead of a JSON or XML, to send some binary data, i.e. an array of bytes?
Thanks,
Bogdan.
Hi Bodgan
Just convert the byte array to a base64 string.
Best regards. Roberto Blasco.
Thanks for the tip Roberto, but it might be too much data.
What I want beside sendind files like pdf for example, is to minimize the traffic as much as possible by archiving the responses. Maybe even the json responses. We send them to an iPhone app, an there is a lot of text there, which result in lot of traffic for the iPhone.
For another service that we have for the iPhone, we built a simple java server that deliver the response archived, and we notice a considerable data loading improve on the iPhone, even when connected through GPRS.
Kind regards,
Bogdan
Hi Bodgan
So the problem you have is the weight of the documents to send, not the webservice itself. One solution would be compress the pdf files before sending.
Have you considered using ftp instead webservices?
Best regards. Roberto Blasco.
Hi Roberto,
Except the pdf files, the other JSON responses that I have are dynamically built according with the parameters sent to the RESTful service from servoy. Only that even these JSON responses are sometimes huge. And I thought that I can minimize the traffic on the iPhone by archive them. As you know minimizing traffic on the iPhone is an important issue that can help users and it’s one of the good recommendation that Apple stated.
So, for these JSON responses that now I send through the RESTful WS, I don’t think I can use a ftp server. Also because the data is in exchange with a Servoy solution that users can also use on the computer as a Web or Smart Client.
But we also might need to add support for some pdf files that we also need them in this servoy online solution and also on the iPad. And the common point for the 2 applications is the RESTful WS from servoy.
So, it would be nice if I could compress the data from the RESTful WS, or to have something similar with this in servoy, maybe another service that I can extend it. Otherwise I will most probably write a java web server where I can respond whatever I want. But it would be nicer to do it from servoy, although, to be honest, I don’t think it’s possible. I just asked hoping!
Thanks,
Bogdan.
If there is no solution from servoy, I just need to create a simple proxy server and send all requests to it. This will compress the data for the client app and uncompress it for servoy. Any other ideas?
You could put your files under the ROOT in a subfolder, then access the file with a simple http URL, if the weight of the files are an issue, you can then add a filter in Tomcat to automatically compress everything that is requested from that path if needed.
They are not static files, but data generated by the service, so I just can’t put them in a folder. But if Tomcat can compress/decompress the output/input data this would be nice.
Just search for Tomcat filters, they are easy to write and there’s probably a few compression filters around.
we already set that for certain types, see server.xml in the conf dir of that application_server: