u can use XmlDocument to obtain the web service result and then get values from it. Include following namespaces:
using System.Net;
using System.IO;
using System.Xml;
Try this type of code:
HttpWebRequest req = (HttpWebRequest)WebRequest.Create("http://localhost/WebServiceDemo/DemoWebService.asmx/Add?x=50&y=12");
HttpWebResponse res = (HttpWebResponse)req.GetResponse();
XmlDocument xdoc = new XmlDocument();
xdoc.LoadXml(new StreamReader(res.GetResponseStream()).ReadToEnd());
lblResponse.Text = xdoc.OuterXml;
if (File.Exists("D:\\Demo.xml"))
File.Delete("D:\\Demo.xml");
xdoc.Save("D:\\Demo.xml");
You can use xml class methods to get data from selected node using xdoc.SelectNodes or xdoc.SelectSingleNode methods and providing XPath in it.
Suppose web service result contains value in node "Value" inside root element "Root", then:
lblResult.Value = xdoc.SelectSingleNode("Root/Value").InnerText;