Beispiel #1
0
        static void Main(string[] args)
        {
            //Normally, this code snippet would be executed by some kind of web service life cycle listener
            //such as global.asax
            //a web service contructor
            Type t = typeof(HelloImpl);

            Console.Out.WriteLine(t.AssemblyQualifiedName);
            UDDIClient clerkManager = null;
            Transport  transport    = null;
            UDDIClerk  clerk        = null;

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

            transport = clerkManager.getTransport("default");

            org.uddi.apiv3.UDDI_Security_SoapBinding security = transport.getUDDISecurityService();
            org.uddi.apiv3.UDDI_Inquiry_SoapBinding  inquiry  = transport.getUDDIInquiryService();

            clerk = clerkManager.getClerk("default");
            clerkManager.registerAnnotatedServices();
            HelloImpl x = new HelloImpl();

            //this is more of an "onShutdown" event
            clerkManager.unRegisterAnnotatedServices();
            Thread.Sleep(15000);
        }
        public void xr_subscriptionFilterws()
        {
            Console.Out.WriteLine("serialization xr_subscriptionFilterws");
            Console.Out.WriteLine("xr_subscriptionFilterws");
            subscriptionFilter r            = new subscriptionFilter();
            UDDIClient         clerkManager = null;
            Transport          transport    = null;
            UDDIClerk          clerk        = null;

            try
            {
                clerkManager = new UDDIClient("uddi.xml");
                transport    = clerkManager.getTransport("default");
                org.uddi.apiv3.UDDI_Security_SoapBinding        security = transport.getUDDISecurityService();
                org.uddi.apiv3.UDDI_Inquiry_SoapBinding         inquiry  = transport.getUDDIInquiryService();
                org.uddi.apiv3.UDDI_Publication_SoapBinding     publish  = transport.getUDDIPublishService();
                org.uddi.apiv3.UDDI_CustodyTransfer_SoapBinding custody  = transport.getUDDICustodyTransferService();
                org.uddi.apiv3.UDDI_Subscription_SoapBinding    sub      = transport.getUDDISubscriptionService();
                clerk = clerkManager.getClerk("default");

                save_subscription ss = new save_subscription();
                ss.subscription = new subscription[] { new subscription() };
                ss.subscription[0].subscriptionFilter = r;
                sub.save_subscription(ss);
            }
            catch (Exception ex)
            {
                String s = "";
                while (ex != null)
                {
                    s  = s + ex.Message;
                    ex = ex.InnerException;
                }
                if (ContainsSerializationError(s))
                {
                    Assert.Fail(s);
                }
            }
            finally
            {
                if (transport != null && transport is IDisposable)
                {
                    ((IDisposable)transport).Dispose();
                }
                if (clerk != null)
                {
                    clerk.Dispose();
                }
            }
        }
Beispiel #3
0
        public static void init()
        {
            if (Environment.GetEnvironmentVariable("debug") != null &&
                Environment.GetEnvironmentVariable("debug").Equals("true", StringComparison.CurrentCultureIgnoreCase))
            {
                serialize = true;
            }

            clerkManager = new UDDIClient("resource/uddi.xml");

            transport = clerkManager.getTransport("default");

            security = transport.getUDDISecurityService();
            inquiry  = transport.getUDDIInquiryService();
            publish  = transport.getUDDIPublishService();
            sub      = transport.getUDDISubscriptionService();
            clerk    = clerkManager.getClerk("default");
            node     = clerk.getUDDINode();
            WebClient c = new WebClient();

            Console.Out.WriteLine("Checking to see if tomcat is running");
            String s     = null;
            int    count = 100;

            while (s == null && count > 0)
            {
                try
                {
                    s = c.DownloadString("http://localhost:8080/");
                    Console.Out.WriteLine("Tomcat is running");
                    break;
                }
                catch
                { }
                Console.Out.WriteLine("tomcat isn't running yet, waiting...");
                Thread.Sleep(1000);
            }

            if (s == null)
            {
                Console.Out.WriteLine("Unable to confirm if tomcat is running, aborting");
                online = false;
            }
        }
Beispiel #4
0
        public static void init()
        {
            if (Environment.GetEnvironmentVariable("debug") != null
                && Environment.GetEnvironmentVariable("debug").Equals("true", StringComparison.CurrentCultureIgnoreCase))
            {
                serialize = true;
            }

            clerkManager = new UDDIClient("resource/uddi.xml");

            transport = clerkManager.getTransport("default");

            security = transport.getUDDISecurityService();
            inquiry = transport.getUDDIInquiryService();
            publish = transport.getUDDIPublishService();
            sub = transport.getUDDISubscriptionService();
            clerk = clerkManager.getClerk("default");
            node = clerk.getUDDINode();
            WebClient c = new WebClient();

            Console.Out.WriteLine("Checking to see if tomcat is running");
            String s = null;
            int count = 100;
            while (s == null && count > 0)
            {
                try
                {
                    s = c.DownloadString("http://localhost:8080/");
                    Console.Out.WriteLine("Tomcat is running");
                    break;
                }
                catch
                { }
                Console.Out.WriteLine("tomcat isn't running yet, waiting...");
                Thread.Sleep(1000);
            }

            if (s == null)
            {
                Console.Out.WriteLine("Unable to confirm if tomcat is running, aborting");
                online = false;
            }
        }
        public void xr_subscriptionResultsListws()
        {
            Console.Out.WriteLine("serialization xr_subscriptionResultsListws");
            subscriptionResultsList r = new subscriptionResultsList();
            UDDIClient clerkManager   = null;
            Transport  transport      = null;
            UDDIClerk  clerk          = null;

            try
            {
                clerkManager = new UDDIClient("uddi.xml");
                transport    = clerkManager.getTransport("default");
                org.uddi.apiv3.UDDI_Security_SoapBinding        security = transport.getUDDISecurityService();
                org.uddi.apiv3.UDDI_Inquiry_SoapBinding         inquiry  = transport.getUDDIInquiryService();
                org.uddi.apiv3.UDDI_Publication_SoapBinding     publish  = transport.getUDDIPublishService();
                org.uddi.apiv3.UDDI_CustodyTransfer_SoapBinding custody  = transport.getUDDICustodyTransferService();
                org.uddi.apiv3.UDDI_Subscription_SoapBinding    sub      = transport.getUDDISubscriptionService();
                clerk = clerkManager.getClerk("default");
            }
            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();
                }
            }
        }
 private void Init()
 {
     try {
     // create a client and read the config in the archive;
     // you can use your config file name
     client = new UDDIClient("uddi.xml");
     clerk = client.getClerk("default_non_root");
     // a UddiClient can be a client to multiple UDDI nodes, so
     // supply the nodeName (defined in your uddi.xml.
     // The transport can be WS, inVM, RMI etc which is defined in the uddi.xml
     Transport transport = client.getTransport("default_non_root");
     // Now you create a reference to the UDDI API
     security = transport.getUDDISecurityService();
     inquiry = transport.getUDDIInquiryService();
     publish = transport.getUDDIPublishService();
     } catch (Exception e) {
     while (e!=null)
     {
         Console.Out.WriteLine(e.Message + Environment.NewLine + e.StackTrace + Environment.NewLine);
         e = e.InnerException;
     }
     }
 }
Beispiel #7
0
 public static UDDI_Inquiry_SoapBinding getUDDIInquiryPort(String endpoint)
 {
     UDDI_Inquiry_SoapBinding i = new UDDI_Inquiry_SoapBinding();
     i.Url = endpoint;
     return i;
 }
 private static bool CheckServiceAndParentForSignature(String serviceKey, UDDI_Inquiry_SoapBinding uddiInquiryService, String token)
 {
     get_serviceDetail gsd = new get_serviceDetail();
     gsd.authInfo = (token);
     gsd.serviceKey = new string[] { serviceKey };
     String bizkey = null;
     try
     {
         serviceDetail serviceDetail = uddiInquiryService.get_serviceDetail(gsd);
         if (serviceDetail != null && serviceDetail.businessService != null)
         {
             {
                 bizkey = serviceDetail.businessService[0].businessKey;
                 if (serviceDetail.businessService[0].Signature != null && serviceDetail.businessService[0].Signature.Length > 0)
                 {
                     log.info("the service with key=" + serviceKey + " exists and is digitally signed");
                     return true;
                 }
             }
         }
     }
     catch (Exception ex)
     {
         log.info("Error caught checking for the existence of and if a signature is present for service key " + serviceKey, ex);
         throw new UnexpectedResponseException("Error caught checking for the existence of and if a signature is present for service key " + serviceKey, ex);
     }
     if (bizkey == null)
     {
         throw new UnexpectedResponseException("The service with key " + serviceKey + " parent's business key could not be determined. This is unexpected");
     }
     get_businessDetail gbd = new get_businessDetail();
     gbd.authInfo = (token);
     gbd.businessKey = new string[] { bizkey };
     try
     {
         businessDetail businessDetail = uddiInquiryService.get_businessDetail(gbd);
         if (businessDetail != null && businessDetail.businessEntity != null)
         {
             if (businessDetail.businessEntity[0].Signature != null && businessDetail.businessEntity[0].Signature.Length > 0)
             {
                 log.info("the business with key=" + bizkey + " exists and is digitally signed");
                 return true;
             }
         }
     }
     catch (Exception ex)
     {
         log.info("Error caught checking for the existence of and if a signature is present for business key " + bizkey, ex);
         throw new UnexpectedResponseException("Error caught checking for the existence of and if a signature is present for business key " + bizkey, ex);
     }
     return false;
 }
 /**
  * return true if and only if the binding exists and is signed
  *
  * @param bindingKey
  * @param uddiInquiryService
  * @param token
  * @param behavior
  * @return
  */
 private static bool CheckExistingBindingForSignature(String bindingKey, UDDI_Inquiry_SoapBinding uddiInquiryService, String token, SignatureBehavior behavior)
 {
     get_bindingDetail gbd = new get_bindingDetail();
     gbd.authInfo = (token);
     gbd.bindingKey = new string[] { bindingKey };
     try
     {
         bindingDetail bindingDetail = uddiInquiryService.get_bindingDetail(gbd);
         if (bindingDetail != null
                 && bindingDetail.bindingTemplate != null
                 && bindingDetail.bindingTemplate.Length > 0
                 && bindingDetail.bindingTemplate[0].Signature != null
                 && bindingDetail.bindingTemplate[0].Signature.Length > 0)
         {
             log.info("the binding template with key=" + bindingKey + " exists and is digitally signed");
         }
         return true;
     }
     catch (Exception ex)
     {
         log.debug("Error caught checking for the existence of and if a signature is present for binding key " + bindingKey + " this may be ignorable", ex);
     }
     return false;
 }