Phase REST XML into variable

Posted by 001 on Stack Overflow See other posts from Stack Overflow or by 001
Published on 2011-01-14T02:46:53Z Indexed on 2011/01/14 2:54 UTC
Read the original article Hit count: 177

Filed under:
|
|
|
|

I want to get a response from the REST XML web service, and phase it into variables so I can use them in my program.

1) How come this code does not work? I get an empty string...

// Get response 
string ws_response="";
using (HttpWebResponse response = request.GetResponse() as HttpWebResponse)  
{  
    // Get the response stream  
    StreamReader reader = new StreamReader(response.GetResponseStream());


    // web service response string
    ws_response = reader.ReadToEnd;  // <---???? I get an empty string

    // do phasing here (ie XML element into variable) etc..
    //
}  

© Stack Overflow or respective owner

Related posts about c#

Related posts about ASP.NET