This project has retired. For details please refer to its Attic page.
Find xref
View Javadoc
1   /*
2    * Copyright 2001-2010 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   *
16   */
17  package org.apache.juddi.example.wsdl2uddi;
18  
19  import org.apache.juddi.v3.client.config.UDDIClerk;
20  import org.apache.juddi.v3.client.config.UDDIClient;
21  import org.uddi.api_v3.BindingTemplate;
22  import org.uddi.api_v3.BusinessEntity;
23  import org.uddi.api_v3.BusinessService;
24  
25  public class Find {
26  	
27  	public void find() {
28  		try {
29  			UDDIClient uddiClient = new UDDIClient("META-INF/wsdl2uddi-uddi.xml");
30  			UDDIClerk clerk = uddiClient.getClerk("joe");
31          	
32  			System.out.println("Do a find business using the businessKey uddi:uddi.joepublisher.com:business_wsdl-business");
33          	BusinessEntity businessEntity = clerk.findBusiness("uddi:uddi.joepublisher.com:business_wsdl-business");
34          	//
35          	
36          	if (businessEntity!=null) {
37  	        	System.out.println("Found business with name " + businessEntity.getName().get(0).getValue());
38  	        	System.out.println("Number of services: " + businessEntity.getBusinessServices().getBusinessService().size());
39  	        	
40  	        	for (BusinessService businessService: businessEntity.getBusinessServices().getBusinessService()) {
41  	        		System.out.println("Service Name        = '" + businessService.getName().get(0).getValue() + "'");
42  	        		System.out.println("Service Key         = '" + businessService.getServiceKey() + "'");
43  	        		System.out.println("Service Description = '" + businessService.getDescription().get(0).getValue() + "'");
44  	        		System.out.println("BindingTemplates: " + businessService.getBindingTemplates().getBindingTemplate().size());
45  	        		
46  	        		for (int i=0; i<businessService.getBindingTemplates().getBindingTemplate().size(); i++) {
47  	    				BindingTemplate bindingTemplate = businessService.getBindingTemplates().getBindingTemplate().get(i);
48  	    				System.out.println("--BindingTemplate" + " " + i + ":");
49  	    				System.out.println("  bindingKey          = " + bindingTemplate.getBindingKey());
50  	    				System.out.println("  accessPoint useType = " + bindingTemplate.getAccessPoint().getUseType());
51  	    				System.out.println("  accessPoint value   = " + bindingTemplate.getAccessPoint().getValue());
52  	    				System.out.println("  description         = " + bindingTemplate.getDescription().get(0).getValue());
53  	        		}
54  	        	}
55          	}
56  	        
57          	
58          	//TODO JUDDI-610
59  			//FindTModel findBindingTModel = WSDL2UDDI.createFindBindingTModelForPortType(portType, namespace);
60  			
61  		} 
62  		catch (Exception e) {
63  			e.printStackTrace();
64  		}
65  	}		
66  
67  	public static void main (String args[]) {
68  		Find sp = new Find();
69  		sp.find();	
70  	}
71  }