⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 createnewbusiness.java

📁 注册/发布/查找webservice实例.
💻 JAVA
字号:
import org.uddi4j.client.UDDIProxy;
import org.uddi4j.response.AuthToken;
import org.uddi4j.transport.TransportFactory;

import org.uddi4j.datatype.business.BusinessEntity;
import org.uddi4j.response.BusinessDetail;

import org.uddi4j.datatype.business.Contact;
import org.uddi4j.datatype.business.Contacts;
import org.uddi4j.util.KeyedReference;
import org.uddi4j.util.IdentifierBag;
import org.uddi4j.util.CategoryBag;
import org.uddi4j.datatype.tmodel.TModel;
import java.util.Vector;

public class CreateNewBusiness {

   public static void main (String args[]){
      String inquiryURL = "http://localhost:8080/juddi/inquiry";
      String publishURL = "http://localhost:8080/juddi/publish";
      String userId = "juddi";
      String credential = "juddi";

      String businessName = "The Daily Moon";
      String alt_businessName = "Daily Moon";
      String contact_personName = "Pat Moonie";
      String contact_phone = "212-555-1212";
      String identifier_homepage = "http://www.daily-moon.com";
      String category_NAICS = "511110";

      String transportClass = "org.uddi4j.transport.ApacheAxisTransport";
      System.setProperty(TransportFactory.PROPERTY_NAME, transportClass);

      UDDIProxy proxy = new UDDIProxy();

      try {

         proxy.setInquiryURL(inquiryURL);
         proxy.setPublishURL(publishURL);

         AuthToken token = proxy.get_authToken(userId, credential);
         System.out.println("Security authToken:" + token.getAuthInfoString());

         Vector entities = new Vector();

         BusinessEntity newBusiness = new BusinessEntity("", businessName);

         Contact newContact = new Contact(contact_personName);
         Vector contactsVector = new Vector();
         contactsVector.addElement(newContact);
         Contacts contacts = new Contacts(); contacts.setContactVector(contactsVector);
         newBusiness.setContacts(contacts);
   
         KeyedReference taxid = new KeyedReference(TModel.HOMEPAGE_TMODEL_KEY,    
               identifier_homepage);
         IdentifierBag idBag = new IdentifierBag();
         idBag.add(taxid);
         newBusiness.setIdentifierBag(idBag);

         KeyedReference category = new KeyedReference(TModel.NAICS_TMODEL_KEY, category_NAICS);
         CategoryBag catBag = new CategoryBag();
         catBag.add(category);

         entities.addElement(newBusiness);

         BusinessDetail bd = proxy.save_business(token.getAuthInfoString(),entities);

         Vector businessEntities = bd.getBusinessEntityVector();
         BusinessEntity returnedBusinessEntity = 
                       (BusinessEntity)(businessEntities.elementAt(0));
         System.out.println("The new businessKey:" 
                                + returnedBusinessEntity.getBusinessKey());

      } catch(Exception e ) {
         e.printStackTrace();         
      }
   }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -