Consuming a WCF REST service from Android is very slow?

As far as RESTful or not, returning a JSON encoded image is not exactly in the spirit of the REST self-descriptive constraint Just make sure the endpoint that returns the image stream of bytes, actually uses an image/* media type in the content header.

As far as RESTful or not, returning a JSON encoded image is not exactly in the spirit of the REST self-descriptive constraint. Just make sure the endpoint that returns the image stream of bytes, actually uses an image/* media type in the content header.

Using WCF, you are restricted to returning JSON or XML – Alex Kilpatrick Sep 2 '10 at 4:34 No, that is not true. I have a WCF service that I return a dozen different media types from. Use Stream as your method return type and you can return anything.

– Darrel Miller Sep 2 '10 at 11:03 1 Hmm. I was looking at: WebGet(ResponseFormat = WebMessageFormat. Xml) That only gives you XML or Json.

However, if you use: WebOperationContext.Current. OutgoingResponse. ContentType = "text/xml" It looks like you can return any type.

Thanks! – Alex Kilpatrick Sep 2 '10 at 19:53.

Well, on of your main problems is trying to transmit binary data using a text format. Most if not all java json libraries will try to recognize the type of the field. It'll take a long time if there's a lot of fields.

Yeah, streaming it directly is a lot faster. Maybe you can use XML since it supports binary or blob data.

As Darrel wrote above, if the URL computes and returns an Image, simply return that Image with an appropriate content-type, for e.g. , as a PNG image. Transmitting the image encoded within JSON is a strange choice, to say the least.

There is a great talk about developing rest client application on android form Google IO 2010. youtube.com/watch?v=xHXn3Kg2IQE This session will present architectural considerations for developing RESTful applications on the Android platform. It focuses on design patterns, platform integration and performance issues specific to the Android platform.

A great resource and must watch.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions