Пример #1
0
        public static void Run()
        {
            UDDIClient clerkManager = null;
            Transport  transport    = null;
            UDDIClerk  clerk        = null;

            try
            {
                clerkManager = new UDDIClient("uddi.xml");

                transport = clerkManager.getTransport("default_non_root");

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

                clerk = clerkManager.getClerk("default_non_root");


                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);
                }
                //  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();
                }
            }
        }
Пример #2
0
        public static void main(string[] args)
        {
            UDDIClient clerkManager = null;
            Transport  transport    = null;
            UDDIClerk  clerk        = null;

            try
            {
                clerkManager = new UDDIClient("uddi.xml");

                transport = clerkManager.getTransport("default_non_root");

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

                clerk = clerkManager.getClerk("default_non_root");


                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("Business: " + bl.businessInfos[i].name[0].Value);
                    if (bl.businessInfos[i].serviceInfos != null && bl.businessInfos[i].serviceInfos.Length > 0)
                    {
                        Console.WriteLine("Service: " + bl.businessInfos[i].serviceInfos[0].serviceKey);
                        Console.WriteLine("Running find_endpoints");
                        List <String> eps = clerk.getEndpoints(bl.businessInfos[i].serviceInfos[0].serviceKey);
                        Console.WriteLine(eps.Count + " endpoints found");
                        for (int k = 0; k < eps.Count; k++)
                        {
                            Console.WriteLine("[" + k + "] " + eps[i]);
                        }
                        break;
                    }
                }
            }
            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();
                }
            }
        }
Пример #3
0
        public static void Run(string[] args)
        {
            UDDIClient clerkManager = null;
            Transport  transport    = null;
            UDDIClerk  clerk        = null;

            try
            {
                clerkManager = new UDDIClient("uddi.xml");

                transport = clerkManager.getTransport("default");

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

                clerk = clerkManager.getClerk("default");


                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);
                if (bl.businessInfos.Length > 0)
                {
                    Console.Out.WriteLine(bl.businessInfos[0].name[0].Value);
                    Console.Out.WriteLine("attempting to sign");
                    businessService sd = clerk.getServiceDetail(bl.businessInfos[0].serviceInfos[0].serviceKey);

                    //pist, the signing config comes from the stuff in in uddi.xml
                    DigSigUtil                  ds        = new DigSigUtil(clerkManager.getClientConfig().getDigitalSignatureConfiguration());
                    businessService             signedsvc = (businessService)ds.signUddiEntity(sd);
                    PrintUDDI <businessService> p         = new PrintUDDI <businessService>();
                    Console.Out.WriteLine("signed successfully!");

                    Console.Out.WriteLine(p.print(signedsvc));
                    Console.Out.WriteLine("attempting verify and validate");
                    String err   = "";
                    bool   valid = ds.verifySignedUddiEntity(signedsvc, out err);
                    Console.Out.WriteLine("Signature is " + (valid ? "Valid, Yippy!" : "Invalid!") + " msg: " + err);

                    Console.Out.WriteLine("saving");
                    clerk.register(signedsvc);
                    Console.Out.WriteLine("reloading content from the server...");

                    get_serviceDetail gsd = new get_serviceDetail();
                    gsd.authInfo   = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
                    gsd.serviceKey = new string[] { signedsvc.serviceKey };
                    sd             = inquiry.get_serviceDetail(gsd).businessService[0];

                    Console.Out.WriteLine(p.print(sd));
                    Console.Out.WriteLine("attempting verify and validate");
                    err   = "";
                    valid = ds.verifySignedUddiEntity(sd, out err);
                    Console.Out.WriteLine("Signature is " + (valid ? "Valid, Yippy!" : "Invalid!") + " msg: " + err);
                }
                else
                {
                    Console.Out.WriteLine("no businesses were returned!");
                }
            }
            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();
                }
            }
        }