Beispiel #1
0
        /**
         * this will look up our service by name and we'll discover multiple
         * bindings with different versions
         */
        private void ServiceLookUpByName()
        {
            //here we are assuming we don't know what key is used for the service, so we look it up
            find_service fs = new find_service();

            fs.findQualifiers = new string[] { UDDIConstants.EXACT_MATCH };
            fs.name           = new name[] { new name("ZeroCool Service", lang) };
            serviceList findService = inquiry.find_service(fs);

            //parse the results and get a list of services to get the details on
            get_serviceDetail gsd   = new get_serviceDetail();
            List <string>     items = new List <string>();

            for (int i = 0; i < findService.serviceInfos.Length; i++)
            {
                items.Add(findService.serviceInfos[i].serviceKey);
            }
            gsd.serviceKey = items.ToArray();
            serviceDetail          serviceDetail = inquiry.get_serviceDetail(gsd);
            List <bindingTemplate> ret           = new List <bindingTemplate>();
            //parse the service details, looking for our versioned service
            Boolean success = false;

            if (serviceDetail != null)
            {
                for (int i = 0; i < serviceDetail.businessService.Length; i++)
                {
                    if (serviceDetail.businessService[i].bindingTemplates != null)
                    {
                        List <bindingTemplate> bindingByVersion = UDDIClerk.getBindingByVersion("1.2.0.0",
                                                                                                serviceDetail.businessService[i].bindingTemplates);
                        for (int x = 0; x < bindingByVersion.Count; x++)
                        {
                            success = true;
                            Console.Out.WriteLine("SUCCESS! Found the right version on key " + bindingByVersion[x].bindingKey);
                            //TODO so now that you've found the right version of the right service
                            //now you can go execute that the url
                        }
                    }
                }
            }
            if (!success)
            {
                Console.Out.WriteLine("FAIL! We didn't find a damn thing matching that version number :(");
            }
        }