Getting serious about UDDI, Step 1, Update

less than 1 minute read

Getting serious about UDDI, Step 1

If you search uddi.microsoft.com for "Services" by the "RSS - Version 2.0" tModel, there's exactly one entry at this time. Mine. Fix that.

Using the UDDI SDK 2.0 (part of the Platform SDK), the following snippet is a simple console app that lists all weblogs registered with the RSS 2.0 tModel in the Microsoft UDDI registry [thanks to Karsten Januszewski for his doc, tModel bootstrap and code]. The advantage? If aggregators were able to remember my service key instead or in addition to my absolute access point (right now http://radio.weblogs.com/0108971/rss.xml), I could move the RSS feed around to any arbitrary locations without any pain and clients would still be able to find it using a simple lookup into the registry. And the infrastructure is all there. No future thing.

using System;
using Microsoft.Uddi;
using Microsoft.Uddi.TModels;
using Microsoft.Uddi.Services;

namespace ListRSS20Feeds
{
    class MainApp
    {
        static void Main(string[] args)
        {
            UddiConnection uddiConnection = new UddiConnection();
            /* RSS 2.0 tModel key from config */
            string RSS20TModelKey = "uuid:bacbe300-4b2b-11d7-bc51-000629dc0a53";
            /* setup the UDDI parameters on the connection */
            uddiConnection.InquireUrl = "http://uddi.microsoft.com/inquire";


            /* create a UDDI FindService and ServiceList objects */

            FindService fs = new FindService();
            ServiceList sl = new ServiceList();
            /* add the rss tModel key */
            fs.TModelBag.Add( RSS20TModelKey );


            try
            {
                /* send to uddi */
                sl = fs.Send(uddiConnection);
            }
            catch ( Exception ex )
            {
                Console.WriteLine( ex.Message );
                return;
            }

            /* create FindBinding and BindingDetail objects */
            FindBinding fb = new FindBinding();
            BindingDetail bd = new BindingDetail();
            fb.TModelBag.Add( RSS20TModelKey );

            /* get the bindings */
            foreach ( ServiceInfo si in sl.ServiceInfos  )
            {
                /* set the serviceKey */
                fb.ServiceKey = si.ServiceKey;
                try
                {
                    /* send to UDDI */
                    bd = fb.Send(uddiConnection);
                }
                catch ( Exception ex )
                {
                    Console.WriteLine( ex.Message );
                    return;
                }
                foreach ( BindingTemplate bt in bd.BindingTemplates )
                {
                    Console.WriteLine(

                        "---------------\n"+
                        "Feed Name: {0}\n"+
                        "Access Point: {1}", 
                        si.Names[0].Text, 
                        bt.AccessPoint.Text);

                    /* get out the tModelInstanceInfo for the tModelKey 
                        that represents RSS 2.0 and get the version info */
                    foreach ( TModelInstanceInfo tmii in bt.TModelInstanceInfos )
                    {
                        if ( tmii.TModelKey == RSS20TModelKey ) 
                        {
                            if ( tmii.InstanceDetails.InstanceParameters != null )
                                Console.WriteLine("RSS Version: {0}", 
                                  tmii.InstanceDetails.InstanceParameters);
                            else
                                Console.WriteLine("RSS Version: n/a");
                        }
                    }
                    
                    if ( bt.Descriptions.Count > 0 )
                    {
                        Console.WriteLine( "Description: {0}, Language: {1}", 
                           bt.Descriptions[0].Text, 
                           bt.Descriptions[0].IsoLanguageCode);
                    }
                }
            }
        }
    }
}

Updated:

Leave a Comment