C# Tutorials and offshore development in India
    Tutorials   Resources   Forum   Reviews   Communities   Interview   Jobs   Projects   Training   Your Ad Here    
Silverlight Games | Mentor | Code Converter | Articles | Code Factory | Computer Jokes | Members | Peer Appraisal | IT Companies | Bookmarks | Polls | Revenue Sharing | Lobby | Gift Shop |


Prizes & Awards
My Profile



Active Members
TodayLast 7 Days more...






Forums » .NET » ASP.NET »

Reg : web service


Posted Date: 05 Nov 2009      Posted By: Raveena      Member Level: Silver     Points: 1   Responses: 3



i have an problem regarding web service. i have an image stored in folder on the server …that i wish to return image over the web service…i m trying converting it to byte data and then byte data to memory stream …my problem is how to generate valid XML from memory stream …..





Responses

Author: Anuraj    05 Nov 2009Member Level: DiamondRating: 2 out of 52 out of 5     Points: 2

Here is some code to upload a file to webservice

http://www.dotnetthoughts.net/2009/07/28/uploading-files-using-webservice/

You can use the same approach for downloading also.

Thanks
Anuraj
THIS POSTING IS PROVIDED "AS IS" WITH NO WARRANTIES, AND CONFERS NO RIGHTS.
BEWARE OF BUGS IN THE ABOVE CODE; I HAVE ONLY PROVED IT CORRECT, NOT TRIED IT.
dotnetthoghts



Author: Hari    05 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi

I am assuming that your upload and download functionality is working fine and you are only convered with getting the xml from a memory stream. You can use the following code. But beware it work only if the memory stream canbe coverted toa proper xml. You modify this code suit your needs.

BufferedStream stream = new BufferedStream(new MemoryStream()); stream.Write(Encoding.ASCII.GetBytes("<xml>foo</xml>"), 0, "<xml>foo</xml>".Length); stream.Seek(0, SeekOrigin.Begin); StreamReader sr = new StreamReader(stream);
XmlReader reader = XmlReader.Create(sr);
while (reader.Read())
{
Console.WriteLine(reader.Value);
}
stream.Close();



Author: Prajeesh    05 Nov 2009Member Level: GoldRating: 2 out of 52 out of 5     Points: 2

Hi Raveena,

See following article, it will help you
http://aspalliance.com/404_Image_Web_Service_



Post Reply
You must Sign In to post a response.
Next : Triggers
Previous : Copying word document content to a rich text box without losing format
Return to Discussion Forum
Post New Message
Category: ASP.NET

Related Messages



dotNet Slackers

About Us    Contact Us    Privacy Policy    Terms Of Use