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

📄 testclient.java

📁 UDDI for weblgoci In the main function, there is a list of functions calls that are commented. Each
💻 JAVA
📖 第 1 页 / 共 5 页
字号:
         AccessPoint acpt = new AccessPoint("www.testudditest.com", "https");
         btemp.setAccessPoint(acpt);
         
         BindingTemplates btemps = new BindingTemplates();
         
         TModelInstanceInfo tminfo = new TModelInstanceInfo();
         tminfo.addDescription("Sample TModelInstanceInfo Description");
         tminfo.setTModelKey("UUID:68DE9E80-AD09-469D-8A37-088422BFBC36");
         
         TModelInstanceDetails tmidls = new TModelInstanceDetails();
         tmidls.addTModelInstanceInfo(tminfo);
         
         btemp.setTModelInstanceDetails(tmidls);
         
         btemps.addBindingTemplate(btemp);
         bs.setBindingTemplates(btemps);
         //bs.setCategoryBag(CategoryBag);

         System.out.print("Validating Category .....");
         ValidateCategorization vc = new ValidateCategorization();
         // set all the arguments and attributes of the message
         // follow the uddi.org specification for details.
         vc.setTModelKey(new TModelKey("UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"));
         vc.setKeyValue(new KeyValue("334"));
         vc.setBusinessService(bs);
         DispositionReport dr = p.validateCategorization(vc);
         System.out.println("Done.");
      }
      catch(UDDIException ue)
      {
         System.out.println("");
         System.out.println("**** UDDIEXception ***");
         System.out.println("Fault Actor : " + ue.getFaultActor());
         System.out.println("Fault Error : " + ue.getFaultCode());
         DispositionReport dr = ue.getDispositionReport();
         Vector res = dr.getResultVector();
         Result r = (Result)res.elementAt(0);
         ErrInfo ei = r.getErrInfo();
         System.out.println("ErrInfo : "+ ei.getValue());
      }
      catch (XML_SoapException exp){
         System.out.println("XML_SoapException");
         System.out.println(exp.getMessage());
         exp.printStackTrace();
      }
      catch(Exception e)
      {
         System.out.println("Exception");
         e.printStackTrace();
      }
   }

   private void testValidateCatByTModel()
   {
      try
      {
         TModel tmdl = new TModel();
         tmdl.setName("test4tmodel4test");
         tmdl.addDescription("Testing 1 2 3 - test tmodel");

         //tmdl.setTModelKey("UUID:6C5EDF20-2BA6-11D5-BFAF-AB3B31212312");
         tmdl.setTModelKey("");
         tmdl.setAuthorizedName("");
         tmdl.setOperator("uddiuddi");

         OverviewDoc ov = new OverviewDoc();
         //ov.addDescription("description for overview");
         ov.setOverviewURL("http://www.overview.com");
         tmdl.setOverviewDoc(ov);
         
         CategoryBag cb = new CategoryBag();
         cb.addKeyedReference("UUID:DB77450D-9FA8-45D4-A7BC-04411D14E384","Software engineering","811116");
         
         IdentifierBag ib = new IdentifierBag();
         ib.addKeyedReference("UUID:8609C81E-EE1F-4D5A-B202-3EB13AD01823","Apperceive","314159265358970");
         
         tmdl.setCategoryBag(cb);
         tmdl.setIdentifierBag(ib);

         System.out.print("Validating Category .....");
         ValidateCategorization vc = new ValidateCategorization();
         // set all the arguments and attributes of the message
         // follow the uddi.org specification for details.
         vc.setTModelKey(new TModelKey("UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2"));
         vc.setKeyValue(new KeyValue("334"));
         vc.setTModel(tmdl);
         DispositionReport dr = p.validateCategorization(vc);
         System.out.println("Done.");
      }
      catch(UDDIException ue)
      {
         System.out.println("");
         System.out.println("**** UDDIEXception ***");
         System.out.println("Fault Actor : " + ue.getFaultActor());
         System.out.println("Fault Error : " + ue.getFaultCode());
         DispositionReport dr = ue.getDispositionReport();
         Vector res = dr.getResultVector();
         Result r = (Result)res.elementAt(0);
         ErrInfo ei = r.getErrInfo();
         System.out.println("ErrInfo : "+ ei.getValue());
      }
      catch (XML_SoapException exp){
         System.out.println("XML_SoapException");
         System.out.println(exp.getMessage());
         exp.printStackTrace();
      }
      catch(Exception e)
      {
         System.out.println("Exception");
         e.printStackTrace();
      }
   }

    //Working example
    public void testFindBinding()
    {
        //method: find_binding
        //Paramters: [maxRows]
        //          serviceKey = the binding details in this 
        //                      businessService with this key will be seacrhed.
        //          [findQualifiers] = collection of findQualifier values. 
        //                            = Provided as means to override the default search criteria
        //                              see Programmers API for qualifer elements
        //          tModelBag = List of TModel UUID(Logical AND) (tModelKey = prefix with "uuid:" followed
        //                      by UUID, tModelKey are used to represent some specification)
        //                      
        //Return value: bindingDetail which contains bindingTemplate
        //              Return empty bindingDetail if there is no match

        
        try{
        
            TModelBag tModelBag = new TModelBag();
            //tModelBag.addTModelKey("UUID:C1ACF26D-9672-4404-9D70-39B756E62AB4");
            tModelBag.addTModelKey("uuid:4CD7E4BC-648B-426D-9936-443EAAC8AE23");
            //Microsoft: uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2
            
            ServiceKey serviceKey = new ServiceKey("A8E4999A-21A3-47FA-802E-EE50A88B266F");
            //ServiceKey serviceKey = new ServiceKey("B5F37E60-1941-11D5-B130-82B521D71F92");
            //ServiceKey serviceKey = new ServiceKey("BE1A0B34-E2F1-4F4B-AAE6-258C338AE358");
            FindBinding fb = new FindBinding();
             // set all the arguments and attributes of the message
             // follow the uddi.org specification for details.
            fb.setServiceKey(serviceKey.getValue());
            fb.setFindQualifiers(null);
            fb.setTModelBag(tModelBag);
            BindingDetail returnBindingDetail = i.findBinding(fb);
            
            printBindingDetail(returnBindingDetail);
        }catch(UDDIException ue)
        {
            System.out.println("UDDI Exception");
            System.out.println(ue.getFaultActor());
            System.out.println(ue.getFaultCode());
            DispositionReport dr = ue.getDispositionReport();
            Vector res = dr.getResultVector();
            Result r = (Result)res.elementAt(0);
            ErrInfo ei =  r.getErrInfo();
            System.out.println("ErrInfo : "+ ei.getValue());
            
        }
        catch (XML_SoapException exp)
        {
           System.out.println("XML_SoapException");
           System.out.println(exp.getMessage());
           exp.printStackTrace();
        }
        catch(Exception e)
        {
            System.out.println("Exception");
            e.printStackTrace();
            
        }
        
        
                                    
    }
    //Search Service by category in a BusinessEntity with BusinessKey
    //Return: ServiceList --> serviceInfos --> serviceInfo* --> name
    //serviceInfo attributes --> serviceKey and businessKey
    public void testFindServiceByCat()
    {
        System.out.println("TESTING FindService By CategoryBag");
        
        try
        {
            /*@Use this for Microsoft registry
            businessKey = 56B171AC-6E98-482A-91A2-7995C4E4B364
            KeyName = Greeting Card Publishers
            KeyValue = 511191
            TmodelKey = uuid:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2*/
            
            //BusinessKey businessKey = new BusinessKey("6827FE60-00E2-F6A9-F6C4-C6113993AA77");
            BusinessKey businessKey = new BusinessKey("0076B468-EB27-42E5-AC09-9955CFF462A3");
            FindQualifiers findQualifiers = new FindQualifiers();
            CategoryBag categoryBag = new CategoryBag();
            //categoryBag.addKeyedReference("UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2","NAICS: Software Publishers", "51121");
            //categoryBag.addKeyedReference("UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2","NAICS: Custom Computer Programming Services",  "541511");
            //categoryBag.addKeyedReference("UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2", "NAICS: Computer Systems Design Services", "541512");
            categoryBag.addKeyedReference("uuid:A035A07C-F362-44DD-8F95-E2B134BF43B4","KEYWORD", "API");
            FindService fs = new FindService();
             // set all the arguments and attributes of the message
             // follow the uddi.org specification for details.
            fs.setBusinessKey(businessKey.getValue());
            fs.setFindQualifiers(null);
            fs.setCategoryBag(categoryBag);
            ServiceList rServiceList = i.findService(fs);
            
            printServiceList(rServiceList);
        }catch(UDDIException ue){
            System.out.println("UDDIEXception");
            System.out.println(ue.getFaultActor());
            System.out.println(ue.getFaultCode());
            DispositionReport dr = ue.getDispositionReport();
            Vector res = dr.getResultVector();
            Result r = (Result)res.elementAt(0);
            ErrInfo ei =  r.getErrInfo();
            System.out.println("ErrInfo : "+ ei.getValue());
            
        }
        catch (XML_SoapException exp)
        {
           System.out.println("XML_SoapException");
           System.out.println(exp.getMessage());
           exp.printStackTrace();
        }
        catch(Exception e){
            System.out.println("Exception");
            e.printStackTrace();
        }
    }
    //Search Service by name in a BusinessEnity with BusinessKey
    //Return: ServiceList --> serviceInfos --> serviceInfo* --> name
    //serviceInfo attributes --> serviceKey and businessKey
    /*BusinessKey = 6827FE60-00E2-F6A9-F6C4-C6113993AA77
    http://www-3.ibm.com/services/uddi/inquiryapi
    Name = Buy
*******************SERVICE LIST***************
Service Info Name : UDDI.Name@640ba54a
Service Info Attr ServiceKey : 6828022E-00E2-E46A-9849-C6113993AA77
ServiceInfo Attr BusinessKey : 6827FE60-00E2-F6A9-F6C4-C6113993AA77
Service Info Name : UDDI.Name@644ba54a
Service Info Attr ServiceKey : 68280790-00E2-E6C8-E8F8-C6113993AA77
ServiceInfo Attr BusinessKey : 6827FE60-00E2-F6A9-F6C4-C6113993AA77
Service List Attr ==> operator : www.ibm.com/services/uddi
*******************SERVICE LIST****************/
    public void testFindServiceByName()
    {
        
        System.out.println("TEST FindService by Name");
        try
        {
            BusinessKey businessKey = new BusinessKey("0076B468-EB27-42E5-AC09-9955CFF462A3");
            Name name = new Name("uddi");

            FindQualifiers fqs = new FindQualifiers();
            fqs.addFindQualifier("sortByNameDesc");
            //fqs.addFindQualifier("caseSensitiveMatch");
            
            FindService fs = new FindService();
             // set all the arguments and attributes of the message
             // follow the uddi.org specification for details.
            fs.setBusinessKey(businessKey.getValue());
            fs.setFindQualifiers(fqs);
            fs.setName(name);
            ServiceList rServiceList = i.findService(fs);
            
            printServiceList(rServiceList);
        }catch(UDDIException ue){
            System.out.println("UDDIEXception");
            System.out.println(ue.getFaultActor());
            System.out.println(ue.getFaultCode());
            DispositionReport dr = ue.getDispositionReport();
            Vector res = dr.getResultVector();
            Result r = (Result)res.elementAt(0);
            ErrInfo ei =  r.getErrInfo();
            System.out.println("ErrInfo : "+ ei.getValue());
            
        }
        catch (XML_SoapException exp)
        {
           System.out.println("XML_SoapException");
           System.out.println(exp.getMessage());
           exp.printStackTrace();
        }
        catch(Exception e){
            System.out.println("Exception");
            e.printStackTrace();
        }
        
    }
    //Purpose: Search Service by tModelBag in a BusinessEntity with BusinessKey
    //Return: ServiceList --> serviceInfos --> serviceInfo* --> name
    //serviceInfo attributes --> serviceKey and businessKey
    public void testFindServiceByTModelBag()
    {
        System.out.println("TEST FindService By TModelBag");
        try
        {
            BusinessKey businessKey = new BusinessKey("D2033110-3AAF-11D5-80DC-002035229C64");//UUID:7CF7BFF4-C5CA-4F89-BC87-C6A453BBD8D9");
            //BusinessKey businessKey = new BusinessKey("6827FE60-00E2-F6A9-F6C4-C6113993AA77");//UUID:7CF7BFF4-C5CA-4F89-BC87-C6A453BBD8D9");
            FindQualifiers findQualifiers = new FindQualifiers();
            TModelBag tModelBag = new TModelBag();
            
            tModelBag.addTModelKey("UUID:68DE9E80-AD09-469D-8A37-088422BFBC36");
            //tModelBag.addTModelKey("UUID:4CD7E4BC-648B-426D-9936-443EAAC8AE23");
            //tModelBag.addTModelKey("UUID:C0B9FE13-179F-413D-8A5B-5004DB8E5BB2");

            FindService fs = new FindService();
             // set all the arguments and attributes of the message
             // follow the uddi.org specification for details.
            fs.setBusinessKey(businessKey.getValue());
            fs.setFindQualifiers(null);
            fs.setTModelBag(tModelBag);
            ServiceList rServiceList = i.findService(fs);

            printServiceList(rServiceList);
        }catch(UDDIException ue){
            System.out.println("UDDIEXception");
            System.out.println(ue.getFaultActor());

⌨️ 快捷键说明

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