Click here to Skip to main content
15,667,847 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Dear Friends,

I have a requirement to Consume Rest WCF service in both Java Script and Windows application. Can any one give the direction to consume rest wcf service in windows application.

Please give me a single example or links. I have a service url below. how to consume in windows forms application.

I had written like this to consume. This is like consuming in web.

HttpWebRequest myWebRequest =(HttpWebRequest)WebRequest.Create(ServiceUrl);
HttpWebResponse myWebResponse = (HttpWebResponse)myWebRequest.GetResponse();
Stream ReceiveStream = myWebResponse.GetResponseStream();
Encoding encode = System.Text.Encoding.GetEncoding("utf-8");
StreamReader readStream = new StreamReader(ReceiveStream, encode);
label1.Text = readStream.ReadToEnd();

I am getting below exception.

'ReceiveStream.Length' threw an exception of type 'System.NotSupportedException'

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

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900