Using the UDDI Inquiry API

The UDDIProxy PowerBuilder extension class enables you to search UDDI registries for a Web service that you want to access. For a description of this extension class and its methods, see the PowerBuilder Extension Reference or the online Help.

Example code

The following is example code using all the methods in the UDDIProxy class. It searches an IBM UDDI registry by service name (Weather) and business name (IBM), using the same search options (case sensitivity and a maximum of 5 rows returned):

uddiproxy proxy
int ret
proxy = create uddiproxy
ret = proxy.setinquiryurl   (“http:/www-3.ibm.com/services/uddi/inquiryapi”)
ret = proxy.setoption (false, true, 0, 5)
int count, count2
string businessName[], businessDescription[]
string businessKey []
string servicename[], servicedescription[]
string servicekey [], wsdl [ ]
ret = proxy.findService(“Weather”,count,serviceName, &
  serviceDescription, serviceKey, businessName, wsdl)
int i, j
FOR i = 1 TO count
   messagebox(servicename[i], &
     servicedescription[i]+servicekey[i]+wsdl[i])
NEXT

proxy.findbusiness(“IBM”, count, businessName, &
  businessDescription, businessKey)
FOR i = 1 TO count
   messagebox(businessName[i], &
     businessDescription[i] + businessKey[i])
  proxy.getbusinessdetail (businessKey [i], count2, &
     servicename, servicedescription, servicekey, wsdl)
  FOR j = 1 TO count2
   messagebox(servicename[j], &
     servicedescription[j]+servicekey[j]+wsdl[j])
  NEXT
NEXT
destroy proxy

Troubleshooting UDDI API calls

You can turn on logging to track down any failures on method calls to the UDDIProxy object. The PowerBuilder Java service class path must include the log4j.properties configuration file to turn on logging. The following is an example of a log configuration file for a UDDI search:

#log4j.debug=true
#log all level
#log4j.rootCategory=DEBUG, lf5
#only log com.sybase.powerbuilder.uddi
log4j.category.com.sybase.powerbuilder.uddi=DEBUG,     dest2, lf5
#dest1
#log4j.appender.dest1=org.apache.log4j.ConsoleAppender
#log4j.appender.dest1.layout=
    org.apache.log4j.PatternLayout
#log4j.appender.dest1.layout.ConversionPattern=
    %-5p: %-5r: %-5c: %l: %m%n
#dest2
log4j.appender.dest2=org.apache.log4j.FileAppender
log4j.appender.dest2.layout=
    org.apache.log4j.PatternLayout
log4j.appender.dest2.layout.ConversionPattern=
    %-5p: %l: %m%n
log4j.appender.dest2.File=c:/mylog.txt
#lf5
log4j.appender.lf5=
    org.apache.log4j.RollingFileAppender
log4j.appender.lf5.File=c:/mylog.lf5
log4j.appender.lf5.layout=
    org.apache.log4j.PatternLayout
log4j.appender.lf5.layout.ConversionPattern=
    [slf5s.start]%d{DATE}[slf5s.DATE]%n\
    %p[slf5s.PRIORITY]%n%x[slf5s.NDC]
    %n%t[slf5s.THREAD]%n\%c[slf5s.CATEGORY]
    %n%l[slf5s.LOCATION]%n%m[slf5s.MESSAGE]%n%n
log4j.appender.lf5.MaxFileSize=500KB