public void deleteBusiness(String authToken, String businessName)
      throws TransportException, DispositionReportFaultMessage, RemoteException {

    UDDIInquiryPortType uddiInquiryService = transport.getUDDIInquiryService();

    Name name = new Name();
    name.setValue(businessName);

    FindBusiness fb = new FindBusiness();
    fb.setAuthInfo(authToken);
    fb.getName().add(name);
    fb.setMaxRows(999);

    BusinessList foundBusinesses = uddiInquiryService.findBusiness(fb);

    if (foundBusinesses.getBusinessInfos() != null) {
      for (BusinessInfo business : foundBusinesses.getBusinessInfos().getBusinessInfo()) {
        System.out.println(
            "delete business: " + business.getName() + " - " + business.getBusinessKey());
        org.uddi.api_v3.DeleteBusiness db = new org.uddi.api_v3.DeleteBusiness();
        db.setAuthInfo(authToken);
        db.getBusinessKey().add(business.getBusinessKey());
        transport.getUDDIPublishService().deleteBusiness(db);
      }
    } else {
      System.out.println("didn't found any business");
    }
  }
Esempio n. 2
0
  /**
   * This method retrieves the business entities from the UDDI server. It does not retrieve the
   * services or bindings. They are retrieved on other calls. This only retrieves the business
   * information.
   *
   * @return the BusinessEntities retrieved from the UDDI server.
   * @throws UDDIAccessorException
   */
  private CMBusinessEntities retrieveBusinessesInfoFromUDDI() throws UDDIAccessorException {
    CMBusinessEntities oEntities = new CMBusinessEntities();

    if (log.isDebugEnabled()) {
      log.debug("Retrieving business entities from UDDI using find_business web service call.");
    }

    BusinessList oBusinessList = null;

    try {
      // Use the UDDI Find Business Proxy...
      // ------------------------------------
      UDDIFindBusinessProxyObjectFactory uddiFactory = new UDDIFindBusinessProxyObjectFactory();
      UDDIFindBusinessProxy uddiProxy = uddiFactory.getUDDIBusinessInfoProxy();
      oBusinessList = uddiProxy.findBusinessesFromUDDI();
    } catch (Exception e) {
      String sErrorMessage =
          "Failed to call 'find_business' web service on the NHIN UDDI server.  Error: "
              + e.getMessage();
      log.error(sErrorMessage, e);
      throw new UDDIAccessorException(sErrorMessage, e);
    }

    // Now lets go through what we have...
    // ------------------------------------
    if ((oBusinessList != null)
        && (oBusinessList.getBusinessInfos() != null)
        && (oBusinessList.getBusinessInfos().getBusinessInfo() != null)
        && (oBusinessList.getBusinessInfos().getBusinessInfo().size() > 0)) {
      for (BusinessInfo oBusInfo : oBusinessList.getBusinessInfos().getBusinessInfo()) {
        String sKey = extractBusinessKey(oBusInfo);

        if (!m_hBusinessToIgnore.contains(sKey)) {
          // Make sure this is not one of the ones we need to filter out...
          // ----------------------------------------------------------------
          CMBusinessEntity oEntity = null;
          oEntity = businessEntityFromBusinesInfo(oBusInfo);
          if (oEntity != null) {
            oEntities.getBusinessEntity().add(oEntity);
          }
        }
      }
    }

    return oEntities;
  }