FileDocCategorySizeDatePackage
findBusiness.javaAPI DocExample2888Tue Oct 09 11:03:40 BST 2001com.ecerami.uddi

findBusiness

public class findBusiness extends Object
Sample UDDI Program: searches for all companies that match the first command line argument. Example usage: java findBusiness XMethods

Fields Summary
Constructors Summary
Methods Summary
public java.util.VectorfindBusinessByName(java.lang.String businessName)
Find Business by Name

param
businessName Business Name Target
return
Vector of BusinessInfo objects

    //  Create UDDI Proxy Object
    UDDIProxy proxy = new UDDIProxy();

    //  Point to Microsoft Inquiry URL
    proxy.setInquiryURL("http://uddi.microsoft.com/inquire");

    //  Find Matching Businesses
    BusinessList businessList = proxy.find_business(businessName, null, 0);

    //  Process UDDI Response
    BusinessInfos businessInfos = businessList.getBusinessInfos();
    Vector businessInfoVector = businessInfos.getBusinessInfoVector();
    return businessInfoVector;
   
public static voidmain(java.lang.String[] args)
Main method

    findBusiness inquiry = new findBusiness();

    try {
      //  Search for Specified Business Name
      String businessName = args[0];
      System.out.println ("Searching for Businesses:  "+businessName);
      Vector businessInfoVector = inquiry.findBusinessByName (businessName);

      // Print name and business key for each matching business
      for (int i=0; i<businessInfoVector.size(); i++) {
          BusinessInfo businessInfo =
            (BusinessInfo) businessInfoVector.elementAt(i);
          String name = businessInfo.getNameString();
          String businessKey = businessInfo.getBusinessKey();
          System.out.println (name+":  "+businessKey);
      }
    } catch (MalformedURLException e) {
      e.printStackTrace();
    } catch (SOAPException e) {
      e.printStackTrace();
    } catch (UDDIException e) {
      //  Extract UDDI Disposition Report
      DispositionReport dr = e.getDispositionReport();
      if (dr!=null) {
        System.out.println("UDDIException faultCode:" +
          e.getFaultCode() +
          "\n errno:"    + dr.getErrno() +
          "\n errCode:"  + dr.getErrCode() +
          "\n errInfoText:" + dr.getErrInfoText());
      }
      e.printStackTrace();
    }