Exemple #1
0
 public XRegistration(String entityKey, UDDIClerk fromClerk,
     UDDIClerk toClerk)
 {
     this.fromClerk = fromClerk;
     this.toClerk = toClerk;
     this.entityKey = entityKey;
 }
        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");

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

                clerk = clerkManager.getClerk("default");

               clerk   newclerk = new clerk();
               newclerk.node = new node();
                newclerk.node.name = "juddicloud";
                newclerk.publisher = "root";
                newclerk.password = "******";

                newclerk.name = "juddicloud";
                UDDIClerk cc =new UDDIClerk(newclerk);

                  save_clerk saveClerk = new save_clerk();
                saveClerk.authInfo = clerk.getAuthToken(clerk.getUDDINode().getSecurityUrl());
                saveClerk.clerk = new clerk[] { newclerk };
              clerk[] ret=  juddi.save_Clerk(saveClerk);

              Console.Out.WriteLine(ret.Length);

            }
            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();
            }
        }
Exemple #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;
            }
        }
 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;
     }
     }
 }
Exemple #5
0
 public void setToClerk(UDDIClerk toClerk)
 {
     this.toClerk = toClerk;
 }
Exemple #6
0
 public void setFromClerk(UDDIClerk fromClerk)
 {
     this.fromClerk = fromClerk;
 }
Exemple #7
0
        /// <summary>
        /// 
        /// Required Properties are: businessName, for example: &#39;Apache&#39; nodeName,
        /// for example: &#39;uddi.example.org_80&#39; keyDomain, for example:
        /// juddi.apache.org
        /// 
        /// Optional Properties are: lang: for example: &#39;nl&#39;
        /// 
        /// </summary>
        /// <param name="clerk">can be null if register/unregister methods are not used.</param>
        /// <param name="urlLocalizer">A reference to an custom</param>
        /// <param name="properties">required values keyDomain, businessKey, nodeName</param>
        /// <exception cref="ConfigurationException"></exception>
        public WSDL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties)
        {
            if (properties == null)
                throw new ArgumentNullException("properties");
            this.clerk = clerk;
            this.urlLocalizer = urlLocalizer;
            this.properties = properties;

            if (clerk != null)
            {
                if (!properties.containsKey("keyDomain"))
                {
                    throw new ConfigurationErrorsException("Property keyDomain is a required property when using WSDL2UDDI.");
                }
                if (!properties.containsKey("businessKey") && !properties.containsKey("businessName"))
                {
                    throw new ConfigurationErrorsException("Either property businessKey, or businessName, is a required property when using WSDL2UDDI.");
                }
                if (!properties.containsKey("nodeName"))
                {
                    if (properties.containsKey("serverName") && properties.containsKey("serverPort"))
                    {
                        String nodeName = properties.getProperty("serverName") + "_" + properties.getProperty("serverPort");
                        properties.setProperty("nodeName", nodeName);
                    }
                    else
                    {
                        throw new ConfigurationErrorsException("Property nodeName is not defined and is a required property when using WSDL2UDDI.");
                    }
                }
            }

            //Obtaining values from the properties
            this.keyDomainURI = "uddi:" + properties.getProperty("keyDomain") + ":";
            if (properties.containsKey(Property.BUSINESS_KEY))
            {
                this.businessKey = properties.getProperty(Property.BUSINESS_KEY);
            }
            else
            {
                //using the BusinessKey Template, and the businessName to construct the key
                this.businessKey = UDDIKeyConvention.getBusinessKey(properties);
            }
            this.lang = properties.getProperty(Property.LANG, Property.DEFAULT_LANG);
        }
Exemple #8
0
        /// <summary>
        ///  This calls a jUDDI implementation specific API call and is used to help 
        /// configure internode communication between jUDDI servers. This is NOT 
        /// part of the UDDI specification. Note: this API call should only
        /// be used with secure ports (SSL/TLS)
        /// </summary>
        /// <param name="senderClerk"></param>
        /// <returns></returns>
        public clerk[] saveClerk(UDDIClerk senderClerk)
        {
            clerk[] clerkDetail = null;
            try
            {
                log.debug("Sending Clerk " + senderClerk.getName() + " info to jUDDI " + getUDDINode().getName());
                save_clerk saveClerk = new save_clerk();
                saveClerk.authInfo = (getAuthToken(senderClerk.getUDDINode().getSecurityUrl()));
                saveClerk.clerk = new clerk[] { (getApiClerk()) };
                clerkDetail = getUDDINode().getTransport().getJUDDIApiService(senderClerk.getUDDINode().getJuddiApiUrl()).save_Clerk(saveClerk);
            }
            catch (Exception e)
            {
                log.error("Unable to save clerk " + getName()
                        + " ." + e.Message, e);
            }

            return clerkDetail;
        }
Exemple #9
0
        private Dictionary<String, UDDIClerk> readClerkConfig(uddi config, Dictionary<String, UDDINode> uddiNodes)
        {
            clientName = config.client.name;
            Dictionary<String, UDDIClerk> clerks = new Dictionary<String, UDDIClerk>();
            if (config.client.clerks != null && config.client.clerks.clerk != null && config.client.clerks.clerk.Length > 0)//.ContainsKey("client.clerks.clerk[@name]"))
            {

                log.debug("clerk names=" + config.client.clerks.clerk.Length);
                for (int i = 0; i < config.client.clerks.clerk.Length; i++)
                {
                    UDDIClerk uddiClerk = new UDDIClerk();
                    uddiClerk.setManagerName(clientName);
                    uddiClerk.setName(config.client.clerks.clerk[i].name);
                    String nodeRef = config.client.clerks.clerk[i].node;
                    if (!uddiNodes.ContainsKey(nodeRef)) throw new ConfigurationErrorsException("Could not find Node with name=" + nodeRef);
                    UDDINode uddiNode = uddiNodes[nodeRef];
                    uddiClerk.setUDDInode(uddiNode);
                    uddiClerk.setPublisher(config.client.clerks.clerk[i].publisher);
                    uddiClerk.setPassword(config.client.clerks.clerk[i].password);
                    uddiClerk.setPasswordEncrypted(config.client.clerks.clerk[i].isPasswordEncrypted);
                    uddiClerk.setCryptoProvider(config.client.clerks.clerk[i].cryptoProvider);

                    String clerkBusinessKey = config.client.clerks.clerk[i].businessKey;
                    String clerkBusinessName = config.client.clerks.clerk[i].businessName;
                    String clerkKeyDomain = config.client.clerks.clerk[i].keyDomain;

                    String[] classes = config.client.clerks.clerk[i].@class;
                    uddiClerk.setClassWithAnnotations(classes);

                    int numberOfWslds = 0;
                    if (config.client.clerks.clerk[i].wsdl != null)
                        numberOfWslds = config.client.clerks.clerk[i].wsdl.Length;// config.getStringArray("client.clerks.clerk(" + i + ").wsdl").Length;
                    if (numberOfWslds > 0)
                    {
                        UDDIClerk.WSDL[] wsdls = new UDDIClerk.WSDL[numberOfWslds];
                        for (int w = 0; w < wsdls.Length; w++)
                        {
                            UDDIClerk.WSDL wsdl = new UDDIClerk.WSDL();
                            String fileName = config.client.clerks.clerk[i].wsdl[w].Value;
                            wsdl.setFileName(null);
                            String businessKey = config.client.clerks.clerk[i].wsdl[w].businessKey;
                            String businessName = config.client.clerks.clerk[i].wsdl[w].businessName;
                            String keyDomain = config.client.clerks.clerk[i].wsdl[w].keyDomain;
                            if (businessKey == null) businessKey = clerkBusinessKey;
                            if (businessKey == null) businessKey = uddiClerk.getUDDINode().getProperties().getString("businessKey");
                            if (businessKey == null)
                            {
                                //use key convention to build the businessKey
                                if (businessName == null) businessName = clerkBusinessName;
                                if (keyDomain == null) keyDomain = clerkKeyDomain;
                                if (keyDomain == null) keyDomain = uddiClerk.getUDDINode().getProperties().getString("keyDomain");
                                if ((businessName == null && !uddiClerk.getUDDINode().getProperties().containsKey("businessName"))
                                    || keyDomain == null && !uddiClerk.getUDDINode().getProperties().containsKey("keyDomain")) throw new ConfigurationErrorsException("Either the wsdl(" + wsdls[w]
                                         + ") or clerk (" + uddiClerk.getName() + ") elements require a businessKey, or businessName & keyDomain attributes");
                                else
                                {
                                    Properties properties = (uddiClerk.getUDDINode().getProperties());
                                    if (businessName != null) properties.setProperty("businessName", businessName);
                                    if (keyDomain != null) properties.setProperty("keyDomain", keyDomain);
                                    businessKey = UDDIKeyConvention.getBusinessKey(properties);
                                }
                            }
                            if (!businessKey.ToLower().StartsWith("uddi:") || !businessKey.Substring(5).Contains(":"))
                            {
                                throw new ConfigurationErrorsException("The businessKey " + businessKey + " does not implement a valid UDDI v3 key format.");
                            }
                            wsdl.setBusinessKey(businessKey);
                            if (keyDomain == null)
                            {
                                keyDomain = businessKey.Split(new string[] { ":" }, StringSplitOptions.RemoveEmptyEntries)[1];
                            }
                            wsdl.setKeyDomain(keyDomain);
                            wsdls[w] = wsdl;
                        }
                        uddiClerk.setWsdls(wsdls);
                    }

                    clerks.Add(uddiClerk.getName(), uddiClerk);
                }
            }
            else
                log.warn("No clerks are defined!");
            return clerks;
        }