1/*2 * Copyright 2001-2013 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 at7 * 8 * http://www.apache.org/licenses/LICENSE-2.09 * 10 * Unless required by applicable law or agreed to in writing, software11 * 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 and14 * limitations under the License.15 *16 */17package org.apache.juddi.samples;
1819import java.util.List;
20import org.apache.juddi.v3.client.config.UDDIClerk;
21import org.apache.juddi.v3.client.config.UDDIClient;
22import org.apache.juddi.v3.client.transport.Transport;
23import org.uddi.v3_service.UDDIInquiryPortType;
24import org.uddi.v3_service.UDDISecurityPortType;
2526/**27 * This class show you how get all available Access Points/Endpoints for a28 * service. This is harder than it sounds due to the complexity of UDDI's data29 * structure. The output is the list of URLs given a service's key30 *31 * @author <a href="mailto:alexoree@apache.org">Alex O'Ree</a>32 */33publicclassUddiFindEndpoints {
3435privateUDDIClerk clerk = null;
3637publicUddiFindEndpoints() {
38try {
39// create a manager and read the config in the archive; 40// you can use your config file name41UDDIClient clerkManager = newUDDIClient("META-INF/simple-publish-uddi.xml");
42 clerk = clerkManager.getClerk("default");
4344 } catch (Exception e) {
45 e.printStackTrace();
46 }
47 }
4849publicvoid fire(String authtoken, String key) {
50try {
51if (key == null) {
52 key = "uddi:juddi.apache.org:services-inquiry";
53 }
5455 List<String> endpoints = clerk.getEndpoints(key);
56 System.out.println("Endpoints returned: " + endpoints.size());
57for (int i = 0; i < endpoints.size(); i++) {
58 System.out.println(endpoints.get(i));
59 }
6061 } catch (Exception e) {
62 e.printStackTrace();
63 }
64 }
6566publicstaticvoid main(String args[]) {
67UddiFindEndpoints sp = newUddiFindEndpoints();
68 sp.fire(null, null);
69 }
70 }