예제 #1
0
        private string getBindingURL(xmlsoap.schemas.easyWsdl.tPort tPort)
        {
            String bindingUrl = null;
            if (tPort.Any != null)
            {
                HashSet<XmlElement>.Enumerator it = tPort.Any.GetEnumerator();
                while (it.MoveNext())
                {
                    String location = null;
                    if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                   it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap/", StringComparison.CurrentCultureIgnoreCase))
                    {

                        location = it.Current.GetAttribute("location");
                    }
                    else
                        if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                        it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/http/", StringComparison.CurrentCultureIgnoreCase))
                        {
                            location = it.Current.GetAttribute("location");
                        }
                        else

                            if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                        it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap12/", StringComparison.CurrentCultureIgnoreCase))
                            {
                                location = it.Current.GetAttribute("location");
                            }

                    Uri locationURI = new Uri(location);
                    if (locationURI != null)
                    {
                        bindingUrl = urlLocalizer.rewrite(locationURI);
                        break;
                    }
                }
            }
            return bindingUrl;
        }
예제 #2
0
        /// <summary>
        /// 
        /// Creates a UDDI Business Service.
        /// 
        /// </summary>
        /// <param name="serviceQName"></param>
        /// <param name="wsdlDefinition"></param>
        /// <returns></returns>
        private businessService createBusinessService(QName serviceQName, xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {
            log.debug("Constructing Service UDDI Information for " + serviceQName);
            businessService service = new businessService();
            // BusinessKey
            service.businessKey = (businessKey);
            // ServiceKey
            service.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));
            // Description
            String serviceDescription = "";
            // Override with the service description from the WSDL if present
            org.xmlsoap.schemas.easyWsdl.tService svc = wsdlDefinition.getService(serviceQName);
            if (svc != null && svc.documentation != null)
            {
                HashSet<XmlNode>.Enumerator it = svc.documentation.Any.GetEnumerator();
                while (it.MoveNext())
                {

                    if (it.Current.Value != null)
                    {
                        serviceDescription += it.Current.Value;
                    }
                }

            }
            if (String.IsNullOrEmpty(serviceDescription))
            {
                serviceDescription = properties.getProperty(Property.SERVICE_DESCRIPTION, Property.DEFAULT_SERVICE_DESCRIPTION);
            }

            service.description = Common2UDDI.mapdescription(serviceDescription, lang).ToArray();
            // Service name
            name sName = new name();
            sName.lang = (lang);
            sName.Value = (serviceQName.getLocalPart());
            service.name = new name[] { sName };

            categoryBag categoryBag = new categoryBag();

            String ns = serviceQName.getNamespaceURI();
            List<keyedReference> cbitems = new List<keyedReference>();
            if (ns != null && ns != "")
            {
                keyedReference namespaceReference = newKeyedReference(
                        "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                cbitems.Add(namespaceReference);
            }

            keyedReference serviceReference = newKeyedReference(
                    "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "service");
            cbitems.Add(serviceReference);

            keyedReference localNameReference = newKeyedReference(
                    "uddi:uddi.org:xml:localname", "uddi-org:xml:localName", serviceQName.getLocalPart());
            cbitems.Add(localNameReference);
            categoryBag.Items = (object[])cbitems.ToArray();
            service.categoryBag = categoryBag;

            return service;
        }
예제 #3
0
        private bindingTemplate createWSDLBinding(QName serviceQName, string portName, Uri serviceUrl, xmlsoap.schemas.easyWsdl.tDefinitions wsdlDefinition)
        {
            bindingTemplate bindingTemplate = new bindingTemplate();
            // Set BusinessService Key
            bindingTemplate.serviceKey = (UDDIKeyConvention.getServiceKey(properties, serviceQName.getLocalPart()));

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

            org.xmlsoap.schemas.easyWsdl.tService service = wsdlDefinition.getService(serviceQName);
            if (service != null)
            {
                List<tModelInstanceInfo> tii = new List<tModelInstanceInfo>();

                org.xmlsoap.schemas.easyWsdl.tPort port = service.getPort(portName);
                if (port != null)
                {
                    if (serviceUrl == null)
                    {
                        if (port.Any != null)
                        {
                            HashSet<XmlElement>.Enumerator it = port.Any.GetEnumerator();
                            while (it.MoveNext())
                            {
                                String location = null;
                                if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                    it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap/", StringComparison.CurrentCultureIgnoreCase))
                                {

                                    location = it.Current.GetAttribute("location");
                                }
                                else
                                    if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                    it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/http/", StringComparison.CurrentCultureIgnoreCase))
                                    {
                                        location = it.Current.GetAttribute("location");
                                    }
                                    else

                                        if (it.Current.LocalName.Equals("address", StringComparison.CurrentCultureIgnoreCase) &&
                                    it.Current.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap12/", StringComparison.CurrentCultureIgnoreCase))
                                        {
                                            location = it.Current.GetAttribute("location");
                                        }
                                if (location != null)
                                {
                                    try
                                    {
                                        Uri locationURI = new Uri(location);
                                        accessPoint accessPoint = new accessPoint();
                                        accessPoint.useType = (AccessPointType.endPoint.ToString());
                                        accessPoint.Value = (urlLocalizer.rewrite(locationURI));
                                        bindingTemplate.Item = (accessPoint);
                                        // Set Binding Key
                                        String bindingKey = UDDIKeyConvention.getBindingKey(properties, serviceQName, portName, locationURI);
                                        bindingTemplate.bindingKey = (bindingKey);
                                        break;
                                    }
                                    catch (Exception e)
                                    {
                                        log.error("", e);
                                    }
                                }
                            }
                        }

                    }
                    XmlQualifiedName bx = port.binding;
                    org.xmlsoap.schemas.easyWsdl.tBinding bindingelement = wsdlDefinition.getBinding(bx);
                    // Set the Binding Description
                    String bindingDescription = "";
                    // Override with the service description from the WSDL if present

                    if (bindingelement != null && bindingelement.documentation != null
                        && bindingelement.documentation.Any != null)
                    {
                        HashSet<XmlNode>.Enumerator it = bindingelement.documentation.Any.GetEnumerator();
                        while (it.MoveNext())
                        {
                            bindingDescription += it.Current.Value;
                        }
                    }
                    if (String.IsNullOrEmpty(bindingDescription))
                        bindingDescription = properties.getProperty(Property.BINDING_DESCRIPTION, Property.DEFAULT_BINDING_DESCRIPTION); ;

                    bindingTemplate.description = Common2UDDI.mapdescription(bindingDescription, lang).ToArray();

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

                    tModelInstanceInfoBinding.description = Common2UDDI.mapdescription("The wsdl:binding that this wsdl:port implements. " + bindingDescription
                            + " The instanceParms specifies the port local name.", lang).ToArray();
                    tii.Add(tModelInstanceInfoBinding);

                    // reference wsdl:portType tModel
                    org.xmlsoap.schemas.easyWsdl.tPortType portType = wsdlDefinition.getPortType(bindingelement.type);
                    tModelInstanceInfo tModelInstanceInfoPortType = new tModelInstanceInfo();
                    tModelInstanceInfoPortType.tModelKey = (keyDomainURI + portType.name);
                    String portTypeDescription = "";
                    if (portType.documentation != null && portType.documentation.Any != null)
                    {
                        HashSet<XmlNode>.Enumerator it = portType.documentation.Any.GetEnumerator();
                        while (it.MoveNext())
                        {
                            portTypeDescription += it.Current.Value;
                        }
                    }

                    tModelInstanceInfoPortType.description = Common2UDDI.mapdescription("The wsdl:portType that this wsdl:port implements." + portTypeDescription,lang).ToArray();
                    tii.Add(tModelInstanceInfoPortType);

                    bindingTemplate.tModelInstanceDetails = tii.ToArray();
                }
                else
                {
                    log.error("Could not find Port with portName: " + portName);
                }
            }
            else
            {
                log.error("Could not find Service with serviceName: " + serviceQName.getLocalPart());
            }

            return bindingTemplate;
        }