[Originally posted on March 23, 2004 ]
CAVEAT: None of this code will probably work- UDDI Business Registries are so very 2001
Some years back (2001?) I had written up a very primitive command line tool to dump data from a UDDI (then V1) registry. I recently updated it for the current version of uddi4j.
The command tool was very optimistically named ‘UDDI Browser’ (source listed at end of article). It enabled you to do things like:
Find a business by name
java com.soaprpc.uddi4j.tools.UDDIBrowser http://uddi.ibm.com/ubr/inquiryapi find_business name ibm
Look at the list of business returned, and drill-down using a business key
java com.soaprpc.uddi4j.tools.UDDIBrowser http://uddi.ibm.com/ubr/inquiryapi find_business key D2033110-3AAF-11D5-80DC-002035229C64
On finding a service you like, you can get information on it:
java com.soaprpc.uddi4j.tools.UDDIBrowser http://uddi.ibm.com/ubr/inquiryapi find_service key 894B5100-3AAF-11D5-80DC-002035229C64
The prerequisites for the code are:
- Apache SOAP- uddi4j works with Axis, however I had problems with the current Axis release. I haven’t verified which Axis version uddi4j works with. however you should use Xerces due to a bug with Crimson- see my comment below. You would have to make a small, one line change in the code to set the correct SOAP transport class.
- Java mail (required by Apache SOAP)
- Java activation framework (required by Apache SOAP)
- And offcoure, uddi4j. Further instructions are here.
Note that if you run this software from behind a proxy server, you would need to specify the proxy host and port at the command line using -Dhttp.proxyHost/-Dhttp.proxyPort.
Most commercial Web service products include a UDDI browser, but if you are looking for an open source/free option and don’t like the primitive interface of my UDDI tool, you do have some options. Many moons ago I worked briefly on one such tool- the now defunct HP Registry Composer. I found a datasheet for it still around on the ‘HP Middleware’ website. Your other (non-defunct) options include soapclient’s web based UDDI browser and an open source SWING based tool called uddibrowse (I’ve seen some screenshots, but haven’t tried it out).
The public UDDI registries (UDDI Business Registry- UBR) have a web based interface too. Uddi4j’s website lists them, but is outdated- it still has HP’s UBR site listed (HP dropped most it’s Web Service offerings about a year and a half/two years ago), and the Microsoft UBR address is incorrect. A complete list is:
| IBM-Production |
|
|
|
Registration web site |
https://uddi.ibm.com/ubr/registry.html |
|
Inquiry URL |
http://uddi.ibm.com/ubr/inquiryapi |
|
Publish URL |
https://uddi.ibm.com/ubr/publishapi |
| Microsoft-Production |
|
|
|
Registration web site |
http://uddi.microsoft.com |
|
Inquiry URL |
http://uddi.microsoft.com/inquire |
|
Publish URL |
https://uddi.microsoft.com/publish |
| SAP-Production |
|
|
|
Registration web site |
http://uddi.sap.com |
|
Inquiry URL |
http://uddi.sap.com/UDDI/api/inquiry/ |
|
Publish URL |
https://uddi.sap.com/UDDI/api/publish/ |
If you are planning to publish to the UDDI registry, you should use the ‘test’ registries. These currently support UDDI V3 Beta, and are backwards compatible with the UDDI V2 API.
| IBM-Test |
|
|
|
Registration web site |
https://uddi.ibm.com/beta/registry.html |
|
Inquiry URL |
http://uddi.ibm.com/beta/inquiryapi |
|
Publish URL |
https://uddi.ibm.com/beta/publishapi |
| Microsoft-Test |
|
|
|
Registration web site |
http://uddi.beta.microsoft.com |
|
Inquiry URL |
http://uddi.beta.microsoft.com/inquire |
|
Publish URL |
https://uddi.beta.microsoft.com/publish |
| SAP-Test |
|
|
|
Registration web site |
http://udditest.sap.com |
|
Inquiry URL |
http://udditest.sap.com/UDDI/api/inquiry/ |
|
Publish URL |
https://udditest.sap.com/UDDI/api/publish/ |
Source code for UDDIBrowser (see the circa 2001 usage of java.util.Vector!)
/**
* This code is licensed under the following terms:
* Creative Commons Attribution-NoDerivs-NonCommercial 1.0
* http://creativecommons.org/licenses/by-nd-nc/1.0/
*
* Copyright (c) soaprpc.com. All rights reserved.
*/
package com.soaprpc.uddi4j.tools;
import org.uddi4j.*;
import org.uddi4j.client.*;
import org.uddi4j.datatype.*;
import org.uddi4j.datatype.assertion.*;
import org.uddi4j.datatype.binding.*;
import org.uddi4j.datatype.business.*;
import org.uddi4j.datatype.service.*;
import org.uddi4j.datatype.tmodel.*;
import org.uddi4j.request.*;
import org.uddi4j.response.*;
import org.uddi4j.transport.*;
import org.uddi4j.util.*;
import java.io.*;
import java.net.*;
import java.util.Properties;
import java.util.Vector;
/**
* The UDDIBrowser class is a command line based UDDI registry browser
*
* @author Vivek Chopra (www.soaprpc.com)
*/
public class UDDIBrowser {
/**
* The UDDIProxy object. All API calls to the UDDI registry are made against
* this object.
*/
private UDDIProxy _uddiProxy;
public UDDIBrowser(UDDIProxy uddiProxy) {
_uddiProxy = uddiProxy;
}
/*
* Utility method for dumping the DispositionReport
*/
void printUDDIExceptionDetail(UDDIException uddiException, String message) {
System.out.println(message + "\n");
DispositionReport dispositionReport = uddiException.getDispositionReport();
if (dispositionReport != null) {
System.out.println("UDDIException faultCode:" +
uddiException.getFaultCode() + "\n operator:" +
dispositionReport.getOperator() + "\n generic:" +
dispositionReport.getGeneric());
Vector results = dispositionReport.getResultVector();
for (int i = 0; i < results.size(); i++) {
Result result = (Result) results.elementAt(i);
System.out.println("\n errno:" + result.getErrno());
if (result.getErrInfo() != null) {
System.out.println("\n errCode:" +
result.getErrInfo().getErrCode() + "\n errInfoText:" +
result.getErrInfo().getText());
}
}
}
}
/* Browse by Business Name- return all matching business entities */
private void browseBusinessByName(String businessName) {
BusinessList businessList = null;
try {
Vector names = new Vector();
names.add(new Name(businessName));
businessList = _uddiProxy.find_business(names, null, null, null,
null, null, 0);
} catch (UDDIException e) {
printUDDIExceptionDetail(e,
"UDDI error browsing for businesses in UDDI Registry");
System.exit(1); /* fatal error */
} catch (Exception e) {
System.out.println(
"Exception browsing for businesses in UDDI Registry: " +
e.getMessage());
// e.printStackTrace ();
System.exit(1); /* fatal error */
}
/* Since logging is enabled, all request and response messages will be
* dumped to console
*/
}
/* Browse by Business key- return an entire businessEntity */
private void browseBusinessByKey(String businessKey) {
Vector vector = new Vector();
vector.addElement(businessKey);
BusinessDetail businessDetail = null;
try {
businessDetail = _uddiProxy.get_businessDetail(vector);
} catch (UDDIException e) {
printUDDIExceptionDetail(e,
"UDDI error browsing for businesses in UDDI Registry");
System.exit(1); /* fatal error */
} catch (Exception e) {
System.out.println(
"Exception browsing for businesses in UDDI Registry: " +
e.getMessage());
// e.printStackTrace ();
System.exit(1); /* fatal error */
}
/* Since logging is enabled, all request and response messages will be
* dumped to console
*/
}
/* Browse by Service key- return an entire businessService */
private void browseServiceByKey(String businessServiceKey) {
Vector vector = new Vector();
vector.addElement(businessServiceKey);
ServiceDetail serviceDetail = null;
try {
serviceDetail = _uddiProxy.get_serviceDetail(vector);
} catch (UDDIException e) {
printUDDIExceptionDetail(e,
"UDDI error browsing for services in UDDI Registry");
System.exit(1); /* fatal error */
} catch (Exception e) {
System.out.println(
"Exception browsing for services in UDDI Registry: " +
e.getMessage());
// e.printStackTrace ();
System.exit(1); /* fatal error */
}
/* Since logging is enabled, all request and response messages will be
* dumped to console
*/
}
/* Browse by tModel Name- return all matching tModel infos */
private void browseTModelByName(String tModelName) {
TModelList tModelList = null;
try {
tModelList = _uddiProxy.find_tModel(tModelName, null, null, null, 0);
} catch (UDDIException e) {
printUDDIExceptionDetail(e,
"UDDI error browsing for tModels in UDDI Registry");
System.exit(1); /* fatal error */
} catch (Exception e) {
System.out.println(
"Exception browsing for tModels in UDDI Registry: " +
e.getMessage());
// e.printStackTrace ();
System.exit(1); /* fatal error */
}
/* Since logging is enabled, all request and response messages will be
* dumped to console
*/
}
/* Browse by tModel key- return a TModelDetail structure */
private void browseTModelByKey(String tModelKey) {
Vector vector = new Vector();
vector.addElement(tModelKey);
TModelDetail tModelDetail = null;
try {
tModelDetail = _uddiProxy.get_tModelDetail(vector);
} catch (UDDIException e) {
printUDDIExceptionDetail(e,
"UDDI error browsing for tModels in UDDI Registry");
System.exit(1); /* fatal error */
} catch (Exception e) {
System.out.println(
"Exception browsing for tModels in UDDI Registry: " +
e.getMessage());
// e.printStackTrace ();
System.exit(1); /* fatal error */
}
/* Since logging is enabled, all request and response messages will be
* dumped to console
*/
}
/* Print usage message */
private static void usage() {
System.out.println(
"usage: UDDIBrowser <inquiry_url> <find_business|find_service|find_tmodel> <options>\n" +
" <options> are :\n" +
" [for find_business]\n" +
" name <partial_business_name>\n" +
" key <businessKey>\n\n" +
" [for find_service]\n" +
" key <serviceKey>\n\n" +
" [for find_tmodel]\n" +
" name <partial_tmodel_name>\n" +
" key <tModelKey>");
}
public static void main(String[] args) {
/* Process command line arguments */
if (args.length < 2) {
usage();
System.exit(1);
}
/* Set up UDDI4J system properties */
/* Set SOAP transport class to Apache SOAP */
System.setProperty(TransportFactory.PROPERTY_NAME,
"org.uddi4j.transport.ApacheSOAPTransport");
/* Enable logging to dump messages to console */
System.setProperty("org.uddi4j.logEnabled", "true");
String inquiryUrl = args[0];
String inquiryMethod = args[1];
if (!inquiryMethod.equals("find_business") &&
!inquiryMethod.equals("find_service") &&
!inquiryMethod.equals("find_tmodel")) {
System.out.println("Inquiry method '" + inquiryMethod +
"' not valid- has to be one of find_business|find_service|find_tmodel");
}
/* Construct a UDDIProxy object- this represents a UDDI server
* and the actions that can be invoked against it.
*/
UDDIProxy uddiProxy = new UDDIProxy();
/* Set the inquiry URL */
try {
uddiProxy.setInquiryURL(inquiryUrl);
System.out.println("Using Inquiry URL [" + inquiryUrl + "]");
} catch (MalformedURLException e) {
System.out.println("Malformed publish URL for the UDDI registry [" +
inquiryUrl + "]: " + e.getMessage());
System.exit(1);
}
/* Make the inquiry call to the UDDI registry */
UDDIBrowser browser = new UDDIBrowser(uddiProxy);
if (inquiryMethod.equals("find_business")) {
if (args[2].equals("name")) {
browser.browseBusinessByName(args[3]);
} else if (args[2].equals("key")) {
browser.browseBusinessByKey(args[3]);
} else {
usage();
}
} else if (inquiryMethod.equals("find_service")) {
browser.browseServiceByKey(args[3]);
} else if (inquiryMethod.equals("find_tmodel")) {
if (args[2].equals("name")) {
browser.browseTModelByName(args[3]);
} else if (args[2].equals("key")) {
browser.browseTModelByKey(args[3]);
} else {
usage();
}
} else {
usage();
}
}
}