Export (0) Print
Expand All

Discovery: UDDI

Download sample

This sample demonstrates how to implement a Windows Communication Foundation (WCF) client that performs basic operations with a Universal Description, Discovery, and Integration (UDDI) v2 service that is installed on the local machine. UDDI Registry is part of the UDDI Services released with Windows Server 2003.

ms751451.note(en-us,VS.90).gifNote:
The setup procedure and build instructions for this sample are located at the end of this topic.

The sample consists of a client console program (.exe) that communicates with a locally installed UDDI Registry. The sample can also communicate with other UDDI Inquire and Publish service implementations. Client activity is visible in the console window.

The sample sources include the following auto-generated files:

  • UddiTypes.cs (UDDI types)

  • UddiInquireClient.cs (UDDI Inquire Client)

  • UddiPublishClient.cs (UDDI Publish Client)

  • You can regenerate these files to work with Svcutil.exe. You do not have to regenerate these files to run the sample.

To generate the files previously listed

  1. Download the file from UDDI Schema and save it as UddiTypes.xsd.

  2. Generate UddiTypes.cs by using the following command.

    xsd.exe /classes UddiTypes.xsd
    
  3. Generate UddiInquireClient.cs by using the following command.

    svcutil.exe /out:UddiInquireClient.cs http://uddi.org/wsdl/inquire_v2.wsdl
    
  4. Open UddiInquireClient.cs and remove all the type declarations after (but not including) the declaration of the following interface.

          public interface Inquire {...}
    

    Also, make sure it is done before (but not including) the first typed message declaration.

         [System.Diagnostics.DebuggerStepThroughAttribute()]
         [System.CodeDom.Compiler.GeneratedCodeAttribute(       
                          "System.ServiceModel", "3.0.0.0")]
         [System.ServiceModel.MessageContractAttribute( IsWrapped=false )]
    
  5. Generate UddiPublishClient.cs by using the following command.

    svcutil.exe /out:UddiPublishClient.cs http://uddi.org/wsdl/publish_v2.wsdl
    
  6. Open UddiPublishClient.cs and remove all the type declarations after (but not including) the following declaration.

          public interface Publish {...}
    

    To (but not including) the first typed message declaration.

         [System.Diagnostics.DebuggerStepThroughAttribute()]
         [System.CodeDom.Compiler.GeneratedCodeAttribute(       
                          "System.ServiceModel", "3.0.0.0")]
         [System.ServiceModel.MessageContractAttribute( IsWrapped=false )]
    

    Remove all the declarations inside the namespace Uddiorg.api (these declarations have already been generated in the UddiInquireClient.cs.

The client uses the proxies to implement operations that retrieve information from the UDDI registry:

  • public void Login(string username, string password)

    Used to log on to the Publish service. Uses the get_authToken() operation of the Publish service.

  • public businessInfo[] GetBusinessByName(string businessName)

    Queries the UDDI Registry for services with names that match the string provided. Calls the find_business() operation of the Inquiry service.

  • public string PublishBusiness(string businessName, string description)

    Publishes a business in the UDDI Registry. Uses the save_business() operation of the Publish service.

  • public businessInfo[] GetMyBusinesses()

    Returns all businesses published by a given user. Uses the get_registeredInfo() operation of the Publish service.

  • public businessInfo GetMyBusinessByName(string businessName)

    Returns the first business found with a given name published by a given user. Calls the get_registeredInfo() operation of the Publish service.

  • public void DeleteMyBusinesses()

    Deletes all businesses published by a given user. Uses the delete_business() operation of the Publish service.

  • public void DeleteMyBusiness(string businessKey)

    Deletes a business identified by the key, published by a given user. Uses the registeredInfo() and delete_business() operations of the Publish service.

The client uses a configuration file (App.config) to specify the endpoint and binding for the Inquire and Publish services with which it communicates. The client endpoint configuration consists of a configuration name, an absolute address for the service endpoint, the binding, and the contract, as shown in the following configuration.

<bindings>
   <basicHttpBinding>
       <binding name="Https">
          <security mode="Transport">
            <transport clientCredentialType="Ntlm"/>
          </security>
        </binding>
   </basicHttpBinding>
</bindings>
<client>
   <endpoint name="Inquire"
       address="https://<machine with UDDI Services>/uddi/inquire.asmx" 
       binding="basicHttpBinding" bindingConfiguration="Https" 
       contract="Inquire" />
    <endpoint name="Publish"
       address="https://<machine with UDDI Services>/uddi/publish.asmx" 
       binding="basicHttpBinding" bindingConfiguration="Https" 
       contract="Publish" /> 
</client>

To set up, build, and run the sample

  1. Ensure you have UDDI Services installed on Windows Server 2003. Go to Add/Remove Programs, Add Windows Components and ensure that UDDI Services is checked. If not, mark the checkbox and follow the wizard to install UDDI Services.

  2. Ensure that you have performed the One-Time Set Up Procedure for the Windows Communication Foundation Samples.

  3. To build the C# or Visual Basic .NET edition of the solution, follow the instructions in Building the Windows Communication Foundation Samples.

  4. If the user of the UDDI client does not have the correct credentials to authenticate to UDDI Services, then a local user (on the machine with UDDI Services installed) should be created and the <appSettings> element in the App.config configuration file should be updated.

  5. By default, UDDI Publish operations are allowed only to local administrators. Ensure a newly-created user can access Publish UDDI service, by either making the user as local Administrator or changing role for Publisher Group Name in UDDI services console to include the user account. To do the latter, open UDDI Services console, right-click the UDDI Services node, select the Roles tab and select the publisher's account.

  6. To run the sample in a single- or cross-machine configuration, follow the instructions in Running the Windows Communication Foundation Samples.


© 2007 Microsoft Corporation. All rights reserved.

Community Additions

ADD
Show:
© 2015 Microsoft