uddi4j是
http://uddi4j.sourceforge.net/
上的open source的project 用于访问UDDI registry.
下面是一个sample通过UDDI registry server 来查找相应的web service 的WSDL
import org.uddi4j.response.*;
import org.uddi4j.client.UDDIProxy;
import org.uddi4j.datatype.Name;
import org.uddi4j.datatype.OverviewDoc;
import org.uddi4j.datatype.tmodel.TModel;
import org.uddi4j.datatype.binding.BindingTemplate;
import org.uddi4j.datatype.binding.TModelInstanceDetails;
import org.uddi4j.datatype.binding.TModelInstanceInfo;
import org.uddi4j.util.FindQualifiers;
import org.uddi4j.util.FindQualifier;
import org.uddi4j.UDDIException;
import java.util.Vector;
/**
* @author Ramon Liu
* Date: 2005-8-31
* Time: 10:58:36
*/
public class UDDIFinder
{
public static void main (String args[])
{
UDDIFinder app = new UDDIFinder();
System.out.println("/n*********** Running UDDIFinder ***********");
app.run();
System.exit(0);
}
public void run()
{
// Construct a UDDIProxy object.
UDDIProxy proxy = new UDDIProxy();
try
{
// Select the desired UDDI server node
proxy.setInquiryURL("http://uddi.xmethods.net/inquire");
// proxy.setPublishURL(config.getProperty("publishURL"));
//creating vector of Name Object
Vector names = new Vector();
names.add(new Name("chaiwat"));
// Setting FindQualifiers to 'caseSensitiveMatch'
FindQualifiers findQualifiers = new FindQualifiers();
Vector qualifier = new Vector();
qualifier.add(new FindQualifier("caseSensitiveMatch"));
findQualifiers.setFindQualifierVector(qualifier);
//System.setProperty("org.uddi4j.TransportClassName","org.uddi4j.transport.ApacheAxisTransport");
// Find businesses by name
// And setting the maximum rows to be returned as 5.
BusinessList businessList = proxy.find_business(names, null, null, null,null,findQualifiers,5);
Vector businessInfoVector = businessList.getBusinessInfos().getBusinessInfoVector();
for( int i = 0; i < businessInfoVector.size(); i++ )
{
BusinessInfo businessInfo = (BusinessInfo)businessInfoVector.elementAt(i);
Vector serviceName = new Vector();
serviceName.add("");
// Print name for each business
ServiceList serviceList = proxy.find_service(businessInfo.getBusinessKey(),null,null,null,findQualifiers,5);
Vector serviceInfoVector = serviceList.getServiceInfos().getServiceInfoVector();
for(int j=0;j<serviceInfoVector.size();j++){
ServiceInfo serviceInfo = (ServiceInfo)serviceInfoVector.elementAt(j);
BindingDetail bindingDetail = proxy.find_binding(findQualifiers,serviceInfo.getServiceKey(),null,5);
Vector templateVector = bindingDetail.getBindingTemplateVector();
for(int k=0;k<templateVector.size();k++){
BindingTemplate bindingTemplate = (BindingTemplate)templateVector.elementAt(k);
TModelInstanceDetails tModelInstanceDetails = bindingTemplate.getTModelInstanceDetails();
Vector tModelInstanceVector = tModelInstanceDetails.getTModelInstanceInfoVector();
for(int l=0;l<tModelInstanceVector.size();l++){
TModelInstanceInfo tModelInstanceInfo = (TModelInstanceInfo)tModelInstanceVector.elementAt(l);
TModelDetail tmd = proxy.get_tModelDetail(tModelInstanceInfo.getTModelKey());
OverviewDoc ovd=((TModel)tmd.getTModelVector().elementAt(0)).getOverviewDoc();
System.out.println("wsdl url:"+ovd.getOverviewURLString());
}
}
}
}
}
// Handle possible errors
catch( UDDIException e )
{
DispositionReport dr = e.getDispositionReport();
if( dr!=null )
{
System.out.println("UDDIException faultCode:" + e.getFaultCode() +
"/n operator:" + dr.getOperator() +
"/n generic:" + dr.getGeneric() );
Vector results = dr.getResultVector();
for( int i=0; i<results.size(); i++ )
{
Result r = (Result)results.elementAt(i);
System.out.println("/n errno:" + r.getErrno() );
if( r.getErrInfo()!=null )
{
System.out.println("/n errCode:" + r.getErrInfo().getErrCode() +
"/n errInfoText:" + r.getErrInfo().getText());
}
}
}
e.printStackTrace();
}
// Catch any other exception that may occur
catch( Exception e )
{
e.printStackTrace();
}
}
http://uddi4j.sourceforge.net/
上的open source的project 用于访问UDDI registry.
下面是一个sample通过UDDI registry server 来查找相应的web service 的WSDL
import org.uddi4j.response.*;
import org.uddi4j.client.UDDIProxy;
import org.uddi4j.datatype.Name;
import org.uddi4j.datatype.OverviewDoc;
import org.uddi4j.datatype.tmodel.TModel;
import org.uddi4j.datatype.binding.BindingTemplate;
import org.uddi4j.datatype.binding.TModelInstanceDetails;
import org.uddi4j.datatype.binding.TModelInstanceInfo;
import org.uddi4j.util.FindQualifiers;
import org.uddi4j.util.FindQualifier;
import org.uddi4j.UDDIException;
import java.util.Vector;
/**
* @author Ramon Liu
* Date: 2005-8-31
* Time: 10:58:36
*/
public class UDDIFinder
{
public static void main (String args[])
{
UDDIFinder app = new UDDIFinder();
System.out.println("/n*********** Running UDDIFinder ***********");
app.run();
System.exit(0);
}
public void run()
{
// Construct a UDDIProxy object.
UDDIProxy proxy = new UDDIProxy();
try
{
// Select the desired UDDI server node
proxy.setInquiryURL("http://uddi.xmethods.net/inquire");
// proxy.setPublishURL(config.getProperty("publishURL"));
//creating vector of Name Object
Vector names = new Vector();
names.add(new Name("chaiwat"));
// Setting FindQualifiers to 'caseSensitiveMatch'
FindQualifiers findQualifiers = new FindQualifiers();
Vector qualifier = new Vector();
qualifier.add(new FindQualifier("caseSensitiveMatch"));
findQualifiers.setFindQualifierVector(qualifier);
//System.setProperty("org.uddi4j.TransportClassName","org.uddi4j.transport.ApacheAxisTransport");
// Find businesses by name
// And setting the maximum rows to be returned as 5.
BusinessList businessList = proxy.find_business(names, null, null, null,null,findQualifiers,5);
Vector businessInfoVector = businessList.getBusinessInfos().getBusinessInfoVector();
for( int i = 0; i < businessInfoVector.size(); i++ )
{
BusinessInfo businessInfo = (BusinessInfo)businessInfoVector.elementAt(i);
Vector serviceName = new Vector();
serviceName.add("");
// Print name for each business
ServiceList serviceList = proxy.find_service(businessInfo.getBusinessKey(),null,null,null,findQualifiers,5);
Vector serviceInfoVector = serviceList.getServiceInfos().getServiceInfoVector();
for(int j=0;j<serviceInfoVector.size();j++){
ServiceInfo serviceInfo = (ServiceInfo)serviceInfoVector.elementAt(j);
BindingDetail bindingDetail = proxy.find_binding(findQualifiers,serviceInfo.getServiceKey(),null,5);
Vector templateVector = bindingDetail.getBindingTemplateVector();
for(int k=0;k<templateVector.size();k++){
BindingTemplate bindingTemplate = (BindingTemplate)templateVector.elementAt(k);
TModelInstanceDetails tModelInstanceDetails = bindingTemplate.getTModelInstanceDetails();
Vector tModelInstanceVector = tModelInstanceDetails.getTModelInstanceInfoVector();
for(int l=0;l<tModelInstanceVector.size();l++){
TModelInstanceInfo tModelInstanceInfo = (TModelInstanceInfo)tModelInstanceVector.elementAt(l);
TModelDetail tmd = proxy.get_tModelDetail(tModelInstanceInfo.getTModelKey());
OverviewDoc ovd=((TModel)tmd.getTModelVector().elementAt(0)).getOverviewDoc();
System.out.println("wsdl url:"+ovd.getOverviewURLString());
}
}
}
}
}
// Handle possible errors
catch( UDDIException e )
{
DispositionReport dr = e.getDispositionReport();
if( dr!=null )
{
System.out.println("UDDIException faultCode:" + e.getFaultCode() +
"/n operator:" + dr.getOperator() +
"/n generic:" + dr.getGeneric() );
Vector results = dr.getResultVector();
for( int i=0; i<results.size(); i++ )
{
Result r = (Result)results.elementAt(i);
System.out.println("/n errno:" + r.getErrno() );
if( r.getErrInfo()!=null )
{
System.out.println("/n errCode:" + r.getErrInfo().getErrCode() +
"/n errInfoText:" + r.getErrInfo().getText());
}
}
}
e.printStackTrace();
}
// Catch any other exception that may occur
catch( Exception e )
{
e.printStackTrace();
}
}