Click here to Skip to main content
Click here to Skip to main content
 
Add your own
alternative version

UDDI Explorer: Tool for searching web services

, 20 Dec 2005
Tool for searching web service(s) and viewing their WSDL information.
Prize winner in Competition "ASP.NET Jul 2005"
uddiexplorer_demo.zip
UDDIExplorer_demo
WSDLParser.dll
microsoft.uddi.sdk.dll
ServiceRanking.dll
UDDI Explorer.exe
WSDLCache
Weather data from the National Digital Forecast Database NOAA's NWS.wsdl
uddiexplorer_src.zip
UDDIExplorer_src
ServiceRanking
ServiceRanking.csproj.user
UDDI Explorer
microsoft.uddi.sdk.dll
UDDI Explorer.csproj.user
UDDI Explorer.resharperoptions
WSDLParser
App.ico
WSDLParser.csproj.user
using System;
using System.Collections.Generic;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Xml;
using System.Web.Services.Description;

namespace UDDI_Explorer
{
    class WSDLRetrieval
    {
        public static bool RetrieveWSDLFile(UDDIService serviceInfo, bool online)
        {
            if (serviceInfo.LocationFile != null && serviceInfo.LocationFile.LastIndexOf(@":\") == -1)
            {
                string strPath = Application.ExecutablePath;
                int i = strPath.LastIndexOf(@"\");
                string strDir = strPath.Substring(0, i + 1) + @"WSDLCache";
                strPath = strDir + "\\" + serviceInfo.LocationFile;
                
                if (!Directory.Exists(strDir))
                {
                    Directory.CreateDirectory (strDir);
                    if (!Directory.Exists(strDir))
                    {
                        throw new Exception("Could not create the WSDLCache folder at the location : " + strDir);
                    }
                }
                serviceInfo.LocationFile = strPath;
            };
            
            if (online)
            {
                try
                {
                    XmlTextReader reader = new XmlTextReader(serviceInfo.Url);
                    ServiceDescription tmpService =
                        ServiceDescription.Read(reader);
                    tmpService.Name = serviceInfo.Url;
                    tmpService.RetrievalUrl = serviceInfo.Url;
                    tmpService.Write(serviceInfo.LocationFile);

                    if (!File.Exists(serviceInfo.LocationFile))
                    {
                        throw new Exception("Could not write the wsdl at the location :" + serviceInfo.LocationFile);
                    };
                }
                catch (Exception)
                {
                    throw new Exception("Could not retrieve the wsdl from the url: " + serviceInfo.Url);
                }


            }
            else
                if (!File.Exists(serviceInfo.LocationFile))
                {
                    throw new Exception("File does not exist");
                };

            return true;
        }

        public static TreeNode WSDLToNode(UDDIService serviceInfo, bool online)
        {
            try
            {
                if (RetrieveWSDLFile(serviceInfo, online))
                {
                    ServiceDescription myService =
                        ServiceDescription.Read(serviceInfo.LocationFile);

                    if (myService.Name == string.Empty || myService.Name == null)
                    {
                        myService.Name = serviceInfo.Url;
                    };
                    if (myService.Name != string.Empty && serviceInfo.Url == string.Empty)
                        serviceInfo.Url = myService.Name;

                    serviceInfo.Descriptions = myService.Documentation;

                    WSDLParser.WSDLParser parse = new WSDLParser.WSDLParser(myService);
                    TreeNode node = new TreeNode();
                    node = parse.ServiceNode;
                    return node;
                }

            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message.ToString());
            }
            finally
            {

            };

            return null;

        }

    }
}

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.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here

About the Author

Thanh Dao
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.

| Advertise | Privacy | Mobile
Web03 | 2.8.140721.1 | Last Updated 21 Dec 2005
Article Copyright 2005 by Thanh Dao
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid