Data hosted with ♥ by Pastebin.com - Download Raw - See Original
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Web;
  5. using System.Web.Services;
  6. using System.Data;
  7. using System.Configuration;
  8. using System.Net;
  9. using System.Xml;
  10. using System.IO;
  11.  
  12.  
  13. namespace RssReader
  14. {
  15.     [WebService(Namespace = "http://zzzz.org")]
  16.     [WebServiceBinding(ConformsTo = WsiProfiles.BasicProfile1_1)]
  17.     [System.ComponentModel.ToolboxItem(false)]
  18.     public class WebService1 : System.Web.Services.WebService
  19.     {
  20.  
  21.         [WebMethod]
  22.         public rssItem[] rssFeedGen(){
  23.             WebRequest MyRssRequest = WebRequest.Create("http://www.coldfusionbloggers.org/rss.cfm?max=20");
  24.             WebResponse MyRssResponse = MyRssRequest.GetResponse();
  25.             Stream MyRssStream = MyRssResponse.GetResponseStream();
  26.  
  27.             // Load previously created XML Document
  28.             XmlDocument MyRssDocument = new XmlDocument();
  29.             MyRssDocument.Load(MyRssStream);
  30.  
  31.             XmlNodeList MyRssList = MyRssDocument.SelectNodes("rss/channel/item");
  32.             rssItem[] result = new rssItem[MyRssList.Count];
  33.  
  34.             // Iterate/Loop through RSS Feed items
  35.             for (int i = 0; i < MyRssList.Count; i++){
  36.                 result[i] = new rssItem();
  37.                 result[i].Title = MyRssList.Item(i).SelectSingleNode("title").InnerText;
  38.                 result[i].Author = MyRssList.Item(i).SelectSingleNode("author").InnerText;
  39.                 result[i].Link = MyRssList.Item(i).SelectSingleNode("link").InnerText;
  40.             }
  41.             return result;
  42.         }
  43.     }
  44.  
  45.     public class rssItem{
  46.         public String Author, Title, Link;
  47.     }
  48. }