Novell is now a part of Micro Focus

How to Use Novell Nsure UDDI Command Beans in Building Web Services-Enabled Applications

Articles and Tips: article

Sanjay Gupta
Sr. Software Engineer
Novell, Bangalore
gsanjay@novell.com

01 Mar 2003


This AppNote discusses how to use Novell Nsure UDDI Command Beans in building Web services-enabled applications.


Topics

Java Beans, UDDI

Products

NetWare, Nsure UDDI Server

Audience

developers, integrators

Level

intermediate

Prerequisite Skills

familiarity with UDDI and Java

Operating System

NetWare

Tools

Nsure UDDI Command Beans

Sample Code

yes

Introduction

The Novell Nsure UDDI Command Beans provide easy-to-use Java components for integrating Web applications with Net services. These components are written entirely in Java, use open protocols, and provide command beans designed for use in the Model-View-Controller (MVC) architecture. These beans allow applications to be integrated with UDDI registries. The components provide a mechanism to contact an UDDI registry and enable inquiry and publishing to/from UDDI servers, along with features such as authenticated inquiry.

UDDI stands for Universal Description, Discovery and Integration. UDDI is the name of a group of Web-based registries where businesses can register information about themselves, their entities, services offered by them, and the technical interface of each of the services registered. These registries are run by multiple operator sites, and can be used by anyone who wants to make information available about one or more businesses or entities, as well as anyone who wants to find that information. There is no charge for using the basic services of these operator sites.

Web services are a way for businesses to expose their services programmatically through the Internet, leveraging standards-based protocols and document interchange formats to execute online transactions. Web services Leverages XML to populate the data envelope in a standard consistent wrapper communication protocol, primarily HTTP. Using web services helps in overcoming the problem of platform dependence and it also shields user from requiring knowledge of service implementation issues.

The Web Services specification includes:

  • Simple Object Access Protocol (SOAP)

  • Universal Description, Discovery, and Integration (UDDI)

  • Web Services Description Language (WSDL)

Figure 1 gives an architectural representation of the Web Services model.

Figure 1: The Web Services model.

Novell Nsure UDDI Command Beans Programming Model

Novell Nsure UDDI Command Beans provides a set of command beans that can be used with the MVC architecture. Each Nsure UDDI Command bean maps to the API specification as given by the UDDI consortium.

Command Beans

A command bean is a discrete component that encapsulates a single business logic task. For example, a command bean might handle authentication. The reduction of business logic into fine-grained, isolated components improves the development of an application because the components are more manageable and rely less upon one another.

Each command bean contains a command interface that consists of three methods. In Novell Nsure UDDI Command Beans, these methods are:

  • IsReady, which tests whether the bean is ready for execution (that is, whether the required input properties have been set and the bean is in the initialized state).

  • Execute, which executes the bean and sets output properties to reflect the executed state of the bean.

  • Reset, which resets the output properties of the bean to the values they had before the execute method was called.

The command interface relates to the state of the bean. The possible states of a command bean include:

  • New. The bean is in this state immediately after instantiation (creation). In this state, the isReady method returns FALSE and the get methods should not be called. Set methods can be called to set input parameters.

  • Initialized. The bean is in this state after all required input parameters have been set. In this state, isReady returns TRUE and the get methods should not be called. You can continue to call set methods or you can call the execute method at this time.

  • Executed. The bean is in this state after the execute method has been called. In this state, isReady returns TRUE (because the required input properties have been set) and the get methods can be called. To reset parameters, you can call the reset method.

The command bean can be reused by calling the reset method and setting input properties as desired.

To use a command bean, the servlet (controller) does the following:

  1. Instantiates the command bean.

  2. Sets the input properties of the command bean.

  3. Calls the execute method of the command bean.

  4. Reads the output properties of the command bean.

Deploying Novell Nsure UDDI Command Beans

The following procedure will guide you in using Nsure UDDI Beans:

  1. Check system requirements.

    To use the Nsure UDDI Beans, you need a system configured with Java 2 Platform, Standard Edition, v1.4 or greater. You also need access to a UDDI Server.

    The beans are designed for console as well as Web application on an application server. However, an application server is optional.

  2. Install the Java Secure Socket Extension (JSSE) package (optional).

    To allow SSL for communication, you can also use eCommerce security beans to add the provider. The eCommerce Security Beans require Sun's JSSE 1.0.2 package. JSSE comes with Java v1.4 and greater.

  3. Modify the Java classpath.

    Add the following libraries to your classpath:

    • ecb.jar

    • ecbuddi.jar

    • uddiclient.jar

    The above libraries are available from (http://developer.novell.com/ndk/leadedge.htm [leading edge 178])

    If security is required, you also need ecbsecurity.jar, available from http://developer.novell.com/ndk/bns_seccmd.htm.

    uddiclient.jar depends on the following libraries which need to be present in the classpath:

  4. Import the packages.

    You need to import the following packages into your Java source code:

    com.novell.ecb.uddi.*

  5. Validate the deployment.

    You can partially validate your deployment by modifying the properties, compiling, and executing the following Java class (this example assumes that you completed Step 4):

    import com.novell.ecb.uddi.*; 
    
    class TestECB 
    { 
          public static void main(String[] args) 
       { 
          try
            {
             // Instantiate the command bean 
             UDDIConnection uc = new UDDIConnection();
    
             // Set the input properties of the command bean
             uc.setInquiryURL(<url of the uddi server >);
             uc.setPublishURL(<url of the uddi server>);   
             uc.setCredentials(<username>, <password>);
       
             // Call the execute method of the command bean 
             uc.execute(); 
       
             // Success statement 
             System.out.println("Authentication Succeeded!" +  
             uc.getAuthInfo());
           }   
           catch(UDDIException e)
           {
               System.out.println(e.getSoapFaultCode());
               System.out.println(e.getSoapFaultString());
               System.out.println(e.getUDDIErrorCode());
               System.out.println(e.getUDDIErrorNumber());
               System.out.println(e.getMessage());
               e.printStackTrace();
          }
       } 
    }

    You will know that the preceding sample ran correctly if you see the line "Authentication Succeeded!" along with a string on your console. Otherwise, an exception is thrown with information about why the sample failed.

Novell Nsure UDDI Command Beans

The Novell Nsure UDDI Command Beans are components in the form of commands that allow you to integrate your Web applications with UDDI Registries. These beans enable establishing connection and performing inquiry/publishing functions.

Figure 2 shows how the Novell Nsure UDDI Command Beans fit into a Web application to allow you to access a UDDI registry.

Figure 2: Accessing a UDDI Registry with the Novell Nsure UDDI command beans.

Basic UDDI Programming Model

The basic structure of a program accessing UDDI registry is as follows:

  1. Establish a connection with the UDDI registry.

    The first step in coding with the Novell Nsure command beans is to instantiate a UDDIConnection object by specifying the URL where UDDI service runs. The connection object also helps in establishing our identity for publishing requests or authenticated inquires for which we need to pass our credentials.

  2. Make UDDI requests as desired.

    Pass the UDDIConnection object from the previous step to other command beans to make UDDI requests.

  3. Unauthenticate.

    Release authToken if obtained by calling discardAuthToken() method of UDDIConnection object.

    To get complete details about the UDDI specifications, refer to http://www.uddi.org.

Overview of Commands

Here is list of UDDI commands available with Novell Nsure UDDI Command Beans, along with a short description of what each one does.


UDDI Commands Available with Novell UDDI Command Beans
Description

UDDIAddPublisherAssertion

Adds publisherAssertion(s) element(s) to the assertions made by a particular business entity in the UDDI registry.

UDDIConnection

Maintains connection information, handles authentication, unauthentication, and whether operation is to be performed via authenticated mechanism or anonymously. (This is a mandatory parameter for all the other command present in the set Novell Nsure Command Beans.)

UDDIDeleteBinding

Deletes the specified bindingTemplate(s) data published by the authenticated user, from the UDDI registry.

UDDIDeleteBusiness

Deletes the specified businessEntity(s) data published by the authenticated user, from the UDDI registry.

UDDIDeletePublisherAssertion

Deletes the specified publisherAssertion(s) data published by the authenticated user, from the UDDI registry.

UDDIDeleteService

Deletes the specified businessService(s) data published by the authenticated user, from the UDDI registry.

UDDIDeleteTModel

Deletes the specified tModel(s) data published by the authenticated user, from the UDDI registry.

UDDIFindBinding

Finds bindingTemplate(s) data that matches the specified criteria.

UDDIFindBusiness

Finds businessEntity(s) data that matches the specified criteria. Wild card search is also allowed, by specifying "%" in the search criteria.

UDDIFindRelatedBusiness

Finds businessEntity(s) data that are related to the specified businessKey by which a particular businessEntity is identified.

UDDIFindService

Finds businessService(s) data that matches the specified criteria. Wild card search is also allowed.

UDDIFindTModel

Finds tModel(s) data that matches the specified criteria. Wild card search is also allowed, by specifying "%" in the search criteria.

UDDIGetAssertionStatusReport

Retrieves an individual's publisherAssertion collection. This operation can only be performed by an authenticated user.

UDDIGetBindingDetail

Retrieves bindingTemplate(s) data in detail of the specified bindingKey value(s).

UDDIGetBusinessDetail

Retrieves businessEntity(s) data in detail of the specified businessKey value(s).

UDDIGetBusinessDetailExt

This bean can provide additional attribute in addition to information from UDDIBusinessEntity if the source is an external registry that is compatible with the current specifications of UDDI.

UDDIGetPublisherAssertions

Retrieves publisherAssertion(s) of the publisher account associated with the authentication information.

UDDIGetRegisteredInfo

Retrieves an abbreviated list of all businessEntity and tModel data that are controlled by the authenticated individual.

UDDIGetServiceDetail

Retrieves businessService(s) data in detail of the specified serviceKey value(s).

UDDIGetTModelDetail

Retrieves tModel(s) data in detail of the specified tModelKey values.

UDDISaveBinding

Allows an authenticated user to save or update information of one or more bindingTemplate elements in the UDDI registry.

UDDISaveBusiness

Allows an authenticated user to save or update information of one or more businessEntity elements in the UDDI registry.

UDDISaveService

Allows an authenticated user to save or update information of one or more businessService elements in the UDDI registry.

UDDISaveTModel

Allows an authenticated user to save or update information of one or more tModel elements in the UDDI registry.

UDDISetPublisherAssertion

Manages all of tracked relationship assertions associated with an individual publisher account.

Code Samples

This section presents sample code for doing many common tasks using the Novell Nsure Command Beans. It includes code that shows how to do the following:

  • Establish a connection

  • List Businesses

  • Get Details for a Business

  • Publish information about a new Business

  • Update information about a Business

  • Delete information about a Business

  • Unauthenticate

Establish a Connection

This section describes methods to establish a connection with a UDDI Registry.

Connection: Public - Demonstrates establishing a public connection with a UDDI registry, using an Inquiry URL. This can be used for public read operations.

This task involves the following code logic:

  • Instantiate the UDDIConnection command bean

  • Set the Inquiry URL

Command Used: UDDIConnection

Sample Code:

// *
// * #1 - Authenticate
// *
// UDDIConnection object
UDDIConnection uc = null;
try
{
   //Instantiate the command bean
   uc = new UDDIConnection();
   
   //set the input property   
   uc.setInquiryURL("http://acme.com:8080/uddi/inquiry");
   
   //Here no need to call the execute method
}
catch(UDDIException e)
{
   // Handle exception
   System.out.println(e.getSoapFaultCode());
   System.out.println(e.getSoapFaultString());
   System.out.println(e.getUDDIErrorCode());
   System.out.println(e.getUDDIErrorNumber());
   System.out.println(e.getMessage());
}

// ...
//
// #2 - Use the UDDIConnection object ("uc")
// as an input property to other UDDI Command Beans
//
// ...
// ...

Connection: Standard - Demonstrates establishing connection with a UDDI registry, using an Inquiry URL, a publisher URL, a user name, and a password.

Code Logic:

  • Instantiate the UDDIConnection command bean.

  • Set the Inquiry URL, publisher URL, whether to perform authenticated inquiry or public inquiry, user name and credentials.

  • Call the execute method.

  • Obtain the authToken by calling getAuthToken().

Command Used: UDDIConnection

Sample Code:

// *
// * #1 - Authenticate
// *
// UDDIConnection object
UDDIConnection uc = null;
try
{
   //Instantiate the command bean
   uc = new UDDIConnection();
      
   //Set the input property of the command bean   
   uc.setInquiryURL("http://acme.com:8080/uddi/inquiry");
   uc.setPublishURL("http://acme.com:8080/uddi/inquiry");
   uc.setCredentials("wcoyote", "password");
      
   //Call the execute method of the command bean
   uc.execute();
      
   //Get the output property of the command bean
   String authToken = uc.getAuthToken();
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
// ...
//
// #2 - Use the UDDIConnection object ("uc")
// as an input property to other UDDI Command Beans
//
// ...
// ...
//
// #3 - Unauthenticate 

Connection: Standard with SSL - Demonstrates establishing connection with a UDDI registry, using an Inquiry URL, a publisher URL, a user name, a password, and a security provider. This can be used if HTTPS is used as a protocol while saving or updating information in the registry.

Code Logic:

  • Update the environment variable with the name of security provider to use. This is a one time operation. This can be done by using Security Command Beans available from http://developer.novell.com/ndk/bns_seccmd.htm or using straight Java code.

  • Instantiate the UDDIConnection command bean.

  • Set the Inquiry URL, publisher URL, whether to perform authenticated inquiry or public inquiry, user name and credentials.

  • Call the execute method.

  • Obtain the authToken by calling getAuthToken().

Command Used: UDDIConnection

Sample Code:

// *
// * #1 - Add Security Provider
// *
//
// ...
//
   
// *
// * #2 - Authenticate
// *
// UDDIConnection object
UDDIConnection uc = null;
try
{
   //Instantiate the command bean
   uc = new UDDIConnection();
   
   //Set the input property of the command bean   
   uc.setInquiryURL("http://acme.com:8080/uddi/inquiry");
   uc.setPublishURL("https://acme.com:8080/uddi/publishing");
   uc.setCredentials("wcoyote", "password");
   
   //Call the execute method of the command bean
   uc.execute();
   
   //Get the output property of the command bean
   String authToken = uc.getAuthToken();
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
// ...
//
// #3 - Use the UDDIConnection object ("uc")
// as an input property to other UDDI Command Beans
//
// ...
// ...
//
// #4 - Unauthenticate 
List Businesses

This section describes a method to obtain the list of business from the UDDI registry. Wildcard searching, as well as businesses depending on the specified criteria, can also be obtained.

Code Logic:

  • Instantiate the UDDIFindBusiness command bean.

  • Set the UDDIConnection property of the bean. This will perform a wild card search.

  • Execute the bean.

  • Retrieve the list of businesses by calling getBusinessInfos().

Command Used: UDDIFindBusiness

Sample Code:

// *
// * #1 - Establish Connection and save the UDDIConnection object
// *
// 
// ...
// ...
//

// *
// *#2 - List Business Info
// *
// 
try
{
   //Instantiate the command bean
   UDDIFindBusiness findBusiness = new UDDIFindBusiness();

   //Set the input property of the command bean   
   findBusiness.setConnection(uc);
   
   //Call the execute method of the command bean
   findBusiness.execute();
   
   //Get the output property of the command bean
   List businessInfos = findBusiness.getBusinessInfos();
   
   // TO DO: Use the Information obtained above
   // Refer to code snippet in java doc of execute method of command // bean to
   work with information obtained.
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
//
// *
// *#3 - Unauthenticate 
// *
Get Details for a Business

This section describes a method to obtain details about a particular business.

Code Logic:

  • Instantiate the UDDIGetBusinessDetail command bean.

  • Set the UDDIConnection property and BusinessKey property of the bean.

  • Execute the bean.

  • Retrieve the detail about the business by calling getBusinessDetail().

Command Used: UDDIGetBusinessDetail

Sample Code:

// *
// * #1 - Establish Connection and save the UDDIConnection object
// *
// 
// ...
// ...
//

// *
// *#2 - Get Business Detail
// *
// 
try
{
   //Instantiate the command bean
   UDDIGetBusinessDetail business = UDDIGetBusinessDetail();

   //Set the input property of the command bean   
   business.setConnection(uc);
   String[] businessKey = {"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"};

   //Call the execute method of the command bean
   business.execute();
   
   //Get the output property of the command bean
   List businessDetail = business.getBusinessDetail();
   
   // TO DO: Use the Information obtained above
   // Refer to code snippet in java doc of execute method of command 
   // bean to    work with information obtained.
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}

//
// *
// *#3 - Unauthenticate 
// *
Publish Information about a New Business

This section describes method for publishing information about a business on a UDDI registry.

Code Logic:

  • Instantiate the UDDISaveBusiness command bean.

  • Set the UDDIConnection property and BusinessEntity property of the bean.

  • Execute the bean.

  • Retrieve the published information by calling getBusinessEntity().

Command Used: UDDISaveBusiness

Sample Code:

// *
// * #1 - Establish Connection and save the UDDIConnection object
// *
// 
// ...
// ...
//
   
// *
// *#2 - Publish Business Entity
// *
// 
try
{
   //Instantiate the command bean
   UDDISaveBusiness business = new UDDISaveBusiness();
   
   //Instantiate the BusinessEntity element used by the bean. 
   //BusinessEntity in turn is composed of so many other objects.
   //We will be looking at initializing BusinessEntity element with 
   //few of the attributes.  
   // Refer to code snippets in java doc to get details on 
   //populating associated objects.
   
   UDDIBusinessEntity [] bizEntities = new UDDIBusinessEntity[1];
   UDDIBusinessEntity businessEntity = new UDDIBusinessEntity();
      
   // Name is the only mandatory attribute for the BusinessEntity
   UDDIName [] names = new UDDIName[1];
   UDDIName name = new UDDIName("Coyote Inc.", "en");
   names[0] = name;
   
   // Name is multivalued attribute and only one name per language 
   //code is allowed
   businessEntity.setName(names);
   
   // Fill the Contact point with the BusinessEntity 
   // First instantiate the address
   UDDIAddressLine[] addressLines = new UDDIAddressLine[4];
   UDDIAddressLine addressLine = new UDDIAddressLine("Coyote Inc.");
   addressLines[0] = addressLine;
   addressLine = new UDDIAddressLine("1800, South Palace");
   addressLines[1] = addressLine;
   addressLine = new UDDIAddressLine("New York");
   addressLines[2] = addressLine;
   addressLine = new UDDIAddressLine("56068");
   addressLines[3] = addressLine;
   
   UDDIAddress address = new UDDIAddress();
   address.setAddressLine(addressLines);
   address.setUseType("Postal Address");
   
   UDDIAddress[] addresses = new UDDIAddress[1];
   addresses[0] = address;
   
   // Instantiate the email contact for the business
   UDDIEmail email = new UDDIEmail("wcoyote@coyote.com");
   UDDIEmail[] emails = new UDDIEmail[1];
   emails[0] = email;
   
   // Instantiate the phone contact for the business
   UDDIPhone[] phones = new UDDIPhone[1];
   phones[0] = new UDDIPhone("91-80-5731856 Ex 2208");
   
   //Instantiate the description for the contact point
   UDDIDescription desc = new UDDIDescription("Type of contact");
   
   UDDIContact contact = new UDDIContact("William Coyote");
   contact.setUseType("For all Enquiries");
   contact.setDefaultDescription(desc);
   contact.setAddress(addresses);
   contact.setEmail(emails);
   contact.setPhone(phones);
   
   UDDIContact[] contacts = new UDDIContact[1];
   contacts[0] = contact;
   
   // Set the contact point for the business
   businessEntity.setContact(contacts);
   
   // TO DO: Set other properties of the UDDIBusinessEntity object      

   bizEntities[0] = businessEntity;
   
   //Set the input property of the command bean   
   business.setConnection(uc);
   business.setBusinessEntity(bizEntities);
   
   //Call the execute method of the command bean
   business.execute();
   
   //Get the output property of the command bean
   List returnBizEntities = business.getBusinessEntity();
   
   // TO DO: Use the Information obtained above
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
//
// *
// *#3 - Unauthenticate 
// *
Update Information about a Business

This section describes method for updating information for an already-published businessEntity. Updating a businessEntity involves updating a UDDIBusinesEntity element obtained from an UDDIGetBusinessDetail command bean with new information and then passing this updated UDDIBusinessEntity element as a parameter to UDDISaveBusiness.

In this particular scenario, we will be updating the businessEntity published above with a businessService element. The businessEntity published above can also be updated with this service by using UDDISaveService command bean.

Code Logic:

  • Instantiate the UDDISaveBusiness command bean.

  • Obtain the businessEntity element corresponding to the Business which needs to be updated.

  • Update the businessEntity obtained from above.

  • Set the UDDIConnection property and BusinessEntity property of the bean.

  • Execute the bean.

  • Retrieve the published information by calling getBusinessEntity().

Command Used: UDDISaveBusiness

Sample Code:

// *
// * #1 - Establish Connection and save the UDDIConnection object
// *
// 
// ...
// ...
//
   
// *
// *#2 - Obtain Business Info for "Coyote Inc." and save  
// * UDDIBusinessInfo object, "businessInfo" referring it
// 
try
{
   //Instantiate the command bean
   UDDIFindBusiness findBusiness = new UDDIFindBusiness();
   
   
   // Initialize the input property to be set
   UDDIName[] names = new UDDIName[1];
   UDDIName name = new UDDIName("Coyote Inc.", "en");
   Names[0] = name;
   
   //Set the input property of the command bean   
   findBusiness.setConnection(uc);
   findBusiess.setNames(name);
   
   //Call the execute method of the command bean
   findBusiness.execute();
   
   //Get the output property of the command bean
   List bizInfos = findBusiness.getBusinessInfos();
   
   // TO Do: Iterate within the list and get to the UDDIBusinessInfo 
   // corresponding to "Coyote Inc", most probably only one 
   //UDDIBusinessInfo will be present in the list. 
   
   UDDIBusinessInfo businesssInfo = (UDDIBusinessInfo) 
                                    bizInfos.get(0); 
   
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}

// *
// *#3 - Get Business Detail for the "businessInfo" and save 
// * corresponding UDDIBusinessEntiy object, "businessEntity". 
// *
// 
try
{
   //Instantiate the command bean
   UDDIGetBusinessDetail business = UDDIGetBusinessDetail();
   
   //Set the input property of the command bean   
   business.setConnection(uc);
   String[] businessKey = { businessInfo.getBusinessKey() };
   
   //Call the execute method of the command bean
   business.execute();
   
   //Get the output property of the command bean
   List bizDetail = business.getBusinessDetail();
   
   // Only one UDDIBusinessEntiy will be present in the list 
   UDDIBusinessEntity businessEntity = (UDDIBusinessEntity) 
   bizDetail.get(0);
   
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
// *
// *#4 - Update businessEntity with the new Service
// *
// 
try
{
   UDDIBusinessService[] services = new UDDIBusinessService[1];
   UDDIBusinessService service = new UDDIBusinessService();
   
   // Set the name by which this Service will be recognized.
   // Name is multivalued property and only one name per language
   // code is allowed    
   UDDIName [] names = new UDDIName [1];
   UDDIName name = new UDDIName("coyote web service");
   names[0] = name;
   
   service.setName(names);                        

   // Set the access point for the service
   UDDIAccessPoint ap = new UDDIAccessPoint(UDDIAccessPoint.MAIL_TO, 
   "wcoyote@coyote.com");            
      
   //Create the technical specifics, binding template for the 
   //service
   UDDIBindingTemplate template = new UDDIBindingTemplate(ap);
   
   temp.setDefaultDescription(new UDDIDescription("Description for 
                                          BindingTemplate"));
   
   // TO DO: Set other properties of UDDIBindingTemplate
   //Refer to execute method in javadoc of UDDISaveService 
   
   UDDIBindingTemplate [] templates = new UDDIBindingTemplate[1];
                                 templates[0] = template;            
   
   // Set the bindingTemplate for the service
   service.setBindingTemplate(temps); 
   
   UDDIDescription desc = new UDDIDescription("Description for this
                              service");
   
   // Set the Description for this service 
   service.setDefaultDescription(desc);                         
   
   // Update  "businessEntity" with the businessService to be 
   //published
   services[0] = service;   
   
   businessEntity.setBusinessService(services);
   
   // TO DO: Update other properties of "businessEntity 
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
// *
// *#5 - Update information about Business on UDDI Registry using
// * "businessEntity" object saved above
// 
try
{
   //Instantiate the command bean
   UDDISaveBusiness business = new UDDISaveBusiness();
   
   UDDIBusinessEntity [] bizEntities = new UDDIBusinessEntity[1];
   bizEntities[0] = businessEntity;
   
   //Set the input property of the command bean   
   business.setConnection(uc);
   business.setBusinessEntity(bizEntities);
   
   //Call the execute method of the command bean
   business.execute();
   
   //Get the output property of the command bean
   List returnBizEntities = business.getBusinessEntity();
   
   // TO DO: Use the Information obtained above
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
//
// *
// *#6 - Unauthenticate 
// *
Delete Information about a Business

This section describe method for deleting information about a business published on a UDDI registry.

Code Logic:

  • Instantiate the UDDIDeleteBusiness command bean.

  • Obtain the businessKey corresponding to the Business which needs to be deleted.

  • Set the UDDIConnection property and BusinessKey property of the bean.

  • Execute the bean.

Command Used: UDDIDeletBusiness

Sample Code:

// *
// * #1 - Establish Connection and save the UDDIConnection object
// *
// 
// ...
// ...
//
      
// *
// *#2 - Delete Information about the Business from Registry
// * Assume our business is represented by the following business 
// * key "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
// 
try
{
   //Instantiate the command bean
   UDDIDeleteBusiness delBusiness = new UDDIDeleteBusiness();
   
      
   String [] keys = {"xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"};
   
   //Set the input property of the command bean   
   delBusiness.setConnection(uc);
   delBusiness.setBusinessKey(keys);
   
   //Call the execute method of the command bean
   uc.execute();
   
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}
   
//
// *
// *#3 - Unauthenticate 
// *
Unauthenticate

This section describes method with sample code to discard authToken obtained.

Code Logic:

  • Call discardAuthToken() method of UDDIConnection object which has been used to obtain authToken from the server.

Command Used: UDDIConnection

Sample Code:

// *
// * #1 - Authenticate
// *
// 
// ...
// ...
//
   
// *
// *#2 - Use the UDDIConnection object, "uc"
// *as an input property to other UDDI Command Beans
//
// ...
// ...
//
   
//
// *
// *#3 - Unauthenticate 
// *
try
{
   // Call the discardAuthToken() method
   uc.getDiscardAuthToken();
}
catch(UDDIException e)
{
   // TO DO: Handle exception
}

Conclusion

Novell's Nsure UDDI Command Beans provide Java components for integrating Web service applications with UDDI registries. These components enable inquiry and publishing to/from UDDI registries, along with features such as authenticated inquiry.

In this AppNote you have seen how you can do connection setup with a UDDI registry and perform some tasks like reading, saving, updating, and deleting information from the UDDI registry. Though the focus on this AppNote centered on business entities, operations with other elements of the UDDI registry can also be performed by going through this process, as the UDDI specification provides a similar interface with other elements. Moreover, Novell Nsure UDDI Command Beans are designed to provide users with a consistent interface for all the commands.

* Originally published in Novell AppNotes


Disclaimer

The origin of this information may be internal or external to Novell. While Novell makes all reasonable efforts to verify this information, Novell does not make explicit or implied claims to its validity.

© Copyright Micro Focus or one of its affiliates