Ejemplo n.º 1
0
        public EndpointAddress GetEndpointAddress()
        {
            accessPoint accessPointItem = template.Item as accessPoint;

            if (accessPointItem == null)
            {
                throw new Exception("accessPoint type expected");
            }
            return(IdentifierUtility.GetEndpointAddressFromString(accessPointItem.Value));
        }
Ejemplo n.º 2
0
 public static void SendUnauthorizedAccessMail(user manager, user user, accessPoint accessPoint)
 {
     try
     {
         var body = string.Format("UnauthorizedAccess by User: {0}-{1}, AccessPoint {2}-{3}, Time : {4}",
                                  user.Id, user.FullName, accessPoint.Id, accessPoint.Name, DateTime.Now);
         Send("*****@*****.**", manager.Email, "Unauthorized Access", body);
     }
     catch (Exception)
     {
     }
 }
Ejemplo n.º 3
0
        /**
         * adds the typical REST tmodel references, but only if they aren't already present
         * @param bt
         * @return
         */
        public static bindingTemplate addRESTtModels(bindingTemplate bt)
        {
            List <tModelInstanceInfo> data = new List <tModelInstanceInfo>();

            if (bt.tModelInstanceDetails != null)
            {
                data.AddRange(bt.tModelInstanceDetails);
            }
            accessPoint ap = null;

            if (bt.Item is accessPoint)
            {
                ap = (accessPoint)bt.Item;
            }
            tModelInstanceInfo tModelInstanceInfo;

            if (!Exists(data, UDDIConstants.PROTOCOL_REST))
            {
                tModelInstanceInfo           = new tModelInstanceInfo();
                tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_REST);
                data.Add(tModelInstanceInfo);
            }

            if (ap != null && ap.Value != null && ap.Value.StartsWith("http:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_HTTP))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_HTTP);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("https:"))
            {
                if (!Exists(data, UDDIConstants.PROTOCOL_SSLv3))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SSLv3);
                    data.Add(tModelInstanceInfo);
                }
            }
            bt.tModelInstanceDetails = data.ToArray();
            return(bt);
        }
Ejemplo n.º 4
0
        protected bindingTemplate createWADLBinding(QName serviceQName, String portName, Uri serviceUrl, resources res)
        {
            bindingTemplate bindingTemplate = new bindingTemplate();

            // Set BusinessService Key
            bindingTemplate.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
            List <tModelInstanceInfo> items = new List <tModelInstanceInfo>();

            if (serviceUrl != null)
            {
                // Set AccessPoint
                accessPoint accessPoint = new accessPoint();
                accessPoint.useType  = (AccessPointType.endPoint.ToString());
                accessPoint.Value    = ((serviceUrl.ToString()));
                bindingTemplate.Item = (accessPoint);
                // Set Binding Key
                String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, serviceUrl);
                bindingTemplate.bindingKey = (bindingKey);

                bindingTemplate.description = Common2UDDI.mapdescription(getDescription(res.doc), lang).ToArray();

                // reference wsdl:binding tModel
                tModelInstanceInfo tModelInstanceInfoBinding = new tModelInstanceInfo();
                tModelInstanceInfoBinding.tModelKey = (keyDomainURI + "binding");
                instanceDetails id = new instanceDetails();
                id.instanceParms = portName;
                tModelInstanceInfoBinding.instanceDetails = (id);

                tModelInstanceInfoBinding.description = Common2UDDI.mapdescription("The binding that this endpoint implements. " + bindingTemplate.description[0].Value
                                                                                   + " The instanceParms specifies the port local name.", lang).ToArray();
                items.Add(tModelInstanceInfoBinding);

                tModelInstanceInfo tModelInstanceInfoPortType = new tModelInstanceInfo();
                tModelInstanceInfoPortType.tModelKey   = (keyDomainURI + "rest");
                tModelInstanceInfoPortType.description = Common2UDDI.mapdescription("The wadl:Resource:base implements.", lang).ToArray();
                items.Add(tModelInstanceInfoPortType);
            }
            bindingTemplate.tModelInstanceDetails = items.ToArray();
            return(bindingTemplate);
        }
Ejemplo n.º 5
0
        public static bindingTemplate MapBindingTemplate(uddi.apiv2.bindingTemplate bindingTemplate)
        {
            if (bindingTemplate == null)
            {
                return(null);
            }
            bindingTemplate r = new bindingTemplate();

            r.bindingKey  = bindingTemplate.bindingKey;
            r.description = MapDescription(bindingTemplate.description);
            r.serviceKey  = bindingTemplate.serviceKey;
            if (bindingTemplate.Item is org.uddi.apiv2.accessPoint)
            {
                org.uddi.apiv2.accessPoint old = new uddi.apiv2.accessPoint();
                accessPoint a = new accessPoint();
                a.Value   = old.Value;
                a.useType = old.URLType.ToString();
                r.Item    = a;
            }
            r.tModelInstanceDetails = MapTmodelInstanceDetail(bindingTemplate.tModelInstanceDetails);
            return(r);
        }
Ejemplo n.º 6
0
        /**
         * adds the typical SOAP tmodel references, but only if they aren't already present
         * @param bt
         * @return
         */
        public static bindingTemplate addSOAPtModels(bindingTemplate bt)
        {
            bool          found = false;
            List <object> cbags = new List <object>();

            if (bt.categoryBag != null)
            {
                cbags.AddRange(bt.categoryBag.Items);
            }

            for (int i = 0; i < cbags.Count; i++)
            {
                if (cbags[i] is keyedReference)
                {
                    keyedReference kr = (keyedReference)cbags[i];
                    if (kr.tModelKey != null &&
                        kr.tModelKey.Equals("uddi:uddi.org:categorization:types", StringComparison.CurrentCultureIgnoreCase))
                    {
                        if (kr.keyName != null &&
                            kr.keyName.Equals("uddi-org:types:wsdl", StringComparison.CurrentCultureIgnoreCase))
                        {
                            found = true;
                        }
                    }
                }
            }
            if (!found)
            {
                cbags.Add(new keyedReference("uddi:uddi.org:categorization:types", "uddi-org:types:wsdl", "wsdlDeployment"));
            }
            if (cbags.Count > 0)
            {
                if (bt.categoryBag == null)
                {
                    bt.categoryBag = new categoryBag();
                }
                bt.categoryBag.Items = cbags.ToArray();
            }

            List <tModelInstanceInfo> data = new List <tModelInstanceInfo>();

            if (bt.tModelInstanceDetails != null)
            {
                data.AddRange(bt.tModelInstanceDetails);
            }
            accessPoint ap = null;

            if (bt.Item is accessPoint)
            {
                ap = (accessPoint)bt.Item;
            }
            tModelInstanceInfo tModelInstanceInfo;

            if (!Exists(data, UDDIConstants.PROTOCOL_SOAP))
            {
                tModelInstanceInfo           = new tModelInstanceInfo();
                tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SOAP);
                data.Add(tModelInstanceInfo);
            }

            if (ap != null && ap.Value != null && ap.Value.StartsWith("http:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_HTTP))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_HTTP);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("jms:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_JMS))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_JMS);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("rmi:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_RMI))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_RMI);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("udp:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_UDP))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_UDP);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("amqp:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_AMQP))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_AMQP);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("mailto:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_EMAIL))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_EMAIL);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("ftp:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_FTP))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_FTP);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("https:"))
            {
                if (!Exists(data, UDDIConstants.PROTOCOL_SSLv3))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SSLv3);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("ftps:"))
            {
                if (!Exists(data, UDDIConstants.PROTOCOL_SSLv3))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.PROTOCOL_SSLv3);
                    data.Add(tModelInstanceInfo);
                }
            }
            if (ap != null && ap.Value != null && ap.Value.StartsWith("jndi:"))
            {
                if (!Exists(data, UDDIConstants.TRANSPORT_JNDI_RMI))
                {
                    tModelInstanceInfo           = new tModelInstanceInfo();
                    tModelInstanceInfo.tModelKey = (UDDIConstants.TRANSPORT_JNDI_RMI);
                    data.Add(tModelInstanceInfo);
                }
            }
            bt.tModelInstanceDetails = data.ToArray();
            return(bt);
        }
Ejemplo n.º 7
0
        private bindingTemplate parseServiceBinding(string classWithAnnotations, string lang, WebServiceBindingAttribute webServiceAnnotation, Properties properties)
        {
            bindingTemplate    bindingTemplate = null;
            Type               t = Type.GetType(classWithAnnotations, false, false);
            UDDIServiceBinding uddiServiceBinding = null;

            object[] attrib = t.GetCustomAttributes(typeof(UDDIServiceBinding), true);
            if (attrib != null && attrib.Length > 0)
            {
                uddiServiceBinding = attrib[0] as UDDIServiceBinding;
            }

            //= (UDDIServiceBinding) classWithAnnotations.getAnnotation(UDDIServiceBinding.class);
            //binding
            if (uddiServiceBinding != null)
            {
                bindingTemplate = new bindingTemplate();

                bindingTemplate.bindingKey = (TokenResolver.replaceTokens(uddiServiceBinding.bindingKey, properties));

                String bindingLang = (lang);
                if (uddiServiceBinding.lang != null)
                {
                    bindingLang = TokenResolver.replaceTokens(uddiServiceBinding.lang, properties);
                }
                description bindingDescription = new description();
                bindingDescription.lang     = (bindingLang);
                bindingDescription.Value    = (TokenResolver.replaceTokens(uddiServiceBinding.description, properties));
                bindingTemplate.description = new description[] { (bindingDescription) };

                accessPoint accessPoint = new accessPoint();
                accessPoint.useType = (AccessPointType.wsdlDeployment.ToString());
                if (!"".Equals(uddiServiceBinding.accessPointType))
                {
                    accessPoint.useType = (uddiServiceBinding.accessPointType);
                }
                if (!"".Equals(uddiServiceBinding.accessPoint))
                {
                    String endPoint = uddiServiceBinding.accessPoint;
                    endPoint = TokenResolver.replaceTokens(endPoint, properties);
                    log.debug("AccessPoint EndPoint=" + endPoint);
                    accessPoint.Value = (endPoint);
                }
                else if (webServiceAnnotation != null && webServiceAnnotation.Location != null)
                {
                    accessPoint.Value = (webServiceAnnotation.Location);
                }
                bindingTemplate.Item = (accessPoint);

                //tModelKeys on the binding
                if (!"".Equals(uddiServiceBinding.tModelKeys))
                {
                    String[] tModelKeys = uddiServiceBinding.tModelKeys.Split(',');
                    foreach (String tModelKey in tModelKeys)
                    {
                        tModelInstanceInfo instanceInfo = new tModelInstanceInfo();
                        instanceInfo.tModelKey = (tModelKey);
                        if (bindingTemplate.tModelInstanceDetails == null)
                        {
                            bindingTemplate.tModelInstanceDetails = (new tModelInstanceInfo[] { instanceInfo });
                        }
                        List <tModelInstanceInfo> l = new List <tModelInstanceInfo>();
                        l.AddRange(bindingTemplate.tModelInstanceDetails);
                        l.Add(instanceInfo);
                        bindingTemplate.tModelInstanceDetails = l.ToArray();
                    }
                }
                //categoryBag on the binding
                if (!"".Equals(uddiServiceBinding.categoryBag))
                {
                    categoryBag categoryBag = parseCategoryBag(uddiServiceBinding.categoryBag);
                    bindingTemplate.categoryBag = (categoryBag);
                }
            }
            else
            {
                log.error("Missing UDDIServiceBinding annotation in class " + classWithAnnotations);
            }
            return(bindingTemplate);
        }