//---------------------------------------------------------------------------------
// Microsoft (R) .NET Services SDK
// Software Development Kit
// 
// Copyright (c) Microsoft Corporation. All rights reserved.  
//
// THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, 
// EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES 
// OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE. 
//---------------------------------------------------------------------------------

namespace Microsoft.ServiceBus.Samples
{
    using System;
    using System.Net;
    using System.Text;
    using System.Xml;
    using System.IO;
    using System.ServiceModel.Syndication;
    
    class Program
    {
        static void Main(string[] args)
        {
            Console.Write("Enter the name of the Solution you want to connect to: ");
            string serviceUserName = Console.ReadLine();

            Uri serviceUri = ServiceBusEnvironment.CreateServiceUri("http", "skonnard1", "hdc09");

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(serviceUri.ToString());
            HttpWebResponse response = (HttpWebResponse)request.GetResponse();

            Stream stream = response.GetResponseStream();
            XmlTextReader reader = new XmlTextReader(stream);
            Rss20FeedFormatter formatter = new Rss20FeedFormatter();
            formatter.ReadFrom(reader);

            Console.WriteLine("\nThese are the contents of your feed: ");
            Console.WriteLine(" ");
            Console.WriteLine(formatter.Feed.Title.Text);
            foreach (SyndicationItem item in formatter.Feed.Items)
            {
                Console.WriteLine(item.Title.Text + ": " + item.Summary.Text);
            }
        }

   
    }
}
