You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@juddi.apache.org by ks...@apache.org on 2013/05/08 17:31:23 UTC

svn commit: r1480323 - in /juddi/trunk: juddi-client/src/main/java/org/apache/juddi/v3/client/config/ juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/ juddi-client/src/test/re...

Author: kstam
Date: Wed May  8 15:31:22 2013
New Revision: 1480323

URL: http://svn.apache.org/r1480323
Log:
JUDDI-514 improving support for WSDL2UDDI

Added:
    juddi/trunk/juddi-examples/wsdl2uddi/
    juddi/trunk/juddi-examples/wsdl2uddi/README.txt
    juddi/trunk/juddi-examples/wsdl2uddi/pom.xml
    juddi/trunk/juddi-examples/wsdl2uddi/src/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Delete.java
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/FindService.java
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Publish.java
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/META-INF/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/META-INF/wsdl2uddi-uddi.xml
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/wsdl/
    juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/wsdl/helloworld.wsdl
    juddi/trunk/juddi-examples/wsdl2uddi/src/test/
    juddi/trunk/juddi-examples/wsdl2uddi/src/test/java/
    juddi/trunk/juddi-examples/wsdl2uddi/src/test/resources/
Modified:
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerkManager.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIKeyConvention.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/WebHelper.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/BPEL2UDDI.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java
    juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/WSDL2UDDI.java
    juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/BPEL2UDDITest.java
    juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDL2UDDITest.java
    juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java
    juddi/trunk/juddi-client/src/test/resources/wsdl/uddiv3-xml/3_2_3_business_service.xml
    juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_051_BindingTemplateWSDLTest.java
    juddi/trunk/juddi-core/src/test/resources/META-INF/uddi.xml
    juddi/trunk/juddi-examples/pom.xml

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/ClientConfig.java Wed May  8 15:31:22 2013
@@ -125,8 +125,54 @@ public class ClientConfig 
 				uddiClerk.setUDDINode(uddiNode);
 				uddiClerk.setPublisher(config.getString("manager.clerks.clerk(" + i + ")[@publisher]"));
 				uddiClerk.setPassword( config.getString("manager.clerks.clerk(" + i + ")[@password]"));
+				
+				String clerkBusinessKey = config.getString("manager.clerks.clerk(" + i + ")[@businessKey]");
+				String clerkBusinessName = config.getString("manager.clerks.clerk(" + i + ")[@businessName]");
+				String clerkKeyDomain = config.getString("manager.clerks.clerk(" + i + ")[@keyDomain]");
+				
 				String[] classes = config.getStringArray("manager.clerks.clerk(" + i + ").class");
 				uddiClerk.setClassWithAnnotations(classes);
+				
+				int numberOfWslds = config.getStringArray("manager.clerks.clerk(" + i + ").wsdl").length;
+				if (numberOfWslds > 0) {
+					UDDIClerk.WSDL[] wsdls = new UDDIClerk.WSDL[numberOfWslds];
+					for (int w=0; w<wsdls.length; w++) {
+						UDDIClerk.WSDL wsdl = uddiClerk.new WSDL();
+						String fileName = config.getString("manager.clerks.clerk(" + i + ").wsdl(" + w + ")");
+						wsdl.setFileName(fileName);
+						String businessKey = config.getString("manager.clerks.clerk(" + i + ").wsdl(" + w + ")[@businessKey]");
+						String businessName = config.getString("manager.clerks.clerk(" + i + ").wsdl(" + w + ")[@businessName]");
+						String keyDomain = config.getString("manager.clerks.clerk(" + i + ").wsdl(" + w + ")[@keyDomain]");
+						if (businessKey==null) businessKey = clerkBusinessKey;
+						if (businessKey==null) businessKey = uddiClerk.getUDDINode().getProperties().getProperty("businessKey");
+						if (businessKey==null) {
+							//use key convention to build the businessKey
+							if (businessName==null) businessName = clerkBusinessName;
+							if (keyDomain==null) keyDomain = clerkKeyDomain;
+							if (keyDomain==null) keyDomain = uddiClerk.getUDDINode().getProperties().getProperty("keyDomain");
+							if ((businessName==null && ! uddiClerk.getUDDINode().getProperties().containsKey("businessName"))
+								|| keyDomain==null && ! uddiClerk.getUDDINode().getProperties().containsKey("keyDomain")) throw new ConfigurationException("Either the wsdl(" + wsdls[w] 
+									+ ") or clerk (" + uddiClerk.name + ") elements require a businessKey, or businessName & keyDomain attributes");
+							else {
+								Properties properties = new Properties(uddiClerk.getUDDINode().getProperties());
+								if (businessName!=null) properties.put("businessName", businessName);
+								if (keyDomain!=null) properties.put("keyDomain", keyDomain);
+								businessKey = UDDIKeyConvention.getBusinessKey(properties);
+							}
+						}
+						if (! businessKey.toLowerCase().startsWith("uddi:") || ! businessKey.substring(5).contains(":")) {
+							throw new ConfigurationException("The businessKey " + businessKey + " does not implement a valid UDDI v3 key format.");
+						}
+						wsdl.setBusinessKey(businessKey);
+						if (keyDomain==null) {
+							keyDomain = businessKey.split(":")[1];
+						}
+						wsdl.setKeyDomain(keyDomain);
+						wsdls[w]=wsdl;
+					}
+					uddiClerk.setWsdls(wsdls);
+				}
+				
 				clerks.put(names[i],uddiClerk);
 			}
 		}

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerk.java Wed May  8 15:31:22 2013
@@ -18,6 +18,8 @@ package org.apache.juddi.v3.client.confi
 
 import java.io.Serializable;
 import java.lang.reflect.UndeclaredThrowableException;
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.rmi.RemoteException;
 import java.util.ArrayList;
 import java.util.Date;
@@ -26,6 +28,8 @@ import java.util.List;
 import java.util.Map;
 import java.util.Properties;
 
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
 import javax.xml.ws.Holder;
 import javax.xml.ws.soap.SOAPFaultException;
 
@@ -38,6 +42,9 @@ import org.apache.juddi.api_v3.Node;
 import org.apache.juddi.api_v3.NodeDetail;
 import org.apache.juddi.api_v3.SaveClerk;
 import org.apache.juddi.api_v3.SaveNode;
+import org.apache.juddi.v3.client.mapping.ReadWSDL;
+import org.apache.juddi.v3.client.mapping.URLLocalizerDefaultImpl;
+import org.apache.juddi.v3.client.mapping.WSDL2UDDI;
 import org.apache.juddi.v3.client.transport.TransportException;
 import org.uddi.api_v3.BindingDetail;
 import org.uddi.api_v3.BindingTemplate;
@@ -45,6 +52,7 @@ import org.uddi.api_v3.BusinessDetail;
 import org.uddi.api_v3.BusinessEntity;
 import org.uddi.api_v3.BusinessService;
 import org.uddi.api_v3.DeleteBinding;
+import org.uddi.api_v3.DeleteBusiness;
 import org.uddi.api_v3.DeleteService;
 import org.uddi.api_v3.DeleteTModel;
 import org.uddi.api_v3.DiscardAuthToken;
@@ -83,6 +91,7 @@ public class UDDIClerk implements Serial
 	private Date tokenBirthDate;
 	private String authToken;
 	private String[] classWithAnnotations;
+	private WSDL[] wsdls;
 	private String managerName;
 
 	private Map<String,Properties> services = new HashMap<String,Properties>(); 
@@ -126,6 +135,54 @@ public class UDDIClerk implements Serial
 		this.managerName = managerName;
 	}
 	
+	public void registerWsdls() {
+		if (this.getWsdls()!=null) {
+			Properties properties = new Properties();
+			properties.putAll(this.getUDDINode().getProperties());
+			
+			for (WSDL wsdl : this.getWsdls()) {
+				try {
+					URL wsdlUrl = this.getClass().getClassLoader().getResource(wsdl.getFileName());
+					ReadWSDL rw = new ReadWSDL();
+					Definition wsdlDefinition = rw.readWSDL(wsdlUrl);
+					if (wsdl.keyDomain!=null) properties.setProperty("keyDomain", wsdl.keyDomain);
+					if (wsdl.businessKey!=null) properties.setProperty("businessKey", wsdl.getBusinessKey());
+					
+					WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(this, new URLLocalizerDefaultImpl(), properties);
+					wsdl2UDDI.registerBusinessServices(wsdlDefinition);
+				} catch (Exception e) {
+					log.error("Unable to register wsdl " + wsdl.getFileName() + " ." + e.getMessage(),e);
+				} catch (Throwable t) {
+					log.error("Unable to register wsdl " + wsdl.getFileName() + " ." + t.getMessage(),t);
+				}
+			}
+		}
+	}
+	
+	public void unRegisterWsdls() {
+		if (this.getWsdls()!=null) {
+			Properties properties = new Properties();
+			properties.putAll(this.getUDDINode().getProperties());
+			
+			for (WSDL wsdl : this.getWsdls()) {
+				try {
+					URL wsdlUrl = this.getClass().getClassLoader().getResource(wsdl.getFileName());
+					ReadWSDL rw = new ReadWSDL();
+					Definition wsdlDefinition = rw.readWSDL(wsdlUrl);
+					if (wsdl.keyDomain!=null) properties.setProperty("keyDomain", wsdl.keyDomain);
+					if (wsdl.businessKey!=null) properties.setProperty("businessKey", wsdl.getBusinessKey());
+					
+					WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(this, new URLLocalizerDefaultImpl(), properties);
+					wsdl2UDDI.unRegisterBusinessServices(wsdlDefinition);
+				} catch (Exception e) {
+					log.error("Unable to register wsdl " + wsdl.getFileName() + " ." + e.getMessage(),e);
+				} catch (Throwable t) {
+					log.error("Unable to register wsdl " + wsdl.getFileName() + " ." + t.getMessage(),t);
+				}
+			}
+		}
+	}
+	
 	public Subscription register(Subscription subscription) {
 		return register(subscription, this.getUDDINode().getApiNode());
 	}
@@ -281,6 +338,27 @@ public class UDDIClerk implements Serial
 		return businessEntity;
 	}
 	
+	public void unRegisterBusiness(String businessKey) {
+		unRegisterBusiness(businessKey, this.getUDDINode().getApiNode());
+	}
+	/**
+	 * Unregisters the service with specified serviceKey.
+	 * @param service
+	 */
+	public void unRegisterBusiness(String businessKey, Node node) {
+		log.info("UnRegistering the business " + businessKey);
+		try {
+			String authToken = getAuthToken(node.getSecurityUrl()); 
+			DeleteBusiness deleteBusiness = new DeleteBusiness();
+			deleteBusiness.setAuthInfo(authToken);
+			deleteBusiness.getBusinessKey().add(businessKey);
+			getUDDINode().getTransport().getUDDIPublishService(node.getPublishUrl()).deleteBusiness(deleteBusiness);
+		} catch (Exception e) {
+			log.error("Unable to register service " + businessKey
+					+ " ." + e.getMessage(),e);
+		}
+	}
+	
 	public void unRegisterService(String serviceKey) {
 		unRegisterService(serviceKey, this.getUDDINode().getApiNode());
 	}
@@ -651,6 +729,37 @@ public class UDDIClerk implements Serial
 		this.password = password;
 	}
 
-	
+	public WSDL[] getWsdls() {
+		return wsdls;
+	}
+
+	public void setWsdls(WSDL[] wsdls) {
+		this.wsdls = wsdls;
+	}
+
+	public class WSDL {
+		
+		private String businessKey;
+		private String keyDomain;
+		private String fileName;
+		public String getBusinessKey() {
+			return businessKey;
+		}
+		public void setBusinessKey(String businessKey) {
+			this.businessKey = businessKey;
+		}
+		public String getFileName() {
+			return fileName;
+		}
+		public void setFileName(String fileName) {
+			this.fileName = fileName;
+		}
+		public String getKeyDomain() {
+			return keyDomain;
+		}
+		public void setKeyDomain(String keyDomain) {
+			this.keyDomain = keyDomain;
+		}
+	}
 
 }

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerkManager.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerkManager.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerkManager.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIClerkManager.java Wed May  8 15:31:22 2013
@@ -16,6 +16,8 @@
  */
 package org.apache.juddi.v3.client.config;
 
+import java.net.MalformedURLException;
+import java.net.URL;
 import java.rmi.RemoteException;
 import java.util.Collection;
 import java.util.List;
@@ -23,18 +25,26 @@ import java.util.Map;
 import java.util.Properties;
 import java.util.Set;
 
+import javax.wsdl.Definition;
+import javax.wsdl.WSDLException;
+
 import org.apache.commons.configuration.ConfigurationException;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.juddi.v3.client.embed.EmbeddedRegistry;
 import org.apache.juddi.v3.annotations.AnnotationProcessor;
 import org.apache.juddi.v3.client.ClassUtil;
+import org.apache.juddi.v3.client.mapping.ReadWSDL;
+import org.apache.juddi.v3.client.mapping.URLLocalizerDefaultImpl;
+import org.apache.juddi.v3.client.mapping.WSDL2UDDI;
 import org.apache.juddi.v3.client.transport.InVMTransport;
 import org.apache.juddi.v3.client.transport.Transport;
 import org.apache.juddi.v3.client.transport.TransportException;
 import org.uddi.api_v3.BindingTemplate;
 import org.uddi.api_v3.BusinessService;
 
+import com.ibm.wsdl.util.IOUtils;
+
 public class UDDIClerkManager {
 	
 	private static Log log = LogFactory.getLog(UDDIClerkManager.class);
@@ -307,5 +317,31 @@ public class UDDIClerkManager {
 		return getClientConfig().getUDDIClerks().get(clerkName);
 	}
 	
+	/**
+	 * Registers services to UDDI using a clerk, and the uddi.xml
+	 * configuration.
+	 * @throws WSDLException 
+	 * @throws TransportException 
+	 * @throws ConfigurationException 
+	 * @throws RemoteException 
+	 */
+	public void registerWSDLs() throws WSDLException, RemoteException, ConfigurationException, TransportException {
+		Map<String,UDDIClerk> uddiClerks = clientConfig.getUDDIClerks();
+		if (uddiClerks.size() > 0) {
+			for (UDDIClerk uddiClerk : uddiClerks.values()) {
+				uddiClerk.registerWsdls();
+			}
+		}
+	}
+	
+	public void unRegisterWSDLs() throws WSDLException, RemoteException, ConfigurationException, TransportException, MalformedURLException {
+		Map<String,UDDIClerk> uddiClerks = clientConfig.getUDDIClerks();
+		if (uddiClerks.size() > 0) {
+			for (UDDIClerk uddiClerk : uddiClerks.values()) {
+				uddiClerk.unRegisterWsdls();
+			}
+		}
+	}
+	
 }
 

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIKeyConvention.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIKeyConvention.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIKeyConvention.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/UDDIKeyConvention.java Wed May  8 15:31:22 2013
@@ -29,8 +29,8 @@ public class UDDIKeyConvention 
 	//Default Values
 	public static final String DEFAULT_BUSINESS_KEY_FORMAT      = "uddi:${keyDomain}:business_${businessName}";
 	public static final String DEFAULT_SERVICE_KEY_FORMAT       = "uddi:${keyDomain}:service_${serviceName}";
-	public static final String DEFAULT_SUBSCRIPTION_KEY_FORMAT  = "uddi:${keyDomain}:service_cache_${nodeName}";
-	public static final String DEFAULT_BINDING_KEY_FORMAT       = "uddi:${keyDomain}:binding_${nodeName}_${serviceName}_${portName}";
+	public static final String DEFAULT_SUBSCRIPTION_KEY_FORMAT  = "uddi:${keyDomain}:service_cache_${serverName}";
+	public static final String DEFAULT_BINDING_KEY_FORMAT       = "uddi:${keyDomain}:binding_${serverName}_${serviceName}_${portName}_${serverPort}";
 	
 	/**
 	 * Constructs the serviceKey based on the bindingKeyFormat specified in the properties. When no
@@ -106,7 +106,7 @@ public class UDDIKeyConvention 
 				port = 443;
 			}
 		}
-		tempProperties.put("port", String.valueOf(port));
+		tempProperties.put("serverPort", String.valueOf(port));
 		//Constructing the binding Key
 		String keyFormat = properties.getProperty(Property.BINDING_KEY_FORMAT, DEFAULT_BINDING_KEY_FORMAT);
 		String bindingKey = TokenResolver.replaceTokens(keyFormat, tempProperties).toLowerCase();

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/WebHelper.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/WebHelper.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/WebHelper.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/config/WebHelper.java Wed May  8 15:31:22 2013
@@ -17,6 +17,8 @@
 package org.apache.juddi.v3.client.config;
 
 import java.lang.reflect.InvocationTargetException;
+import java.net.MalformedURLException;
+import java.net.URL;
 
 import javax.servlet.ServletContext;
 
@@ -88,8 +90,20 @@ public class WebHelper {
 			} else {
 				throw new ConfigurationException("A manager name needs to be specified in the client config file.");
 			}
+			
+			String baseUrl = servletContext.getRealPath("/");
+			System.out.println("Realpath=" + baseUrl);
+			try {
+				URL url=new URL(baseUrl);
+				String host = url.getHost();
+				int port = url.getPort();
+				System.out.println("^^^^^^^^^^^^^^^^^^^^^^^^^^^" + host + ":" + port);
+			} catch (MalformedURLException e) {
+				// TODO Auto-generated catch block
+				e.printStackTrace();
+			}
+			
 			manager.start();
-			UDDIClientContainer.addClerkManager(manager);
 			servletContext.setAttribute(JUDDI_CLIENT_MANAGER_NAME, managerName);
 			return manager;
 		}

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/BPEL2UDDI.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/BPEL2UDDI.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/BPEL2UDDI.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/BPEL2UDDI.java Wed May  8 15:31:22 2013
@@ -91,7 +91,7 @@ public class BPEL2UDDI extends Annotatio
 
 	private WSDL2UDDI wsdl2UDDI;
 	
-	public BPEL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties) {
+	public BPEL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties) throws ConfigurationException {
 		super();
 		
 		this.clerk = clerk;

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/ReadWSDL.java Wed May  8 15:31:22 2013
@@ -53,6 +53,21 @@ public class ReadWSDL {
 		return wsdlDefinition;
 	}
 	
+	public Definition readWSDL(URL wsdlUrl) throws WSDLException {
+		
+		Definition wsdlDefinition = null;
+		WSDLFactory factory = WSDLFactoryImpl.newInstance();
+		WSDLReader reader = factory.newWSDLReader();
+		try {
+			URI uri = wsdlUrl.toURI();
+			WSDLLocator locator = new WSDLLocatorImpl(uri);
+			wsdlDefinition = reader.readWSDL(locator);
+		} catch (URISyntaxException e) {
+			log.error(e.getMessage(),e);
+		}
+		return wsdlDefinition;
+	}
+	
 	
 	
 	

Modified: juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/WSDL2UDDI.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/WSDL2UDDI.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/WSDL2UDDI.java (original)
+++ juddi/trunk/juddi-client/src/main/java/org/apache/juddi/v3/client/mapping/WSDL2UDDI.java Wed May  8 15:31:22 2013
@@ -104,14 +104,32 @@ public class WSDL2UDDI {
 	 * @param clerk - can be null if register/unregister methods are not used.
 	 * @param urlLocalizer - A reference to an custom
 	 * @param properties
+	 * @throws ConfigurationException 
 	 */
-	public WSDL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties) {
+	public WSDL2UDDI(UDDIClerk clerk, URLLocalizer urlLocalizer, Properties properties) throws ConfigurationException {
 		super();
 		
 		this.clerk = clerk;
 		this.urlLocalizer = urlLocalizer;
 		this.properties = properties;
 		
+		if (clerk!=null) {
+			if (!properties.containsKey("keyDomain")) {
+				throw new ConfigurationException("Property keyDomain is a required property when using WSDL2UDDI.");
+			}
+			if (!properties.containsKey("businessKey") && !properties.containsKey("businessName")) {
+				throw new ConfigurationException("Either property businessKey, or businessName, is a required property when using WSDL2UDDI.");
+			}
+			if (!properties.containsKey("nodeName")) {
+				if (properties.containsKey("serverName") && properties.containsKey("serverPort")) {
+					String nodeName = properties.getProperty("serverName") + "_" + properties.getProperty("serverPort");
+					properties.setProperty("nodeName", nodeName);
+				} else {
+					throw new ConfigurationException("Property nodeName is not defined and is a required property when using WSDL2UDDI.");
+				}
+			}
+		}
+		
 		//Obtaining values from the properties
 		this.keyDomainURI =  "uddi:" + properties.getProperty("keyDomain") + ":";
 		if (properties.contains(Property.BUSINESS_KEY)) {

Modified: juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/BPEL2UDDITest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/BPEL2UDDITest.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/BPEL2UDDITest.java (original)
+++ juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/BPEL2UDDITest.java Wed May  8 15:31:22 2013
@@ -27,6 +27,7 @@ import javax.wsdl.WSDLException;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.juddi.jaxb.PrintUDDI;
 import org.junit.Assert;
 import org.junit.BeforeClass;
@@ -48,7 +49,7 @@ public class BPEL2UDDITest {
 	ReadWSDL rw = new ReadWSDL();
 	
 	@BeforeClass
-	public static void before() throws JAXBException {
+	public static void before() throws JAXBException, ConfigurationException {
 		Properties properties = new Properties();
 		properties.put("keyDomain", "juddi.apache.org");
 		properties.put("nodeName", "localhost");

Modified: juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDL2UDDITest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDL2UDDITest.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDL2UDDITest.java (original)
+++ juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDL2UDDITest.java Wed May  8 15:31:22 2013
@@ -26,6 +26,7 @@ import javax.wsdl.WSDLException;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.juddi.jaxb.PrintUDDI;
 import org.junit.Assert;
 import org.junit.Test;
@@ -40,7 +41,7 @@ public class WSDL2UDDITest {
 	ReadWSDL rw = new ReadWSDL();
 	
 	@Test
-	public void testUDDIBindingModel() throws WSDLException, JAXBException {
+	public void testUDDIBindingModel() throws WSDLException, JAXBException, ConfigurationException {
 
 		// Reading the WSDL
 		Definition wsdlDefinition = rw.readWSDL("wsdl/HelloWorld.wsdl");
@@ -63,7 +64,7 @@ public class WSDL2UDDITest {
 	}
 	
 	@Test
-	public void testWSDLBindingModel() throws WSDLException, JAXBException {
+	public void testWSDLBindingModel() throws WSDLException, JAXBException, ConfigurationException {
 
 		// Reading the WSDL
 		Definition wsdlDefinition = rw.readWSDL("wsdl/HelloWorld.wsdl");

Modified: juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java (original)
+++ juddi/trunk/juddi-client/src/test/java/org/apache/juddi/v3/client/mapping/WSDLinaUDDIRegistryTest.java Wed May  8 15:31:22 2013
@@ -28,6 +28,7 @@ import javax.wsdl.WSDLException;
 import javax.xml.bind.JAXBException;
 import javax.xml.namespace.QName;
 
+import org.apache.commons.configuration.ConfigurationException;
 import org.apache.juddi.jaxb.EntityCreator;
 import org.apache.juddi.jaxb.PrintUDDI;
 import org.junit.Assert;
@@ -57,7 +58,8 @@ public class WSDLinaUDDIRegistryTest {
 			wsdlDefinition = rw.readWSDL("wsdl/sample.wsdl");
 			properties.put("keyDomain", "uddi.joepublisher.com");
 			properties.put("businessName", "samplebusiness");
-			properties.put("nodeName", "api.example.org_80");
+			properties.put("serverName", "api.example.org");
+			properties.put("serverPort", "80");
 			wsdlURL = wsdlDefinition.getDocumentBaseURI();
 		} catch (WSDLException e) {
 			e.printStackTrace();
@@ -66,7 +68,7 @@ public class WSDLinaUDDIRegistryTest {
 	}
 	
 	@Test
-	public void test_3_2_1_UDDI_portType_tModel() throws WSDLException, IOException, JAXBException {
+	public void test_3_2_1_UDDI_portType_tModel() throws WSDLException, IOException, JAXBException, ConfigurationException {
 		
 		WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 		Set<TModel> tModels = new HashSet<TModel>();
@@ -116,7 +118,7 @@ public class WSDLinaUDDIRegistryTest {
 	}
 	
 	@Test 
-	public void test_3_2_2_UDDI_binding_tModel() throws WSDLException, JAXBException, IOException {
+	public void test_3_2_2_UDDI_binding_tModel() throws WSDLException, JAXBException, IOException, ConfigurationException {
 		
 		WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 	    @SuppressWarnings("unchecked")
@@ -162,7 +164,7 @@ public class WSDLinaUDDIRegistryTest {
 	}
 	
 	@Test
-	public void test_3_2_3_UDDI_businessService_and_bindingTemplate() throws JAXBException, IOException {
+	public void test_3_2_3_UDDI_businessService_and_bindingTemplate() throws JAXBException, IOException, ConfigurationException {
 		WSDL2UDDI wsdl2UDDI = new WSDL2UDDI(null, new URLLocalizerDefaultImpl(), properties);
 		
 		BusinessServices businessServices = wsdl2UDDI.createBusinessServices(wsdlDefinition);

Modified: juddi/trunk/juddi-client/src/test/resources/wsdl/uddiv3-xml/3_2_3_business_service.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-client/src/test/resources/wsdl/uddiv3-xml/3_2_3_business_service.xml?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-client/src/test/resources/wsdl/uddiv3-xml/3_2_3_business_service.xml (original)
+++ juddi/trunk/juddi-client/src/test/resources/wsdl/uddiv3-xml/3_2_3_business_service.xml Wed May  8 15:31:22 2013
@@ -5,7 +5,7 @@
     <name>StockQuoteService</name>
     <bindingTemplates>
          <bindingTemplate
-                 bindingKey="uddi:uddi.joepublisher.com:binding_api.example.org_80_stockquoteservice_stockquoteport"
+                 bindingKey="uddi:uddi.joepublisher.com:binding_api.example.org_stockquoteservice_stockquoteport_80"
                  serviceKey="uddi:uddi.joepublisher.com:service_stockquoteservice">
              <accessPoint URLType="http">http://location/sample</accessPoint>
              <tModelInstanceDetails>

Modified: juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_051_BindingTemplateWSDLTest.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_051_BindingTemplateWSDLTest.java?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_051_BindingTemplateWSDLTest.java (original)
+++ juddi/trunk/juddi-core/src/test/java/org/apache/juddi/api/impl/API_051_BindingTemplateWSDLTest.java Wed May  8 15:31:22 2013
@@ -25,8 +25,6 @@ import org.apache.commons.configuration.
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 import org.apache.juddi.Registry;
-import org.apache.juddi.api_v3.Clerk;
-import org.apache.juddi.config.Property;
 import org.apache.juddi.jaxb.PrintUDDI;
 import org.apache.juddi.v3.client.config.UDDIClerk;
 import org.apache.juddi.v3.client.config.UDDIClerkManager;
@@ -35,17 +33,13 @@ import org.apache.juddi.v3.client.mappin
 import org.apache.juddi.v3.client.mapping.URLLocalizerDefaultImpl;
 import org.apache.juddi.v3.client.mapping.WSDL2UDDI;
 import org.apache.juddi.v3.client.transport.TransportException;
-import org.apache.juddi.v3.tck.TckBindingTemplate;
 import org.apache.juddi.v3.tck.TckBusiness;
-import org.apache.juddi.v3.tck.TckBusinessService;
-import org.apache.juddi.v3.tck.TckFindEntity;
 import org.apache.juddi.v3.tck.TckPublisher;
 import org.apache.juddi.v3.tck.TckSecurity;
 import org.apache.juddi.v3.tck.TckTModel;
 import org.junit.AfterClass;
 import org.junit.Assert;
 import org.junit.BeforeClass;
-import org.junit.Ignore;
 import org.junit.Test;
 import org.uddi.api_v3.FindTModel;
 import org.uddi.v3_service.UDDISecurityPortType;
@@ -86,8 +80,8 @@ public class API_051_BindingTemplateWSDL
 		Registry.stop();
 	}
 	
-	@Test
-	public void joepublisher() throws ConfigurationException, WSDLException, RemoteException, TransportException, MalformedURLException {
+	@Test 
+	public void testDirectCall() throws ConfigurationException, WSDLException, RemoteException, TransportException, MalformedURLException {
 		try {
 			tckTModel.saveJoePublisherTmodel(authInfoJoe);
 			tckBusiness.saveJoePublisherBusiness(authInfoJoe);
@@ -119,5 +113,30 @@ public class API_051_BindingTemplateWSDL
 		}
 	}
 	
+	@Test 
+	public void testClerkCall() throws ConfigurationException, WSDLException, RemoteException, TransportException, MalformedURLException {
+		try {
+			tckTModel.saveJoePublisherTmodel(authInfoJoe);
+			tckBusiness.saveJoePublisherBusiness(authInfoJoe);
+			
+			UDDIClerk clerk = new UDDIClerkManager("META-INF/uddi.xml").getClerk("joe");
+			clerk.registerWsdls();
+			
+			
+			String portTypeName = "StockQuotePortType";
+			String namespace    = "http://example.com/stockquote/";
+			FindTModel findTModelForPortType = WSDL2UDDI.createFindPortTypeTModelForPortType(portTypeName, namespace);
+			System.out.println(new PrintUDDI<FindTModel>().print(findTModelForPortType));
+			
+			clerk.unRegisterWsdls();
+		} catch (Exception e) {
+			e.printStackTrace();
+			Assert.fail();
+		} finally {
+			tckBusiness.deleteJoePublisherBusiness(authInfoJoe);
+			tckTModel.deleteJoePublisherTmodel(authInfoJoe);
+		}
+	}
+	
 	
 }

Modified: juddi/trunk/juddi-core/src/test/resources/META-INF/uddi.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-core/src/test/resources/META-INF/uddi.xml?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-core/src/test/resources/META-INF/uddi.xml (original)
+++ juddi/trunk/juddi-core/src/test/resources/META-INF/uddi.xml Wed May  8 15:31:22 2013
@@ -10,6 +10,7 @@
 				<description>InVM jUDDI node</description>
 				<properties>
 					<property name="serverName" value="localhost" />
+					<property name="serverPort" value="8080" />
 				</properties>
 				<!-- In VM Transport Settings -->
 				<proxyTransport>org.apache.juddi.v3.client.transport.InVMTransport</proxyTransport>
@@ -23,7 +24,10 @@
 			</node>
 		</nodes>
 		<clerks registerOnStartup="false">
-		   <clerk name="joe" node="default" publisher="joepublisher" password="joepublisher"/>
+		   <clerk name="joe" node="default" publisher="joepublisher" password="joepublisher">
+		      <wsdl businessKey="uddi:uddi.joepublisher.com:businessone">wsdl/sample.wsdl</wsdl>
+		   </clerk>
+		   
 	   </clerks>
 	</manager>
 </uddi>
\ No newline at end of file

Modified: juddi/trunk/juddi-examples/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/pom.xml?rev=1480323&r1=1480322&r2=1480323&view=diff
==============================================================================
--- juddi/trunk/juddi-examples/pom.xml (original)
+++ juddi/trunk/juddi-examples/pom.xml Wed May  8 15:31:22 2013
@@ -31,6 +31,7 @@
        <module>hello-world</module>
        <module>simple-browse</module>
        <module>simple-publish</module>
+       <module>wsdl2uddi</module>
        <module>uddi-annotations</module>
     </modules>
 </project>
\ No newline at end of file

Added: juddi/trunk/juddi-examples/wsdl2uddi/README.txt
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/README.txt?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/README.txt (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/README.txt Wed May  8 15:31:22 2013
@@ -0,0 +1,17 @@
+This example is a command line demonstration of how to interact with JUDDI.
+
+1. Start the jUDDI-server (juddi-tomcat or juddi-bundle)
+
+2. Check the settings of the META-INF/uddi.xml, to make sure the serverName and serverPort are set correctly.
+
+3. mvn -Pdemo test
+
+You should see the following output being written to the console:
+
+root AUTHTOKEN = authtoken:0494e382-1ad3-4c52-8806-ae70a0ed37ad
+myPub AUTHTOKEN = authtoken:bf973e5f-7361-4c57-92f7-7b499b886b6d
+myBusiness key:  uddi:juddi.apache.org:6f3e4e62-e483-48ff-a1b3-6855310505c6
+myService key:  uddi:juddi.apache.org:549a9580-cd7b-4969-9b77-527ab9f8f261
+
+However since the keys are being generated in this case your keys will differ.
+

Added: juddi/trunk/juddi-examples/wsdl2uddi/pom.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/pom.xml?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/pom.xml (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/pom.xml Wed May  8 15:31:22 2013
@@ -0,0 +1,115 @@
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+  <modelVersion>4.0.0</modelVersion>
+  <parent>
+     <groupId>org.apache.juddi.example</groupId>
+     <artifactId>juddi-examples</artifactId>
+     <version>3.1.5-SNAPSHOT</version>
+     <relativePath>../pom.xml</relativePath>
+  </parent>
+  <artifactId>wsdl2uddi</artifactId>
+  <name>jUDDI Example WSDL2UDDI</name>
+  <description>Demonstrates the steps taken to publish a webservice using the WSDL file</description>
+
+  <dependencies>
+    <dependency>
+      <groupId>org.apache.juddi</groupId>
+      <artifactId>uddi-ws</artifactId>
+      <version>3.1.5-SNAPSHOT</version>
+    </dependency>
+    <dependency>
+      <groupId>org.apache.juddi</groupId>
+      <artifactId>juddi-client</artifactId>
+      <version>3.1.5-SNAPSHOT</version>
+    </dependency>
+  </dependencies>
+  
+    <profiles>
+        <profile>
+            <id>default</id>
+            <activation>
+                <activeByDefault>true</activeByDefault>
+            </activation>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.apache.maven.plugins</groupId>
+                        <artifactId>maven-surefire-plugin</artifactId>
+                        <configuration>
+                            <skip>true</skip>
+                        </configuration>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>publish</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.1.1</version>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>org.apache.juddi.example.wsdl2uddi.Publish</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+        <profile>
+            <id>find</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.1.1</version>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>org.apache.juddi.example.wsdl2uddi.FindService</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+         <profile>
+            <id>delete</id>
+            <build>
+                <plugins>
+                    <plugin>
+                        <groupId>org.codehaus.mojo</groupId>
+                        <artifactId>exec-maven-plugin</artifactId>
+                        <version>1.1.1</version>
+                        <executions>
+                            <execution>
+                                <phase>test</phase>
+                                <goals>
+                                    <goal>java</goal>
+                                </goals>
+                                <configuration>
+                                    <mainClass>org.apache.juddi.example.wsdl2uddi.Delete</mainClass>
+                                </configuration>
+                            </execution>
+                        </executions>
+                    </plugin>
+                </plugins>
+            </build>
+        </profile>
+    </profiles>
+</project>
+

Added: juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Delete.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Delete.java?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Delete.java (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Delete.java Wed May  8 15:31:22 2013
@@ -0,0 +1,52 @@
+/*
+ * Copyright 2001-2010 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.example.wsdl2uddi;
+
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+
+public class Delete {
+	
+	static UDDIClerkManager clerkManager;
+	
+	public void deleteBusiness(UDDIClerk clerk) {
+		// Deleting the parent business entity that contains our service.
+		clerk.unRegisterBusiness("uddi:uddi.joepublisher.com:business-for-wsdl");
+	}	
+	
+	public void deleteWSDL(UDDIClerk clerk) {
+		// Register the wsdls for this clerk, referenced in the wsdl2uddi-uddi.xml
+		clerk.unRegisterWsdls();
+	}
+
+	public static void main (String args[]) {
+		
+		Delete sp = new Delete();
+		try {
+			clerkManager = new UDDIClerkManager("META-INF/wsdl2uddi-uddi.xml");
+			UDDIClerk clerk = clerkManager.getClerk("joe");
+			
+			sp.deleteWSDL(clerk);
+			sp.deleteBusiness(clerk);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	
+}

Added: juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/FindService.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/FindService.java?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/FindService.java (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/FindService.java Wed May  8 15:31:22 2013
@@ -0,0 +1,72 @@
+/*
+ * Copyright 2001-2010 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.example.wsdl2uddi;
+
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.config.UDDIClientContainer;
+import org.uddi.api_v3.BindingTemplate;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.BusinessService;
+
+public class FindService {
+	
+	public void find() {
+		try {
+			UDDIClerkManager clerkManager = new UDDIClerkManager("META-INF/wsdl2uddi-uddi.xml");
+			UDDIClerk clerk = clerkManager.getClerk("joe");
+        	// register the clerkManager with the client side container
+        	UDDIClientContainer.addClerkManager(clerkManager);
+        	
+        	BusinessEntity businessEntity = clerk.findBusiness("uddi:uddi.joepublisher.com:business-for-wsdl");
+        	//
+        	if (businessEntity!=null) {
+	        	System.out.println("Found business with name " + businessEntity.getName().get(0).getValue());
+	        	System.out.println("Number of services: " + businessEntity.getBusinessServices().getBusinessService().size());
+	        	
+	        	for (BusinessService businessService: businessEntity.getBusinessServices().getBusinessService()) {
+	        		System.out.println("Service Name        = '" + businessService.getName().get(0).getValue() + "'");
+	        		System.out.println("Service Key         = '" + businessService.getServiceKey() + "'");
+	        		System.out.println("Service Description = '" + businessService.getDescription().get(0).getValue() + "'");
+	        		System.out.println("BindingTemplates: " + businessService.getBindingTemplates().getBindingTemplate().size());
+	        		
+	        		for (int i=0; i<businessService.getBindingTemplates().getBindingTemplate().size(); i++) {
+	    				BindingTemplate bindingTemplate = businessService.getBindingTemplates().getBindingTemplate().get(i);
+	    				System.out.println("--BindingTemplate" + " " + i + ":");
+	    				System.out.println("  bindingKey          = " + bindingTemplate.getBindingKey());
+	    				System.out.println("  accessPoint useType = " + bindingTemplate.getAccessPoint().getUseType());
+	    				System.out.println("  accessPoint value   = " + bindingTemplate.getAccessPoint().getValue());
+	    				System.out.println("  description         = " + bindingTemplate.getDescription().get(0).getValue());
+	        		}
+	        	}
+        	}
+	        		
+        	businessEntity.getBusinessServices();
+			//FindTModel findBindingTModel = WSDL2UDDI.createFindBindingTModelForPortType(portType, namespace);
+			//clerk.fin
+			
+		} 
+		catch (Exception e) {
+			e.printStackTrace();
+		}
+	}		
+
+	public static void main (String args[]) {
+		FindService sp = new FindService();
+		sp.find();	
+	}
+}

Added: juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Publish.java
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Publish.java?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Publish.java (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/src/main/java/org/apache/juddi/example/wsdl2uddi/Publish.java Wed May  8 15:31:22 2013
@@ -0,0 +1,139 @@
+/*
+ * Copyright 2001-2010 The Apache Software Foundation.
+ * 
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ * 
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ * 
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+package org.apache.juddi.example.wsdl2uddi;
+
+import java.rmi.RemoteException;
+
+import org.apache.commons.configuration.ConfigurationException;
+import org.apache.juddi.api_v3.Publisher;
+import org.apache.juddi.api_v3.SavePublisher;
+import org.apache.juddi.v3.client.config.UDDIClerk;
+import org.apache.juddi.v3.client.config.UDDIClerkManager;
+import org.apache.juddi.v3.client.transport.TransportException;
+import org.apache.juddi.v3_service.JUDDIApiPortType;
+import org.uddi.api_v3.AuthToken;
+import org.uddi.api_v3.BusinessEntity;
+import org.uddi.api_v3.CategoryBag;
+import org.uddi.api_v3.Description;
+import org.uddi.api_v3.GetAuthToken;
+import org.uddi.api_v3.KeyedReference;
+import org.uddi.api_v3.Name;
+import org.uddi.api_v3.OverviewDoc;
+import org.uddi.api_v3.OverviewURL;
+import org.uddi.api_v3.SaveTModel;
+import org.uddi.api_v3.TModel;
+import org.uddi.v3_service.DispositionReportFaultMessage;
+import org.uddi.v3_service.UDDIPublicationPortType;
+import org.uddi.v3_service.UDDISecurityPortType;
+
+public class Publish {
+	
+	static UDDIClerkManager clerkManager;
+	
+	public void publishBusiness(UDDIClerk clerk) {
+		// Creating the parent business entity that will contain our service.
+		BusinessEntity myBusEntity = new BusinessEntity();
+		Name myBusName = new Name();
+		myBusName.setValue("WSDL-Business");
+		myBusEntity.getName().add(myBusName);
+		myBusEntity.setBusinessKey("uddi:uddi.joepublisher.com:business-for-wsdl");
+		clerk.register(myBusEntity);
+	}	
+	
+	public void publishWSDL(UDDIClerk clerk) {
+		// Register the wsdls for this clerk, referenced in the wsdl2uddi-uddi.xml
+		clerk.registerWsdls();
+	}
+
+	public static void main (String args[]) {
+		
+		Publish sp = new Publish();
+		try {
+			clerkManager = new UDDIClerkManager("META-INF/wsdl2uddi-uddi.xml");
+			UDDIClerk clerk = clerkManager.getClerk("joe");
+			
+			//setting up the publisher
+			sp.setupJoePublisher();
+			//publish the business and the wsdl
+			sp.publishBusiness(clerk);
+			sp.publishWSDL(clerk);
+			
+		} catch (Exception e) {
+			e.printStackTrace();
+		}
+	}
+	
+	// This setup needs to be done once, either using the console or using code like this
+	private void setupJoePublisher() throws DispositionReportFaultMessage, RemoteException, ConfigurationException, TransportException {
+		
+		UDDISecurityPortType security = clerkManager.getTransport("default").getUDDISecurityService();
+		
+		//login as root so we can create joe publisher
+		GetAuthToken getAuthTokenRoot = new GetAuthToken();
+		getAuthTokenRoot.setUserID("root");
+		getAuthTokenRoot.setCred("");
+		// Making API call that retrieves the authentication token for the 'root' user.
+		AuthToken rootAuthToken = security.getAuthToken(getAuthTokenRoot);
+		System.out.println ("root AUTHTOKEN = " + rootAuthToken.getAuthInfo());
+		
+		//Creating joe publisher
+		JUDDIApiPortType juddiApi = clerkManager.getTransport("default").getJUDDIApiService();
+		Publisher p = new Publisher();
+		p.setAuthorizedName("joepublisher");
+		p.setPublisherName("Joe Publisher");
+		// Adding the publisher to the "save" structure, using the 'root' user authentication info and saving away. 
+		SavePublisher sp = new SavePublisher();
+		sp.getPublisher().add(p);
+		sp.setAuthInfo(rootAuthToken.getAuthInfo());
+		juddiApi.savePublisher(sp);
+		
+		getAuthTokenRoot = new GetAuthToken();
+		getAuthTokenRoot.setUserID("joepublisher");
+		getAuthTokenRoot.setCred("joepublisher");
+		// Making API call that retrieves the authentication token for the 'root' user.
+		AuthToken authToken = security.getAuthToken(getAuthTokenRoot);
+		
+		//Add a keygenerater for this publisher
+		UDDIPublicationPortType publish = clerkManager.getTransport("default").getUDDIPublishService();	
+		TModel keyGenerator = new TModel();
+		keyGenerator.setTModelKey("uddi:uddi.joepublisher.com:keygenerator");
+		Name name = new Name();
+		name.setValue("Joe Publisher's Key Generator");
+		keyGenerator.setName(name);
+		Description description = new Description();
+		description.setValue("This is the key generator for Joe Publisher's UDDI entities!");
+		keyGenerator.getDescription().add(description);
+		OverviewDoc overviewDoc = new OverviewDoc();
+		OverviewURL overviewUrl = new OverviewURL();
+		overviewUrl.setUseType("text");
+		overviewUrl.setValue("http://uddi.org/pubs/uddi_v3.htm#keyGen");
+		overviewDoc.setOverviewURL(overviewUrl);
+		keyGenerator.getOverviewDoc().add(overviewDoc);
+		CategoryBag categoryBag = new CategoryBag();
+		KeyedReference keyedReference = new KeyedReference();
+		keyedReference.setKeyName("uddi-org:types:keyGenerator");
+		keyedReference.setKeyValue("keyGenerator");
+		keyedReference.setTModelKey("uddi:uddi.org:categorization:types");
+		categoryBag.getKeyedReference().add(keyedReference);
+		keyGenerator.setCategoryBag(categoryBag);
+		
+		SaveTModel saveTModel = new SaveTModel();
+		saveTModel.setAuthInfo(authToken.getAuthInfo());
+		saveTModel.getTModel().add(keyGenerator);
+		publish.saveTModel(saveTModel);
+	}
+}

Added: juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/META-INF/wsdl2uddi-uddi.xml
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/META-INF/wsdl2uddi-uddi.xml?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/META-INF/wsdl2uddi-uddi.xml (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/META-INF/wsdl2uddi-uddi.xml Wed May  8 15:31:22 2013
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+
+<uddi>
+    <reloadDelay>5000</reloadDelay>
+    <manager name="example-manager">
+		<nodes>
+			<node>
+			    <!-- required 'default' node -->
+				<name>default</name> 
+                <properties>
+                    <property name="serverName" value="localhost"/>
+                    <property name="serverPort" value="8080"/>
+                </properties>
+				<description>Main jUDDI node</description>
+				<!-- JAX-WS Transport -->
+				<proxyTransport>org.apache.juddi.v3.client.transport.JAXWSTransport</proxyTransport>
+				<custodyTransferUrl>http://${serverName}:${serverPort}/juddiv3/services/custody-transfer</custodyTransferUrl>
+				<inquiryUrl>http://${serverName}:${serverPort}/juddiv3/services/inquiry</inquiryUrl>
+		        <publishUrl>http://${serverName}:${serverPort}/juddiv3/services/publish</publishUrl>
+		        <securityUrl>http://${serverName}:${serverPort}/juddiv3/services/security</securityUrl>
+				<subscriptionUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription</subscriptionUrl>
+				<subscriptionListenerUrl>http://${serverName}:${serverPort}/juddiv3/services/subscription-listener</subscriptionListenerUrl>
+				<juddiApiUrl>http://${serverName}:${serverPort}/juddiv3/services/juddi-api</juddiApiUrl>
+			</node>
+		</nodes>
+		<clerks registerOnStartup="false">
+           <clerk name="joe" node="default" publisher="joepublisher" password="joepublisher">
+              <wsdl businessKey="uddi:uddi.joepublisher.com:business-for-wsdl">wsdl/helloworld.wsdl</wsdl>
+           </clerk>
+        </clerks>
+	</manager>
+</uddi>

Added: juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/wsdl/helloworld.wsdl
URL: http://svn.apache.org/viewvc/juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/wsdl/helloworld.wsdl?rev=1480323&view=auto
==============================================================================
--- juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/wsdl/helloworld.wsdl (added)
+++ juddi/trunk/juddi-examples/wsdl2uddi/src/main/resources/wsdl/helloworld.wsdl Wed May  8 15:31:22 2013
@@ -0,0 +1,53 @@
+<?xml version='1.0' encoding='UTF-8'?><wsdl:definitions name="HelloWorld" targetNamespace="http://samples.juddi.apache.org/" xmlns:ns1="http://schemas.xmlsoap.org/soap/http" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://samples.juddi.apache.org/" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:xsd="http://www.w3.org/2001/XMLSchema">
+<wsdl:types>
+<xs:schema elementFormDefault="unqualified" targetNamespace="http://samples.juddi.apache.org/" version="1.0" xmlns:tns="http://samples.juddi.apache.org/" xmlns:xs="http://www.w3.org/2001/XMLSchema">
+<xs:element name="sayHi" type="tns:sayHi"/>
+<xs:element name="sayHiResponse" type="tns:sayHiResponse"/>
+<xs:complexType name="sayHi">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="text" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+<xs:complexType name="sayHiResponse">
+    <xs:sequence>
+      <xs:element minOccurs="0" name="return" type="xs:string"/>
+    </xs:sequence>
+  </xs:complexType>
+</xs:schema>
+  </wsdl:types>
+  <wsdl:message name="sayHiResponse">
+    <wsdl:part element="tns:sayHiResponse" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:message name="sayHi">
+    <wsdl:part element="tns:sayHi" name="parameters">
+    </wsdl:part>
+  </wsdl:message>
+  <wsdl:portType name="HelloWorld">
+    <wsdl:operation name="sayHi">
+      <wsdl:input message="tns:sayHi" name="sayHi">
+    </wsdl:input>
+      <wsdl:output message="tns:sayHiResponse" name="sayHiResponse">
+    </wsdl:output>
+    </wsdl:operation>
+  </wsdl:portType>
+  <wsdl:binding name="HelloWorldSoapBinding" type="tns:HelloWorld">
+    <wsdl:documentation>The Hello World Binding registered using WSDL2UDDI</wsdl:documentation>
+    <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
+    <wsdl:operation name="sayHi">
+      <soap:operation soapAction="" style="document"/>
+      <wsdl:input name="sayHi">
+        <soap:body use="literal"/>
+      </wsdl:input>
+      <wsdl:output name="sayHiResponse">
+        <soap:body use="literal"/>
+      </wsdl:output>
+    </wsdl:operation>
+  </wsdl:binding>
+  <wsdl:service name="HelloWorld">
+    <wsdl:documentation>The Hello World Service registered using WSDL2UDDI</wsdl:documentation>
+    <wsdl:port binding="tns:HelloWorldSoapBinding" name="HelloWorldImplPort">
+      <soap:address location="http://localhost:8080/uddi-annotations/services/helloworld"/>
+    </wsdl:port>
+  </wsdl:service>
+</wsdl:definitions>
\ No newline at end of file



---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@juddi.apache.org
For additional commands, e-mail: commits-help@juddi.apache.org