/**
         * 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 :(" );
            }
        }
Beispiel #2
0
 /// <remarks/>
 public void find_serviceAsync(find_service find_service1, object userState)
 {
     if ((this.find_serviceOperationCompleted == null))
     {
         this.find_serviceOperationCompleted = new System.Threading.SendOrPostCallback(this.Onfind_serviceOperationCompleted);
     }
     this.InvokeAsync("find_service", new object[] {
             find_service1}, this.find_serviceOperationCompleted, userState);
 }
Beispiel #3
0
 /// <remarks/>
 public void find_serviceAsync(find_service find_service1)
 {
     this.find_serviceAsync(find_service1, null);
 }
Beispiel #4
0
 /// <remarks/>
 public System.IAsyncResult Beginfind_service(find_service find_service1, System.AsyncCallback callback, object asyncState)
 {
     return this.BeginInvoke("find_service", new object[] {
             find_service1}, callback, asyncState);
 }
        internal static void Run(string[] args)
        {
            UDDIClient clerkManager = null;
            Transport transport = null;
            UDDIClerk clerk = null;
            try
            {
                clerkManager = new UDDIClient("uddi.xml");

                transport = clerkManager.getTransport("uddiv2");

                UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
                UDDI_Inquiry_SoapBinding inquiry = transport.getUDDIInquiryService();
                UDDI_Publication_SoapBinding publish = transport.getUDDIPublishService();

                clerk = clerkManager.getClerk("uddiv2");

                find_business fb = new find_business();
                //fb.authInfo = clerk.getAuthToken(security.Url);
                fb.findQualifiers = new string[] { UDDIConstants.APPROXIMATE_MATCH };
                fb.name = new name[1];
                fb.name[0] = new name(UDDIConstants.WILDCARD, "en");
                businessList bl = inquiry.find_business(fb);
                for (int i = 0; i < bl.businessInfos.Length; i++)
                {
                    Console.WriteLine(bl.businessInfos[i].name[0].Value);

                }

                find_service fs = new find_service();
                fs.findQualifiers = new string[] { UDDIConstants.APPROXIMATE_MATCH };
                fs.name = new name[1];
                fs.name[0] = new name("%", null);
                serviceList sl=inquiry.find_service(fs);
                for (int i = 0; i < sl.serviceInfos.Length; i++)
                {
                    Console.WriteLine(sl.serviceInfos[i].name[0].Value);

                }

                find_tModel ft = new find_tModel();
                ft.findQualifiers = new string[] { UDDIConstants.APPROXIMATE_MATCH };
                ft.name = new name("%", null);
                tModelList tl = inquiry.find_tModel(ft);
                for (int i = 0; i < tl.tModelInfos.Length; i++)
                {
                    Console.WriteLine(tl.tModelInfos[i].name.Value);

                }
                //  serviceDetail s= clerk.getServiceDetail("uddi:mydomain.com:zerocoolsvc");
                //   Console.Out.WriteLine(new PrintUDDI<serviceDetail>().print(s));
            }
            catch (Exception ex)
            {
                while (ex != null)
                {
                    System.Console.WriteLine("Error! " + ex.Message);
                    ex = ex.InnerException;
                }
            }
            finally
            {
                if (transport != null && transport is IDisposable)
                {
                    ((IDisposable)transport).Dispose();
                }
                if (clerk != null)
                    clerk.Dispose();
            }
        }
Beispiel #6
0
 public void findServices()
 {
     Console.Out.Write("findServices");
     Assert.True(online);
     find_service fb = new find_service();
     fb.name = new name[] { new name(UDDIConstants.WILDCARD, null) };
     fb.findQualifiers = new string[] { UDDIConstants.APPROXIMATE_MATCH };
     serviceList bl = inquiry.find_service(fb);
     Assert.NotNull(bl);
     Assert.NotNull(bl.serviceInfos);
     Assert.True(bl.serviceInfos.Length > 0);
     for (int i = 0; i < bl.serviceInfos.Length; i++)
     {
         Assert.IsNotNullOrEmpty(bl.serviceInfos[i].businessKey);
         Assert.IsNotNullOrEmpty(bl.serviceInfos[i].serviceKey);
     }
     PrintUDDI<serviceList> p = new PrintUDDI<serviceList>();
     if (serialize)
         Console.Out.WriteLine(p.print(bl));
 }