Exemplo n.º 1
0
 public static overviewDoc[] MapOverviewDoc(uddi.apiv2.overviewDoc overviewDoc)
 {
     if (overviewDoc == null) return null;
     overviewDoc x = new overviewDoc();
     x.descriptions = MapDescription(overviewDoc.description);
     x.overviewURLs = MapOverviewUrl(overviewDoc.overviewURL);
     return new overviewDoc[] { x };
 }
Exemplo n.º 2
0
        public void xr_overviewDoc()
        {
            Console.Out.WriteLine("serialization xr_overviewDoc");
            overviewDoc r = new overviewDoc();
            description d = new description("v", "en");
            overviewURL ol = new overviewURL("http://url", "website");

            r.overviewURLs = new overviewURL[] { ol };
            r.descriptions = new description[] { d };
            XmlSerializer xr = new XmlSerializer(typeof(overviewDoc));
            StringWriter sw = new StringWriter();
            xr.Serialize(sw, r);
            System.Console.Out.WriteLine(sw.ToString());
        }
Exemplo n.º 3
0
        /// <summary>
        /// 
        /// &lt;h3&gt;2.4.1 wsdl:portType -&gt; uddi:tModel&lt;/h3&gt;
        /// 
        /// &lt;p&gt;A wsdl:portType MUST be modeled as a uddi:tModel.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The minimum information that must be captured about a portType is its
        /// entity type, its local name, its namespace, and the location of the WSDL
        /// document that defines the portType. Capturing the entity type enables
        /// users to search for tModels that represent portType artifacts. Capturing
        /// the local name, namespace, and WSDL location enables users to locate the
        /// definition of the specified portType artifact.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The wsdl:portType information is captured as follows:&lt;/p&gt;
        /// 
        /// &lt;p&gt;The uddi:name element of the tModel MUST be the value of the name
        /// attribute of the wsdl:portType.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The tModel MUST contain a categoryBag, and the categoryBag MUST
        /// contain a keyedReference with a tModelKey of the WSDL Entity Type
        /// category system and a keyValue of &quot;portType&quot;.&lt;/p&gt;
        /// 
        /// &lt;p&gt;If the wsdl:portType has a targetNamespace then the categoryBag MUST
        /// also contain an additional keyedReference with a tModelKey of the XML
        /// Namespace category system and a keyValue of the target namespace of the
        /// wsdl:definitions element that contains the wsdl:portType. If the
        /// targetNamespace is absent from the portType, a categoryBag MUST NOT
        /// contain a keyedReference to the XML Namespace category system.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The tModel MUST contain an overviewDoc with an overviewURL containing
        /// the location of the WSDL document that describes the wsdl:portType.&lt;/p&gt;
        /// Example Code
        /// &lt;pre&gt;
        /// URL url = new URL(&quot;http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl&quot;);
        /// String domain = url.getHost();
        /// ReadWSDL rw = new ReadWSDL();
        /// Definition wsdlDefinition = rw.readWSDL(url);
        /// properties.put(&quot;keyDomain&quot;, domain);
        /// properties.put(&quot;businessName&quot;, domain);
        /// properties.put(&quot;serverName&quot;, url.getHost());
        /// properties.put(&quot;serverPort&quot;, url.getPort());
        /// wsdlURL = wsdlDefinition.getDocumentBaseURI();
        /// WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
        /// Map&lt;QName, PortType&gt; portTypes = (Map&lt;QName, PortType&gt;) wsdlDefinition.getAllPortTypes();
        /// Set&lt;TModel&gt; portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
        /// &lt;/pre&gt;
        /// 
        /// </summary>
        /// <param name="wsdlURL">This is used to set the Overview URL</param>
        /// <param name="portTypes">Map</param>
        /// <returns>set of WSDL PortType tModels</returns>
        /// <exception cref="Exception"></exception>
        public List<tModel> createWSDLPortTypeTModels(string wsdlURL, Dictionary<QName, xmlsoap.schemas.easyWsdl.tPortType> portTypes)
        {
            List<tModel> tModels = new List<tModel>();
            Dictionary<QName, xmlsoap.schemas.easyWsdl.tPortType>.Enumerator it = portTypes.GetEnumerator();
            while (it.MoveNext())
            {
                QName qName = it.Current.Key;
                tModel tModel = new tModel();
                String localpart = qName.getLocalPart();
                String ns = qName.getNamespaceURI();
                // Set the Key
                tModel.tModelKey = (keyDomainURI + localpart);

                // Set the Name. The uddi:name element of the tModel MUST be the value of
                // the name attribute of the wsdl:portType.
                name name = new name();
                name.lang = (lang);
                name.Value = (localpart);
                tModel.name = (name);
                // Set the OverviewURL. The tModel MUST contain an overviewDoc with an
                // overviewURL containing the location of the WSDL document that
                // describes the wsdl:portType.
                overviewURL overviewURL = new overviewURL();
                overviewURL.useType = (AccessPointType.wsdlDeployment.ToString());
                overviewURL.Value = (wsdlURL);
                overviewDoc overviewDoc = new overviewDoc();
                overviewDoc.overviewURLs = new overviewURL[] { (overviewURL) };
                tModel.overviewDoc = new overviewDoc[] { (overviewDoc) };
                // Create the categoryBag, The tModel MUST contain a categoryBag
                categoryBag categoryBag = new categoryBag();

                List<keyedReference> cbitems = new List<keyedReference>();
                // the categoryBag MUST contain a keyedReference with a tModelKey of the WSDL
                // Entity Type category system and a keyValue of "portType".
                keyedReference typesReference = newKeyedReference(
                        "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "portType");
                cbitems.Add(typesReference);

                // If the wsdl:portType has a targetNamespace then the categoryBag MUST also contain an
                // additional keyedReference with a tModelKey of the XML Namespace category system and a
                // keyValue of the target namespace of the wsdl:definitions element that contains the
                // wsdl:portType. If the targetNamespace is absent from the portType, a categoryBag
                // MUST NOT contain a keyedReference to the XML Namespace category system.
                if (ns != null && !"".Equals(ns))
                {
                    keyedReference namespaceReference = newKeyedReference(
                            "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                    cbitems.Add(namespaceReference);
                }

                categoryBag.Items = (object[])cbitems.ToArray();
                tModel.categoryBag = categoryBag;

                tModels.Add(tModel);

            }
            return tModels;
        }
Exemplo n.º 4
0
        /// <summary>
        /// 
        /// &lt;h3&gt;2.4.1 wsdl:portType -&gt; uddi:tModel&lt;/h3&gt;
        /// 
        /// &lt;p&gt;A wsdl:portType MUST be modeled as a uddi:tModel.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The minimum information that must be captured about a portType is its
        /// entity type, its local name, its namespace, and the location of the WSDL
        /// document that defines the portType. Capturing the entity type enables
        /// users to search for tModels that represent portType artifacts. Capturing
        /// the local name, namespace, and WSDL location enables users to locate the
        /// definition of the specified portType artifact.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The wsdl:portType information is captured as follows:&lt;/p&gt;
        /// 
        /// &lt;p&gt;The uddi:name element of the tModel MUST be the value of the name
        /// attribute of the wsdl:portType.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The tModel MUST contain a categoryBag, and the categoryBag MUST
        /// contain a keyedReference with a tModelKey of the WSDL Entity Type
        /// category system and a keyValue of &quot;portType&quot;.&lt;/p&gt;
        /// 
        /// &lt;p&gt;If the wsdl:portType has a targetNamespace then the categoryBag MUST
        /// also contain an additional keyedReference with a tModelKey of the XML
        /// Namespace category system and a keyValue of the target namespace of the
        /// wsdl:definitions element that contains the wsdl:portType. If the
        /// targetNamespace is absent from the portType, a categoryBag MUST NOT
        /// contain a keyedReference to the XML Namespace category system.&lt;/p&gt;
        /// 
        /// &lt;p&gt;The tModel MUST contain an overviewDoc with an overviewURL containing
        /// the location of the WSDL document that describes the wsdl:portType.&lt;/p&gt;
        /// Example Code
        /// &lt;pre&gt;
        /// URL url = new URL(&quot;http://graphical.weather.gov/xml/SOAP_server/ndfdXMLserver.php?wsdl&quot;);
        /// String domain = url.getHost();
        /// ReadWSDL rw = new ReadWSDL();
        /// Definition wsdlDefinition = rw.readWSDL(url);
        /// properties.put(&quot;keyDomain&quot;, domain);
        /// properties.put(&quot;businessName&quot;, domain);
        /// properties.put(&quot;serverName&quot;, url.getHost());
        /// properties.put(&quot;serverPort&quot;, url.getPort());
        /// wsdlURL = wsdlDefinition.getDocumentBaseURI();
        /// WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
        /// Map&lt;QName, PortType&gt; portTypes = (Map&lt;QName, PortType&gt;) wsdlDefinition.getAllPortTypes();
        /// Set&lt;TModel&gt; portTypeTModels = wsdl2UDDI.createWSDLPortTypeTModels(wsdlURL, portTypes);
        /// &lt;/pre&gt;
        /// 
        /// </summary>
        /// <param name="wsdlURL">This is used to set the Overview URL</param>
        /// <param name="portType">Map</param>
        /// @return set of WSDL PortType tModels
        /// <exception cref="Exception"></exception>
        public List<tModel> createWSDLBindingTModels(string wsdlURL, Dictionary<QName, xmlsoap.schemas.easyWsdl.tBinding> bindings)
        {
            List<tModel> tModels = new List<tModel>();
            Dictionary<QName, xmlsoap.schemas.easyWsdl.tBinding>.Enumerator it = bindings.GetEnumerator();
            while (it.MoveNext())
            {
                QName qName = it.Current.Key;
                String localpart = qName.getLocalPart();
                String ns = qName.getNamespaceURI();
                // Build the tModel
                tModel tModel = new tModel();
                // Set the Key
                tModel.tModelKey = (keyDomainURI + localpart);
                // Set the Name
                name name = new name();
                name.lang = (lang);
                name.Value = (localpart);
                tModel.name = (name);
                // Set the OverviewURL
                overviewURL overviewURL = new overviewURL();
                overviewURL.useType = (AccessPointType.wsdlDeployment.ToString());
                overviewURL.Value = (wsdlURL);
                overviewDoc overviewDoc = new overviewDoc();
                overviewDoc.overviewURLs = new overviewURL[] { (overviewURL) };
                tModel.overviewDoc = new overviewDoc[] { (overviewDoc) };
                // Set the categoryBag
                categoryBag categoryBag = new categoryBag();

                List<keyedReference> cbitems = new List<keyedReference>();
                if (ns != null && !"".Equals(ns))
                {
                    // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                    keyedReference namespaceReference = newKeyedReference(
                            "uddi:uddi.org:xml:namespace", "uddi-org:xml:namespace", ns);
                    cbitems.Add(namespaceReference);
                }

                // A keyedReference with a tModelKey of the WSDL Entity Type category system and a keyValue of "binding".
                keyedReference typesReference = newKeyedReference(
                        "uddi:uddi.org:wsdl:types", "uddi-org:wsdl:types", "binding");
                cbitems.Add(typesReference);

                // A keyedReference with a tModelKey of the WSDL portType Reference category system and a keyValue
                // of the tModelKey that models the wsdl:portType to which the wsdl:binding relates.

                org.xmlsoap.schemas.easyWsdl.tBinding binding = bindings[(qName)];
                String portTypeKey = keyDomainURI + binding.type.Name;
                keyedReference namespaceReference2 = newKeyedReference(
                        "uddi:uddi.org:wsdl:porttypereference", "uddi-org:wsdl:portTypeReference",
                        portTypeKey);
                cbitems.Add(namespaceReference2);

                //  A keyedReference with a tModelKey of the UDDI Types category system and a keyValue of
                // "wsdlSpec" for backward compatibility.
                keyedReference typesReferenceBackwardsCompatible = newKeyedReference(
                        "uddi:uddi.org:categorization:types", "uddi-org:types", "wsdlSpec");
                cbitems.Add(typesReferenceBackwardsCompatible);

                // One or two keyedReferences as required to capture the protocol
                foreach (XmlElement xe in binding.Any)
                {

                    if (xe.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap/", StringComparison.CurrentCultureIgnoreCase)
                        && xe.LocalName.Equals("binding", StringComparison.CurrentCultureIgnoreCase))
                    {

                        // If the wsdl:binding contains a soap:binding extensibility element from the
                        // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                        //include a keyedReference with a tModelKey of the Protocol Categorization
                        // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.

                        keyedReference soapProtocol = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                        cbitems.Add(soapProtocol);
                        // If the value of the transport attribute of the soap:binding element
                        // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                        // include a keyedReference with a tModelKey of the Transport Categorization
                        // category system and a keyValue of the tModelKey of the HTTP Transport tModel.

                        if (String.IsNullOrEmpty(xe.GetAttribute("transport")))
                        {
                            // TODO If the value of the transport attribute is anything else,
                            // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                            // of the Transport Categorization category system and a keyValue of the tModelKey of
                            // an appropriate transport tModel.
                            log.warn("empty soap transport for binding " + it.Current.Key.getLocalPart() + " " + it.Current.Key.getNamespaceURI());
                        }
                        else
                        {
                            String attr = xe.GetAttribute("transport");

                            if (attr != null && attr.Equals("http://schemas.xmlsoap.org/soap/http"))
                            {
                                keyedReference httpTransport = newKeyedReference(
                                       "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                                cbitems.Add(httpTransport);
                            }
                            else
                            {
                                log.warn("i don't know how to process the soap transport value of " + xe.GetAttribute("transport", "http://schemas.xmlsoap.org/wsdl/soap/"));
                            }
                        }
                    }
                    else if (xe.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/http/", StringComparison.CurrentCultureIgnoreCase)
                      && xe.LocalName.Equals("binding", StringComparison.CurrentCultureIgnoreCase))
                    {

                        // If the wsdl:binding contains an http:binding extensibility element from the
                        // http://schemas.xmlsoap.org/wsdl/http/ namespace then the categoryBag MUST
                        // include a keyedReference with a tModelKey of the Protocol Categorization
                        // category system and a keyValue of the tModelKey of the HTTP Protocol tModel.
                        keyedReference soapProtocol = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:http", "uddi:uddi.org:protocol:http");
                        cbitems.Add(soapProtocol);
                    }
                    else if (xe.NamespaceURI.Equals("http://schemas.xmlsoap.org/wsdl/soap12/", StringComparison.CurrentCultureIgnoreCase)
                        && xe.LocalName.Equals("binding", StringComparison.CurrentCultureIgnoreCase))
                    {
                        // If the wsdl:binding contains a soap:binding extensibility element from the
                        // 'http://schemas.xmlsoap.org/wsdl/soap/' namespace then the categoryBag MUST
                        //include a keyedReference with a tModelKey of the Protocol Categorization
                        // category system and a keyValue of the tModelKey of the SOAP Protocol tModel.

                        keyedReference soapProtocol = newKeyedReference(
                                "uddi:uddi.org:wsdl:categorization:protocol", "uddi-org:protocol:soap", "uddi:uddi.org:protocol:soap");
                        cbitems.Add(soapProtocol);
                        // If the value of the transport attribute of the soap:binding element
                        // is 'http://schemas.xmlsoap.org/soap/http' then the categoryBag MUST
                        // include a keyedReference with a tModelKey of the Transport Categorization
                        // category system and a keyValue of the tModelKey of the HTTP Transport tModel.

                        if (String.IsNullOrEmpty(xe.GetAttribute("transport")))
                        {
                            // TODO If the value of the transport attribute is anything else,
                            // then the bindingTemplate MUST include an additional keyedReference with a tModelKey
                            // of the Transport Categorization category system and a keyValue of the tModelKey of
                            // an appropriate transport tModel.
                            log.warn("empty soap transport for binding " + it.Current.Key.getLocalPart() + " " + it.Current.Key.getNamespaceURI());
                        }
                        else
                        {
                            String attr = xe.GetAttribute("transport");

                            if (attr != null && attr.Equals("http://schemas.xmlsoap.org/soap/http"))
                            {
                                keyedReference httpTransport = newKeyedReference(
                                       "uddi:uddi.org:wsdl:categorization:transport", "uddi-org:http", "uddi:uddi.org:transport:http");
                                cbitems.Add(httpTransport);
                            }
                            else
                            {
                                log.warn("i don't know how to process the soap transport value of " + xe.GetAttribute("transport", "http://schemas.xmlsoap.org/wsdl/soap/"));
                            }
                        }
                    }
                    else
                    {
                        log.warn("Unrecongnized binding type: " + xe.NamespaceURI + " " + xe.LocalName + ". Generated"
                            + "binding tModel may be missing the required (according to WSDL2UDDI spec) "
                            + "uddi:uddi.org:wsdl:categorization:protocol keyedReference.");
                    }
                }

                categoryBag = new uddi.apiv3.categoryBag();
                categoryBag.Items = cbitems.ToArray();
                tModel.categoryBag = categoryBag;
                tModels.Add(tModel);
            }
            return tModels;
        }
Exemplo n.º 5
0
        /// <summary>
        /// 
        /// This is a convenience function that will build and return a TModelInstanceInfo
        /// as described in the following link that will enable you to tag web services
        /// registered in UDDI with some kind of version information.&lt;Br&gt;&lt;Br&gt;
        /// Article source: &lt;a href=&quot;http://www.ibm.com/developerworks/webservices/library/ws-version/&quot;&gt;http://www.ibm.com/developerworks/webservices/library/ws-version/&lt;/a&gt;
        /// &lt;Br&gt;&lt;Br&gt;
        /// 
        /// When using this tModel as a tModelInstance, it can be used to describe a
        /// version associated with either a service interface, a bindingTemplate
        /// service instance. Note: This is a jUDDI specific addon and may not be
        /// present in other registries
        /// 
        /// </summary>
        /// <param name="version">From the article, no specificity is provided on what to use as a value, but</param>
        /// we recommend that you use the string representation of major.minor[.build[.revision]].&lt;br&gt;
        /// Example
        /// &lt;ul&gt;
        /// &lt;li&gt;6.1.2.3&lt;/li&gt;
        /// &lt;li&gt;1.0&lt;/li&gt;
        /// &lt;li&gt;0.1&lt;/li&gt;
        /// &lt;/ul&gt;
        /// <returns>TModelInstanceInfo populated as described in the article, plus some descriptive information</returns>
        public static tModelInstanceInfo createServiceInterfaceVersion(String version, String lang)
        {
            if (version == null)
                throw new ArgumentNullException();
            tModelInstanceInfo tt = new tModelInstanceInfo();
            tt.tModelKey = (UDDIConstants.VERSION_TMODEL);
            tt.instanceDetails = new instanceDetails();

            overviewDoc doc = new overviewDoc();
            doc.overviewURLs = new overviewURL[] { (new overviewURL("http://www.ibm.com/developerworks/webservices/library/ws-version/", "text")) };
            //,new description(
            //"Describes a version associated with either a service interface, a bindingTemplate service instance.", lang)};
            tt.description = new description[] { new description("Describes a version associated with either a service interface, a bindingTemplate service instance.", lang) };

            tt.instanceDetails.Items = new overviewDoc[] { doc };
            tt.instanceDetails.instanceParms = version;

            //tt.instanceDetails.Items = new object[] { doc };
            return tt;
        }
Exemplo n.º 6
0
        /// <summary>
        /// 
        /// A helper function to create a tModel key generator.&lt;br&gt;
        /// Why would I want a key generator? In UDDIv3, you&#39;re suppose to specify what you want the keys (unique identifiers) to be, however there&#39;s
        /// a number of naming rules associated with the keys. Generally, use the FQDN of your business or organization.
        /// Optionally, when saving an UDDI entity, you can just leave the key name blank and the server
        /// should generate one for you. It&#39;s normally a UUID that&#39;s not easy to remember. In this case, there&#39;s no need to call this method. &lt;br&gt;&lt;br&gt;
        /// In addition, no changes are made to the UDDI server. You&#39;ll have to do that one using code similar to this:
        /// &lt;pre&gt;
        /// UDDIClerk clerk = ...
        /// TModel keygen = UDDIClerk.createKeyGenator(&quot;uddi:mydomain.com:keygenerator&quot;, &quot;my domain&quot;, &quot;en&quot;);
        /// clerk.register(keygen);
        /// 
        /// </summary>
        /// <param name="partitionName">think of this as the domain, i.e. juddi.apache.org, but it can really be anything you want. This will become part of the</param>
        /// key associated with the tModel generator (uddi:juddi.apache.org:keygenerator)
        /// <param name="DescriptiveName">required. max length is 255 char</param>
        /// <param name="DescriptiveNameLanguage">optional, max length is 26 char</param>
        /// <returns>a populated tModel entity representing a tModel key generator. No changes are made to any connect UDDI service</returns>
        /// @since 3.2
        public static tModel createKeyGenator(String partitionName, String DescriptiveName, String DescriptiveNameLanguage)
        {
            if (partitionName == null || partitionName.Length == 0)
            {
                throw new ArgumentOutOfRangeException();
            }

            if (DescriptiveName == null || DescriptiveName.Length == 0)
            {
                throw new ArgumentOutOfRangeException();
            }
            if (!partitionName.StartsWith("uddi:"))
            {
                partitionName = "uddi:" + partitionName;
               // throw new ArgumentOutOfRangeException("partitionName must have a 'uddi:' prefix");

            }
            if (!partitionName.EndsWith(":keygenerator"))
            {
                partitionName = partitionName + "keygenerator";
                //throw new ArgumentOutOfRangeException("partitionName must have a ':keyGenerator' postfix");
            }
            tModel tm = new tModel();
            tm.name = new name();
            tm.name.Value = (DescriptiveName);
            tm.name.lang = (DescriptiveNameLanguage);
            tm.categoryBag = new categoryBag();
            keyedReference kr = new keyedReference();
            kr.tModelKey = (UDDIConstants.KEY_GENERATOR_TMODEL);
            kr.keyName = (UDDIConstants.KEY_GENERATOR);
            kr.keyValue = (UDDIConstants.KEY_GENERATOR_VALUE);
            tm.categoryBag.Items = new object[] { kr };
            overviewDoc
                overviewDoc = new overviewDoc();
            overviewURL overviewUrl = new overviewURL();
            overviewUrl.useType = ("text");
            overviewUrl.Value = ("http://uddi.org/pubs/uddi_v3.htm#keyGen");
            overviewDoc.overviewURLs = new overviewURL[] { overviewUrl };
            tm.overviewDoc = new overviewDoc[] { overviewDoc };
            tm.tModelKey = (partitionName.ToLower());
            return tm;
        }