Click here to Skip to main content
15,886,806 members
Articles / Programming Languages / C#

UDDI Explorer: Tool for Searching Web Services

Rate me:
Please Sign up or sign in to vote.
4.93/5 (49 votes)
20 Dec 200517 min read 221.8K   3.2K   109  
Tool for searching web service(s) and viewing their WSDL information
using System;
using System.Xml;
using System.Xml.Schema;
using System.Xml.Serialization;

namespace WSDLParser
{
	/// <summary>
	/// Summary description for NamespaceHandler.
	/// </summary>
	public class SchemaHelper
	{

        public static string[] simpleTypes = new string[] {
																	   "anyURI",
																	   "base64Binary",
																	   "boolean",
																	   "byte",
																	   "date",
																	   "dateTime",
																	   "decimal",
																	   "double",
																	   "duration",
																	   "ENTITY",
																	   "float",
																	   "gDay",
																	   "gMonth",
																	   "gMonthDay",
																	   "gYear",
																	   "gYearMonth",
																	   "hexBinary",
																	   "ID",
																	   "IDREF",
																	   "integer",
																	   "int",
																	   "language",
																	   "long",
																	   "Name",
																	   "NCName",
																	   "negativeInteger",
																	   "NMTOKEN",
																	   "nonNegativeInteger",
																	   "nonPositiveInteger",
																	   "normalizedString",
																	   "NOTATION",
																	   "positiveInteger",
																	   "QName",
																	   "short",
																	   "string",
																	   "time",
																	   "token",
																	   "unsignedByte",
																	   "unsignedInt",
																	   "unsignedLong",
																	   "unsignedShort"};

		public SchemaHelper()
		{
		}


        public static bool IsNotEmpty(object obj)
        {
            return (obj != null && (string)obj != String.Empty);
        }

        static bool IsSorted = false;
        public static bool IsSimple(string str)
        {
            if (!IsSorted)
            {
                IsSorted = true;
                Array.Sort(simpleTypes);       
            }

            int index = Array.BinarySearch(simpleTypes, str.Trim());
            if (index >= 0 && index < simpleTypes.Length)
                return true;
            else
                return false;
        }

		internal static string LoopupPrefix(XmlSerializerNamespaces namespaces, string ns)
		{
			if (ns == string.Empty ) return string.Empty;
			
			XmlQualifiedName[] XmlQualifiedNameList =namespaces.ToArray();
			
			foreach (XmlQualifiedName XmlQualifiedName in XmlQualifiedNameList )
			{
				if (!XmlQualifiedName.IsEmpty && XmlQualifiedName.Namespace.Equals(ns) )
				{
					return  XmlQualifiedName.Name;
				}
			}

			return string.Empty;
		}
				
		internal static string LookupNamespace(XmlSerializerNamespaces namespaces,string prefix)
		{
			if (prefix != string.Empty) return string.Empty;
			
			XmlQualifiedName[] XmlQualifiedNameList =namespaces.ToArray();
			foreach (XmlQualifiedName XmlQualifiedName in XmlQualifiedNameList )
			{
				if (!XmlQualifiedName.IsEmpty && XmlQualifiedName.Name.Equals(prefix) )
				{
					return  XmlQualifiedName.Namespace;
				}
			}

			return string.Empty;
		}



	}
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


Written By
Software Developer
Vietnam Vietnam
I'm still alive...but temporarily moved to work on mobile & web stuffs(j2me/brew/php/flash...something not M$). things have just been very busy, and probably will continue...so don't have chance to maintain & respond. Hope will have time to try to write again, because many ideas with WPF &silver light are waiting. wish me luck Smile | :)

FYI:
- MESHSimPack project(c# library for measuring similarity among concepts of the MESH ontology):
http://sourceforge.net/projects/meshsimpack.

Comments and Discussions