I have a WCF REST service built using C # and it returns an image as part of the processor intensive work. The client runs on Android (Java). By default, it returns a JSON text object that looks something like this:
{"d", [9,0,77,12,11, ...]}
These are image bytes. Good. However, all decisions to decode this JSON are unbearably slow. I tried Gson, Jackson and the built-in JSONObject class for Android. I have no idea why they are so slow.
As an alternative solution, I have a REST service that returns a GUID, and then this GUID can be used by the Android client to go to a regular URL, which serves as an ordinary binary stream for the image, through the MVC controller.
This works well, and it is quickly and fairly easily handled on the Android side. However, it feels a bit shredded and a kind of violation of REST design principles.
Am I missing something? Is there a better way to do this?
source
share