1 9 10 import java.util.Properties ; 11 import java.util.Vector ; 12 13 import org.uddi4j.UDDIException; 14 import org.uddi4j.client.UDDIProxy; 15 import org.uddi4j.datatype.Name; 16 import org.uddi4j.response.BusinessInfo; 17 import org.uddi4j.response.BusinessList; 18 import org.uddi4j.response.DispositionReport; 19 import org.uddi4j.response.Result; 20 import org.uddi4j.util.FindQualifier; 21 import org.uddi4j.util.FindQualifiers; 22 23 35 36 public class FindBusinessExample 37 { 38 Properties config = null; 39 40 public static void main (String args[]) 41 { 42 FindBusinessExample app = new FindBusinessExample(); 43 System.out.println("\n*********** Running FindBusinessExample ***********"); 44 app.run(); 45 System.exit(0); 46 } 47 48 public void run() 49 { 50 config = Configurator.load(); 52 53 UDDIProxy proxy = new UDDIProxy(); 55 56 try 57 { 58 proxy.setInquiryURL(config.getProperty("inquiryURL")); 60 proxy.setPublishURL(config.getProperty("publishURL")); 61 62 Vector names = new Vector (); 64 names.add(new Name("S")); 65 66 FindQualifiers findQualifiers = new FindQualifiers(); 68 Vector qualifier = new Vector (); 69 qualifier.add(new FindQualifier("caseSensitiveMatch")); 70 findQualifiers.setFindQualifierVector(qualifier); 71 72 BusinessList businessList = proxy.find_business(names, null, null, null,null,findQualifiers,5); 75 76 Vector businessInfoVector = businessList.getBusinessInfos().getBusinessInfoVector(); 77 for( int i = 0; i < businessInfoVector.size(); i++ ) 78 { 79 BusinessInfo businessInfo = (BusinessInfo)businessInfoVector.elementAt(i); 80 81 System.out.println(businessInfo.getDefaultNameString()); 83 } 84 } 85 catch( UDDIException e ) 87 { 88 DispositionReport dr = e.getDispositionReport(); 89 if( dr!=null ) 90 { 91 System.out.println("UDDIException faultCode:" + e.getFaultCode() + 92 "\n operator:" + dr.getOperator() + 93 "\n generic:" + dr.getGeneric() ); 94 95 Vector results = dr.getResultVector(); 96 for( int i=0; i<results.size(); i++ ) 97 { 98 Result r = (Result)results.elementAt(i); 99 System.out.println("\n errno:" + r.getErrno() ); 100 if( r.getErrInfo()!=null ) 101 { 102 System.out.println("\n errCode:" + r.getErrInfo().getErrCode() + 103 "\n errInfoText:" + r.getErrInfo().getText()); 104 } 105 } 106 } 107 e.printStackTrace(); 108 } 109 catch( Exception e ) 111 { 112 e.printStackTrace(); 113 } 114 } 115 } 116 | Popular Tags |