Click here to Skip to main content
15,613,436 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
var client = new RestClient("URL");
        client.Timeout = -1;
        var request = new RestRequest(Method.POST);

        request.AddHeader("Authorization", "Basic Info");
        request.AddHeader("Cookie", "cookie info");
        var body = @"<soapenv:Envelope xmlns:soapenv=""URL"" xmlns:ws=""URL"">
        request.AddParameter("", body, ParameterType.RequestBody);
        IRestResponse response = client.Execute(request);

        if (response.StatusCode == HttpStatusCode.OK)
            lblInfo.Text = response.Content;
            lblInfo.Text = (string.Format("{0}({1})", response.StatusDescription, 

What I have tried:

I need to read the nodes, but the code takes the nodes out and displays all in string format.
Updated 27-Jul-22 8:43am
PIEBALDconsult 27-Jul-22 13:41pm    
Seems unlikely, maybe see what's what in the debugger?

1 solution


One option is that you can use XDocument class for reading nodes in the string.
Parse the string to XDocument, and use linq to xml. An example is shown below

string xmlstr = @"<?xml version='1.0'?><Products>

            XDocument xmldoc = XDocument.Parse(xmlstr);

            var products = (from p in xmldoc.Descendants("Product")
                           select new
                               Name = p.Element("Name").Value,
                               Price = p.Element("Price").Value

Hope this helps
Share this answer

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