Click here to Skip to main content
13,513,903 members
Rate this:
Please Sign up or sign in to vote.
hi, i am trying to consume a wcf rest service on android but its not working. a short snippet of "how to consume restful service on android" or "how to upload a file using android" will help me plz.

public void upload(string fileName, Stream fileStream)

            FileStream fileToupload = new FileStream("e:\\" + fileName, FileMode.Create);

            byte[] bytearray = new byte[10000];
            int bytesRead, totalBytesRead = 0;
                bytesRead = fileStream.Read(bytearray, 0, bytearray.Length);
                totalBytesRead += bytesRead;
            } while (bytesRead > 0);

            fileToupload.Write(bytearray, 0, bytearray.Length);


public interface IImageUpload
       [WebInvoke(Method = "POST", UriTemplate = "FileUpload/{fileName}")]
       void upload(string fileName, Stream fileStream);

Posted 19-Dec-12 9:47am
Updated 19-Dec-12 9:54am

1 solution

Rate this: bad
Please Sign up or sign in to vote.

Solution 1

A RESTful service just takes HTTP requests and sends responses. There must be classes in java that let you do that ?
aditya_ingle 19-Dec-12 15:53pm
thnx. i will try. i just start developing 4 android.
Christian Graus 19-Dec-12 15:54pm
Try this :

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy |
Web01 | 2.8.180417.1 | Last Updated 19 Dec 2012
Copyright © CodeProject, 1999-2018
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100