I use this code and it works great:
System.Xml.XmlDocument xd = new System.Xml.XmlDocument; xd.Load("http://www.webservice.com/webservice?fXML=1"); string xPath = "/xml/somekey"; // this node inner text contains "somevalue" return xd.SelectSingleNode(xPath).InnerText;
EDIT: I just realized that you are talking about a web service, not just XML. In your Visual Studio solution, try right-clicking on the links in Solution Explorer and select Add Web Link. A dialog box will appear asking for the URL, you can simply paste it into: " http://www.webservice.com/webservice.asmx ". VS will auto-generate all the helpers you need. Then you can just call:
com.webservice.www.WebService ws = new com.webservice.www.WebService(); // this assumes your web method takes in the fXML as an integer attribute return ws.SomeWebMethod(1);
source share