Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1041719
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T15:23:46+00:00 2026-05-16T15:23:46+00:00

I have a WCF REST service built with C# and it returns an image

  • 0

I have a WCF REST service built with C# and it returns an image as part of a CPU intensive operation. The client is running on Android (Java) By default, it will return a text JSON object that looks something like this:

{“d”,[9,0,77,12,11,…]}

Those are they bytes of the image. Fine. However, all the solutions for decoding this JSON are intolerably slow. I’ve tried Gson, Jackson, and the built-in Android JSONObject class. I have no idea why they are so slow.

As an alternative solution, I have my REST service return a GUID, and then that GUID can be used by the Android client to go to a regular URL that serves up the image as a regular binary stream, via an MVC controller.

This works well, and it fast, and is pretty easy to handle on the Android side. However, it does feel like a bit of kludge and kind of a violation of the REST design principles.

Am I missing something here? Is there a better way to do this?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T15:23:47+00:00Added an answer on May 16, 2026 at 3:23 pm

    How about your REST service return a Redirect 303 with a Location header that has an URL that points to the image? Or why not just return the bytes directly from the first URL?

    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.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a REST service consumed by a .Net WCF client. When an error
I have a WCF-REST service with one method which returns a string: [ServiceContract] public
I have a WCF 4 REST service which does some processing and then returns
I have a WCF REST Web Service which returns POCO entities generated by Entity
As i've mentioned in topic. I have WCF Rest Service, and ASP.NET MVC3 client.
I have a WCF rest service. It has a method that returns a list
I have created a WCF REST service that returns JSON, but the properties in
I have a C# WCF REST Service which allows the addition of a bookmark,
I have a wcf application hosted in a windows service running a local windows
I have a WCF Rest service: [WebHelp(Comment = Sample description for GetData)] [WebInvoke(Method=POST, UriTemplate

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.