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.apache.juddi.v3.client.config.UDDIClientContainer;
22  import org.uddi.api_v3.BindingTemplate;
23  import org.uddi.api_v3.BusinessEntity;
24  import org.uddi.api_v3.BusinessService;
25  
26  public class Find {
27  	
28  	public void find() {
29  		try {
30  			UDDIClient uddiClient = new UDDIClient("META-INF/wsdl2uddi-uddi.xml");
31  			UDDIClerk clerk = uddiClient.getClerk("joe");
32          	
33          	BusinessEntity businessEntity = clerk.findBusiness("uddi:uddi.joepublisher.com:business-for-wsdl");
34          	//
35          	if (businessEntity!=null) {
36  	        	System.out.println("Found business with name " + businessEntity.getName().get(0).getValue());
37  	        	if (businessEntity.getBusinessServices() !=null) {
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          	businessEntity.getBusinessServices();
59          	
60          	//TODO JUDDI-610
61  			//FindTModel findBindingTModel = WSDL2UDDI.createFindBindingTModelForPortType(portType, namespace);
62  			
63  		} 
64  		catch (Exception e) {
65  			e.printStackTrace();
66  		}
67  	}		
68  
69  	public static void main (String args[]) {
70  		Find sp = new Find();
71  		sp.find();	
72  	}
73  }