---
title: "use uddi4j retrieve all business entities  which was published by one publisher"
author: "chimae"
date: "2005-06-10T10:28:00Z"
tags: []
slug: "use-uddi4j-retrieve-all-business-entities-which-was-published-by-one-publisher"
draft: false
lastmod: "2005-06-10T10:28:00Z"
id: 110896
url: "https://chimae.iteye.com/blog/110896"
---

IBM,Microsoft的UDDI注册中心可以看到publisher发布的businessEntity以及tModel的数目。  
apache juddi 提供了同样的功能，你可以使用uddi4j的接口实现。  
以下代码给出获得publisher发布businessEntity数目的代码片断:  
/\**  
 * @author chimae@cnjsp.org  
 *  
 \*/  
package org.cnjsp.chimae.juddi;

import java.io.File;  
import java.io.FileInputStream;  
import java.io.IOException;  
import java.util.Iterator;  
import java.util.Properties;  
import java.util.Vector;

import org.uddi4j.UDDIException;  
import org.uddi4j.client.UDDIProxy;  
import org.uddi4j.datatype.business.BusinessEntity;  
import org.uddi4j.request.SaveBusiness;  
import org.uddi4j.response.AuthToken;  
import org.uddi4j.response.BusinessDetail;  
import org.uddi4j.response.BusinessInfos;  
import org.uddi4j.response.RegisteredInfo;  
import org.uddi4j.transport.TransportException;

public class SaveSCMBusiness {

    public static void main(String\[] args) throws IOException, UDDIException,  
            TransportException {  
      
       //get authToken  
        UDDIProxy proxy = new UDDIProxy();  
        proxy.setPublishURL("http://localhost:8080/juddi/publish");  
        AuthToken token = proxy.get\_authToken("chimae", "password");  
        
        String authInfo = token.getAuthInfoString();  
        
        BusinessEntity scm = new BusinessEntity("","test");  
        // put the Publisher object into a Vector  
        Vector vector = new Vector(1);  
        vector.add(scm);

        // make the request  
        BusinessDetail  detail = proxy.save\_business(authInfo, vector);

        //SaveBusiness saveBusiness = new SaveBusiness(authInfo);  
         RegisteredInfo registeeredInfo = proxy.get\_registeredInfo(authInfo);  
         BusinessInfos  businessInfos   = registeeredInfo.getBusinessInfos();  
       //get the number of businessEntity  
         System.out.println(businessInfos.size());  
           
    }  
}