BizTalk Utilities CV ,   Jobs ,   Code library
 
Go to the front page to continue learning about XML or select below:

Contents

ReBlogger Contents

Previous posts in WS, web services

 
 
Page 18219 of 19643

How to read xml returned by a WebService in a IE

Blogger : Sonu Kapoors WebLog
All posts : All posts by Sonu Kapoors WebLog
Category : WS, web services
Blogged date : 2005 Jan 17

This how to shows how you can read the XML which is returned by a WebService and displayed in raw XML in IE. fozylet submitted the solution for that question in the asp.net forums. I have converted his VB.NET code to C#.

void Page_Load(object sender, System.EventArgs e)
{
  if(!Page.IsPostBack)
  {
    StreamReader StreamHandler;
    XmlDocument xmlDoc = new XmlDocument();
    string strURL = "http://www.webservicex.net/CurrencyConvertor.asmx/ConversionRate
FromCurrency=INR&ToCurrency=USD"; HttpWebRequest wRequest = (HttpWebRequest)WebRequest.Create(strURL); wRequest.Headers.Add("Man", "GET " + strURL); HttpWebResponse wResponse = (HttpWebResponse)wRequest.GetResponse(); if(wRequest.HaveResponse){ if(wResponse.StatusCode == HttpStatusCode.OK){ StreamHandler = new System.IO.StreamReader(wResponse.GetResponseStream()); xmlDoc.LoadXml(StreamHandler.ReadToEnd()); Response.Write(xmlDoc.InnerText); } } } }

Output

0.0218

Sonu


Read comments or post a reply to : How to read xml returned by a WebService in a IE
Page 18219 of 19643

Newest posts
 

    Email TopXML