Click here to Skip to main content
Click here to Skip to main content
Go to top

Publish a WSDL to a UDDI Server

, 16 Mar 2009
Rate this:
Please Sign up or sign in to vote.
This article describes the basic steps to interact with a UDDI server.

Sample Image

Introduction

Universal Description, Discovery, and Integration (UDDI) is a platform-independent, XML-based registry for businesses worldwide to list themselves on the Internet. UDDI is an important part in Web Services architecture. Clients can find information about a Web Service by using a UDDI server. In this article, we will present the basic steps to interact with a UDDI server.

Using the code

Library

To interact with a UDDI server, we can use the library Microsoft.Uddi.dll. This DLL can be found in the Microsoft Platform SDK for Windows Server 2003 R2. You can download this entire platform (about 1 GB) from the Microsoft site or use the one in this demo.

Search

The URL used to search is http://domain/uddipublic/inquire.asmx. We will use a FindService object for this operation, and login is not required.

Microsoft.Uddi.Inquire.Url = url;
Microsoft.Uddi.Inquire.AuthenticationMode = 
   Microsoft.Uddi.AuthenticationMode.UddiAuthentication;

FindService fs = new FindService();
if (businessKey != String.Empty)

    Microsoft.Uddi.Inquire.Url = url;
    Microsoft.Uddi.Inquire.AuthenticationMode = 
              Microsoft.Uddi.AuthenticationMode.UddiAuthentication;
    fs.BusinessKey = businessKey;

fs.FindQualifiers = _qualifiers;
if (_tTModelKeys.Count > 0)
    fs.TModelKeys = _tTModelKeys;

String temp = service == String.Empty ? "%" : service;
fs.Names.Add(temp.Trim());
try
{                
    ServiceList svlist =  fs.Send();
    
    if (svlist == null)
        return null;
    List<SVInfo> list = new List<SVInfo>();
    foreach (ServiceInfo si in svlist.ServiceInfos)
    {
        SVInfo s;
        s.name = si.Name;
        s.key = si.ServiceKey;
        s.businesskey = si.BusinessKey;

        GetBusinessDetail gbd = new GetBusinessDetail();
        gbd.BusinessKeys.Add(si.BusinessKey);
        BusinessDetail be = gbd.Send();
        s.businessname = be.BusinessEntities[0].Names[0].Text;

        GetServiceDetail gsd = new GetServiceDetail();
        gsd.ServiceKeys.Add(si.ServiceKey);
        ServiceDetail sd = gsd.Send();
        s.accesspoint = sd.BusinessServices[0].BindingTemplates[0].AccessPoint.Text;
        list.Add(s);
    }
    return list;
}
catch (Exception)
{
    return null;
    throw;
}

Publish

You may review the UDDI data model picture above. There is so much information about a service, but you do not have to fill in all of these. In this demo, we assume that a BusinessEntity to publish has only one BusinessService. The access point is the link to the WSDL of the Web Service. For this operation (and delete also), you have to login with an Administrator role.

cnn = new UddiConnection();
cnn.PublishUrl = url;
cnn.Username = username;
cnn.Password = password;
cnn.AuthenticationMode = mode;  
// Create a business entry.
SaveBusiness sb = new SaveBusiness();
BusinessEntity be = new BusinessEntity(txbBusinessName.Text);
sb.BusinessEntities.Add(be);

//Create a business service.
BusinessService bs = new BusinessService(txbServiceName.Text);
sb.BusinessEntities[0].BusinessServices.Add(bs);

//Create a binding template.
BindingTemplate bt = new BindingTemplate();
bt.AccessPoint.Text = txbAccessPoint.Text;
bt.AccessPoint.UrlType = Microsoft.Uddi.UrlType.Http;
sb.BusinessEntities[0].BusinessServices[0].BindingTemplates.Add(bt);

// Send the business entry data to the UDDI server.
try
{
    BusinessDetail bd = sb.Send(uddiCnn);
}
catch (UddiException ue)
{
    strError = ue.Message;
}
catch (Exception ex)
{
    strError = ex.Message;
}
finally
{
    ProgressBarStop();
    if (strError != String.Empty)
        MessageBox.Show(strError);
    else
        MessageBox.Show("Publish service successful");
}

Delete

Similarly, we have the delete operation using the DeleteService object. This object is defined by a serviceKey which can be got from a search operation.

DeleteService delSv = new DeleteService(serviceKey);
DispositionReport dispRep = delSv.Send(ud);

Update (Access point)

In this demo, update is separated into two operations: delete the old service and publish the new one; other information can be obtained from the old one.

selectedItem = listView1.SelectedItems[0];
SVInfo serviceInfo = (SVInfo)selectedItem.Tag;
// Get new accesspoint
AccessPointForm epf = new AccessPointForm(serviceInfo.accesspoint);
epf.passAccessPoint = new AccessPointForm.PassAccessPoint(setAccesspoint);
if (epf.ShowDialog() == DialogResult.OK)
{
    
    if (newAccesspoint != serviceInfo.accesspoint)
    {
        //~Get new accesspoint
        PerformDelete(serviceInfo.key);
        ud.InquireUrl = txtURL.Text;
        GetBusinessDetail gbd = new GetBusinessDetail(serviceInfo.businesskey);
        BusinessDetail bd = gbd.Send(ud);
        BusinessEntity be = bd.BusinessEntities[0];

        SaveBusiness sb = new SaveBusiness();
        sb.BusinessEntities.Add(be);///

        BusinessService bs = new BusinessService(serviceInfo.name);
        sb.BusinessEntities[0].BusinessServices.Add(bs);////

        BindingTemplate bt = new BindingTemplate();
        bt.AccessPoint.Text = newAccesspoint;
        bt.AccessPoint.UrlType = Microsoft.Uddi.UrlType.Http;
        sb.BusinessEntities[0].BusinessServices[0].BindingTemplates.Add(bt);////

        sb.Send(ud);
        
        listView1.SelectedItems[0].SubItems[3].Text = newAccesspoint;
    }
}

References

  1. Wikipedia. Universal Description Discovery and Integration. Wikipedia. [Online] http://en.wikipedia.org/wiki/Universal_Description_Discovery_and_Integration.
  2. Newcomer, Eric. Understanding Web Services - XML, WSDL, SOAP and UDDI. Addison-Wesley Professional; 1 edition (May 23, 2002), 2002. 978-0201750812.
  3. elLoco. UDDI SOA Howto. my-tech-talk.blogspot.com. [Online] http://my-tech-talk.blogspot.com/2009/01/uddi-soa-howto.html.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

No Biography provided

Comments and Discussions

 
GeneralUnable to execute this project Pinmemberprati.g@gmail.com12-Apr-10 17:07 
Generalhelp needed PinmemberAdace Gavril Marius22-May-09 2:43 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.

| Advertise | Privacy | Mobile
Web02 | 2.8.140916.1 | Last Updated 16 Mar 2009
Article Copyright 2009 by Chanh Pham Minh, Binh Nguyen Quoc
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid