The release of the UDDI4J API (see Resources for links to this and other
references made in this article) enabled the creation of UDDI-aware
applications, making the publish, unpublish and find
operations available from an open-source API.
In order to allow WSDL documents (see Resources for a link) to be part of this equation, a new layer called the Service Registry Proxy API (or SRP), which sits on top of the UDDI4J, has been devised.
The SRP API elements encapsulate classes present in the UDDI4J API, and some defined by the WSDL4J API, and offer a comprehensive set of methods for interfacing with a UDDI Registry. Its model simplifies the development of applications because it raises the level of abstraction, enabling the developer to concentrate on entities directly related to the Web services architecture domain.
The SRP API is structured around the following main elements: Service Provider (SP), Service Definition (SD), Service Implementation (SIMP), and Service Interface (SITF), as shown in Figure 1.
Figure 1: SRP API main elements

- SP
The Service Provider represents an entity capable of providing services. It encapsulates a reference to the UDDI4J classBusinessEntity. - SD
The Service Definition describes a service by breaking it down into two pieces: implementation (SIMP) and a list of the implemented interfaces (SITF). - SIMP
The Service Implementation has a dual role. It exposes the related WSDL implementation document (see Resources) and also has a reference to the UDDI4J classBusinessService. - SINT
The Service Interface also encapsulates two entities: a WSDL interface document (see Resources) and a reference to the UDDI4J classTModel.
The WSDL capabilities presented by SIMP and SINT are inherited from their
parent class WSDLServiceInfo.
This organization enables SRP to tie together UDDI and WSDL elements and, at the same time, abstract their concepts -- thereby making the creation of Web services a more productive task.
Internally, SRP has the main attributes you see illustrated in Table 1. They handle the interface with the UDDI4J API and maintain relevant UDDI Registry connection information.
Table 1: SRP attributes
| Attribute | Description |
| protected int maxRowsReturned = 100; | Max number of rows returned |
| protected int numRowsToSearch = 100; | Max number of rows to search |
| protected String inquiryURL; | URL used in Find operations |
| protected String publishURL; | URL used in Publish operations |
| protected String userId; | Userid to connect to the UDDI Registry |
| protected String cred; | Password to connect to the UDDI Registry |
| protected UDDIProxy uddiProxy; | UDDI4J proxy object |
The SRP API consists of the following functional groups: Publish, Unpublish, and Find -- as shown in Table 2. For complete SRP API javadocs, please see Resources for a link.
Table 2: SRP functional groups
| API | Sub-API | Method Call | Description |
| Publish | Â | Â | Publishes ServiceProviders, ServiceDefinition, and ServiceInterface objects |
| Â | Â | Â | Â |
| Â | Â | publish (ServiceProvider) : ServiceProvider | Â |
| Â | Â | publish (ServiceProvider, ServiceDefinition) : ServiceDefinition | Â |
| Â | Â | publish (ServiceInterface) : ServiceInterface | Â |
| Â | Â | Â | Â |
| Unpublish | Â | Â | Unpublishes ServiceProviders, ServiceDefinition, and ServiceInterface objects |
| Â | Â | Â | Â |
| Â | Â | unpublish (ServiceProvider) : void | Â |
| Â | Â | unpublish (ServiceInterface) : void | Â |
| Â | Â | unpublish (ServiceProvider, ServiceDefinition) : void | Â |
| Â | Â | Â | Â |
| Find | Â | Â | Â |
| Â | Service Provider | Â | Find ServiceProvider objects given a search criteria |
| Â | Â | Â | Â |
| Â | Â | findAllServiceProviders (FindQualifiers, boolean) : ServiceProvider[] | Â |
| Â | Â | findServiceProvider (ServiceDefinition) : ServiceProvider | Â |
| Â | Â | findServiceProvider (String) : ServiceProvider | Â |
| Â | Â | findServiceProviders (FindQualifiers, DiscoveryURLs) : ServiceProvider[] | Â |
| Â | Â | findServiceProviders (FindQualifiers, TModelBag) : ServiceProvider[] | Â |
| Â | Â | findServiceProviders (String, boolean) : ServiceProvider[] | Â |
| Â | Â | findServiceProviders (CategoryList) : ServiceProvider[] | Â |
| Â | Â | findServiceProviders (IdentifierList) : ServiceProvider[] | Â |
| Â | Â | Â | Â |
| Â | Service Definition | Â | Find ServiceDefinition objects given a search criteria |
| Â | Â | Â | Â |
| Â | Â | findAllServices (FindQualifiers, boolean) : ServiceDefinition[] | Â |
| Â | Â | findService (String) : ServiceDefinition | Â |
| Â | Â | findService (FindQualifiers, ServiceProvider, ServiceImplementation) : ServiceDefinition | Â |
| Â | Â | findServices (FindQualifiers, TModelBag) : ServiceDefinition[] | Â |
| Â | Â | findServices (String, boolean) : ServiceDefinition[] | Â |
| Â | Â | findServices (FindQualifiers, ServiceInterface) : ServiceDefinition[] | Â |
| Â | Â | findServices (ServiceInterface, String) : ServiceDefinition[] | Â |
| Â | Â | findServices (ServiceInterface, CategoryList) : ServiceDefinition[] | Â |
| Â | Â | findServices (ServiceProvider, String) : ServiceDefinition[] | Â |
| Â | Â | findServices (FindQualifiers, ServiceProvider) : ServiceDefinition[] | Â |
| Â | Â | findServices (FindQualifiers, ServiceProvider, CategoryList) : ServiceDefinition[] | Â |
| Â | Â | findServices (FindQualifiers, CategoryList) : ServiceDefinition[] | Â |
| Â | Â | findServices (ServiceList) : ServiceDefinition[] | Â |
| Â | Â | Â | Â |
| Â | Service Interface | Â | Find ServiceInterface objects given a search criteria |
| Â | Â | Â | Â |
| Â | Â | findAllServiceInterfaces (FindQualifiers, boolean) : ServiceInterface[] | Â |
| Â | Â | findServiceInterface (String) : ServiceInterface | Â |
| Â | Â | findServiceInterfaces (String, boolean) : ServiceInterface[] | Â |
| Â | Â | findServiceInterfaces (FindQualifiers, IdentifierList) : ServiceInterface[] | Â |
| Â | Â | findServiceInterfaces (FindQualifiers, CategoryList) : ServiceInterface[] | Â |
| Â | Â | findServiceInterfaces (ServiceImplementation) : ServiceInterface[] | Â |
| Â | Â | findServiceInterfaces (ServiceImplementation, String) : ServiceInterface[] | Â |
| Â | Â | findServiceInterfaces (ServiceImplementation, IdentifierList) : ServiceInterface[] | Â |
| Â | Â | findServiceInterfaces (ServiceImplementation, CategoryList) : ServiceInterface[] | Â |
The demos in this article illustrate the capabilities of the SRP API by publishing, finding, and finally unpublishing a Service Provider element. The source code is shown in Listings 1, 2, and 3. Please feel free to use and adapt this code for your own projects.
The ServiceProviderPublishDemo, during its
initialization phase, creates an SRP object with specific URLs to publish
and inquire as well as a userid and password which have been
pre-registered with the target UDDI registry. A CategoryList class is instantiated to support the
creation of a ServiceProvider that also needs a name and a description.
Once the ServiceProvider is successfully created, the SRP publish method is invoked -- receiving this object as its only parameter. The code checks for possible error conditions issuing appropriate messages during its execution.
Listing 1: Service provider publish demo
import com.ibm.wstk.service.provider.*;
import com.ibm.wstk.service.registry.*;
import com.ibm.wstk.service.util.*;
import com.ibm.wstk.uddi.*;
public class ServiceProviderPublishDemo
{
public static String UDDI_TEST_REGISTRY_INQUIRY
= "http://www-3.ibm.com/services/uddi/testregistry/inquiryapi";
public static String UDDI_TEST_REGISTRY_PUBLISH
= "https://www-3.ibm.com/services/uddi/testregistry/protect/publishapi";
public static String UDDI_USER = "srpuser";
public static String UDDI_PASSWD = "srppwd";
public static String SERVICE_PROVIDER_NAME = "demo provider";
public static String SERVICE_PROVIDER_DESC = "SRP provider demo";
public static String TMODEL_KEY = "NAICS";
public static String KEY_NAME = "Greeting Card Publishers";
public static String KEY_VALUE = "511191";
public static void main(String args[])
{
try
{
//////////////////// INITIALIZATION
/////////////////////////////////
// Create Service Registry Proxy
ServiceRegistryProxy srp =
new ServiceRegistryProxy(UDDI_TEST_REGISTRY_INQUIRY,
UDDI_TEST_REGISTRY_PUBLISH,
UDDI_USER, UDDI_PASSWD);
// Create category list
CategoryList categoryList =
new CategoryList(TModelKeyTable.getTModelKey(TMODEL_KEY),
KEY_NAME, KEY_VALUE);
// Create service provider
ServiceProvider serviceProvider =
new ServiceProvider(SERVICE_PROVIDER_NAME,
SERVICE_PROVIDER_DESC,
categoryList);
//////////////////// PUBLISH
////////////////////////////////////////
// Publish the service provider
srp.publish(serviceProvider);
// Display publish completed message
System.out.println("Service provider " + "\"" +
SERVICE_PROVIDER_NAME + "\"" + " was published.");
}
catch (ServiceRegistryProxyException e)
{
System.out.println("ServiceRegistryProxyException: " + e.getMessage());
}
catch (InvalidCategoryException e)
{
System.out.println("InvalidCategoryException: " + e.getMessage());
}
}
}
|
The demo responsible for finding a ServiceProvider creates an SRP instance with the same parameters used by the previous demo.
The previously published ServiceProvider is then found using one of the find SRP methods, and appropriate messages are generated during execution:
Listing 2: Service provider find demo
import com.ibm.wstk.service.provider.*;
import com.ibm.wstk.service.registry.*;
import com.ibm.wstk.service.util.*;
import com.ibm.wstk.uddi.*;
public class ServiceProviderFindDemo
{
public static String UDDI_TEST_REGISTRY_INQUIRY
= "http://www-3.ibm.com/services/uddi/testregistry/inquiryapi";
public static String UDDI_TEST_REGISTRY_PUBLISH
= "https://www-3.ibm.com/services/uddi/testregistry/protect/publishapi";
public static String UDDI_USER = "srpuser";
public static String UDDI_PASSWD = "srppwd";
public static String SERVICE_PROVIDER_NAME = "demo provider";
public static void main(String args[])
{
try
{
//////////////////// INITIALIZATION
/////////////////////////////////
// Create Service Registry Proxy
ServiceRegistryProxy srp =
new ServiceRegistryProxy(UDDI_TEST_REGISTRY_INQUIRY,
UDDI_TEST_REGISTRY_PUBLISH,
UDDI_USER, UDDI_PASSWD);
//////////////////// FIND
///////////////////////////////////////////
// Find the published service provider
ServiceProvider[] serviceProviderList =
srp.findServiceProviders(SERVICE_PROVIDER_NAME, true);
// Display find completed message
if (serviceProviderList == null)
System.out.println("Service provider " + "\"" +
SERVICE_PROVIDER_NAME
+ "\"" + " was not found.");
else
{
System.out.println("Service Provider Name: " +
serviceProviderList[0].getBusinessEntity
().getNameString());
System.out.println(" Description: " +
serviceProviderList[0].getBusinessEntity
().getDefaultDescriptionString());
}
}
catch (ServiceRegistryProxyException e)
{
System.out.println("ServiceRegistryProxyException: " + e.getMessage());
}
}
}
|
At last it is unpublish time. Initialization is the same as before. Then the target ServiceProvider is found and unpublished via the appropriate SRP unpublish method. Again, errors are monitored and reported.
Listing 3: Service provider unpublish demo
import com.ibm.wstk.service.provider.*;
import com.ibm.wstk.service.registry.*;
import com.ibm.wstk.service.util.*;
import com.ibm.wstk.uddi.*;
public class ServiceProviderUnpublishDemo
{
public static String UDDI_TEST_REGISTRY_INQUIRY
= "http://www-3.ibm.com/services/uddi/testregistry/inquiryapi";
public static String UDDI_TEST_REGISTRY_PUBLISH
= "https://www-3.ibm.com/services/uddi/testregistry/protect/publishapi";
public static String UDDI_USER = "srpuser";
public static String UDDI_PASSWD = "srppwd";
public static String SERVICE_PROVIDER_NAME = "demo provider";
public static void main(String args[])
{
try
{
//////////////////// INITIALIZATION
/////////////////////////////////
// Create Service Registry Proxy
ServiceRegistryProxy srp =
new ServiceRegistryProxy(UDDI_TEST_REGISTRY_INQUIRY,
UDDI_TEST_REGISTRY_PUBLISH,
UDDI_USER, UDDI_PASSWD);
//////////////////// UNPUBLISH
//////////////////////////////////////
// Find the published service provider
ServiceProvider[] serviceProviderList =
srp.findServiceProviders(SERVICE_PROVIDER_NAME, true);
if (serviceProviderList != null)
{
// Unpublish the service provider
srp.unpublish(serviceProviderList[0]);
// Display unpublish completed message
System.out.println("Service provider " + "\"" +
SERVICE_PROVIDER_NAME + "\"" + " was unpublished.");
}
else
// Display error message
System.out.println("Service provider " + "\"" +
SERVICE_PROVIDER_NAME + "\"" + " not found.");
}
catch (ServiceRegistryProxyException e)
{
System.out.println("ServiceRegistryProxyException: " + e.getMessage());
}
}
}
|
These demos use the IBM UDDI Test Registry to interact; a predefined login and password have already been registered with the Test Registry.
The SRP, UDDI4J, and WSDL4J are also available as part of the IBM Web Services Toolkit (WSTK) - see Resources for a link. Once WSTK is installed and configured, follow these directions to compile and execute the Service Provider in a Microsoft Windows 2000 environment (The only difference on Linux or Unix would be in the syntax of the commands used to compiled and execute the code):
Open a shell window and go to the directory where the demos are located, and from the prompt type the following:
%WSTK_HOME%\bin\wstkenv.bat javac -classpath .;%WSTK_CP%;%WSTK_HOME%\uddi4j\lib\uddi4j.jar *.java |
In the same shell window now type:
java -cp .;%WSTK_CP%;%WSTK_HOME%\uddi4j\lib\uddi4j.jar ServiceProviderXXXDemo |
A successful execution of these demos yields the output shown in Table 3.
Table 3: Demos' output
| Demo | Output |
| ServiceProviderPublishDemo | Service provider "demo provider" was published |
| ServiceProviderFindDemo | Service Provider Name: demo provider Description: SRP provider demo |
| ServiceProviderUnpublishDemo | Service provider "demo provider" was unpublished |
Now that you are familiar with SRP, I hope that you will find the tool useful. Please feel free to use the code presented here in your own work, and remember to let the Web services team know what other types of articles or tools you would find useful. You'll find links to the WSTK page (and links to feedback forms for the project team) listed in the Resources section.
- Visit the UDDI4J Project site to get complete information and the latest file releases.
- Download the IBM Web Services Toolkit from alphaWorks.
- Visit the IBM Web services page.
- Send feedback to the IBM Web services toolkit team at the alphaWorks WSTK discussion forum.
- Review the first release of the WSDL 1.0 Specification.
- Read the elucidative document, "Using WSDL in a UDDI Registry 1.05" (in PDF format).
Alfredo da Silva is a software developer at IBM. He is a member of the group responsible for the IBM Web Services Toolkit (WSTK). You can contact Alfredo at afdasilv@us.ibm.com.




