using System; using System.IO; using System.Net; using System.Xml.XPath; public class MainClass{ public static void Main(string [] args) { string content = "productCode=1111"; HttpWebRequest request = (HttpWebRequest)WebRequest.Create("http://127.0.0.1:80/Query.asmx/GetNumberInStock"); request.Method = "POST"; request.ContentType = "application/x-www-form-urlencoded"; request.ContentLength = content.Length; StreamWriter streamWriter = new StreamWriter(request.GetRequestStream( )); streamWriter.Write(content); streamWriter.Flush( ); WebResponse response = request.GetResponse( ); Stream stream = response.GetResponseStream( ); XPathDocument document = new XPathDocument(stream); XPathNavigator nav = document.CreateNavigator( ); XPathNodeIterator nodes = nav.Select("//int"); Console.WriteLine(nodes.Current); } }