You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by sc...@apache.org on 2006/09/19 15:41:53 UTC

svn commit: r447843 - in /webservices/axis2/trunk/java/modules/jaxws: src/org/apache/axis2/jaxws/ src/org/apache/axis2/jaxws/description/ src/org/apache/axis2/jaxws/spi/ test/org/apache/axis2/jaxws/description/

Author: scheu
Date: Tue Sep 19 06:41:52 2006
New Revision: 447843

URL: http://svn.apache.org/viewvc?view=rev&rev=447843
Log:
AXIS2-1183
Contributor: Jeff Barrett

Removed:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ClientMediator.java
Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionKey.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionRegistry.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/ServiceDescriptionTests.java
    webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLTests.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/ClientConfigurationFactory.java Tue Sep 19 06:41:52 2006
@@ -19,6 +19,8 @@
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.context.ConfigurationContext;
 import org.apache.axis2.context.ConfigurationContextFactory;
+import org.apache.axis2.deployment.DeploymentException;
+import org.apache.axis2.description.AxisService;
 import org.apache.axis2.jaxws.util.Constants;
 
 
@@ -42,7 +44,7 @@
     }
 
     /**
-     * Loads up a ConfigurationContext object using the WAS-specific configuration builder.
+     * Loads up a ConfigurationContext object using the configuration builder.
      * @return a ConfigurationContext object that is suitable for the client environment
      */
     public synchronized ConfigurationContext getClientConfigurationContext() {
@@ -54,10 +56,21 @@
                 configContext = ConfigurationContextFactory
                         .createConfigurationContextFromFileSystem(repoPath, axisConfigPath);
             } catch (AxisFault e) {
+                // TODO: Add RAS logging and processing
                 e.printStackTrace();
             }
         }
         
         return configContext;
+    }
+    
+    /**
+     * Perform any final client-specific configuration on a newly created AxisService.
+     * 
+     * @param service A newly created AxisService on which to perform any final client-related configuration.
+     * @throws DeploymentException
+     * @throws Exception
+     */
+    public synchronized void completeAxis2Configuration(AxisService service) throws DeploymentException, Exception {
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionKey.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionKey.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionKey.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionKey.java Tue Sep 19 06:41:52 2006
@@ -44,22 +44,26 @@
 		}
 		
 		DescriptionKey description = (DescriptionKey)o;
-		if(description.wsdlUrl == null){
-			return false;
-		}
+
+        // TODO: Currently, only the Service QName is used to base key equality
+//		if(description.wsdlUrl == null){
+//			return false;
+//		}
 		
 		if(serviceName == null){
 			throw ExceptionFactory.makeWebServiceException(org.apache.axis2.i18n.Messages.getMessage("DescriptionRegistryErr0"));
 		}
-		
-		return description.serviceName.equals(this.serviceName) && description.wsdlUrl.equals(this.wsdlUrl); 
+        // TODO: Currently, only the Service QName is used to base key equality
+//        return description.serviceName.equals(this.serviceName) && description.wsdlUrl.equals(this.wsdlUrl); 
+		return description.serviceName.equals(this.serviceName); 
 	}
 	@Override
 	public int hashCode() {
 		
 		int hash = 1;
 		hash = 31*hash + ((serviceName==null)? 0:serviceName.hashCode());
-		hash = hash +((wsdlUrl == null) ? 0 : wsdlUrl.hashCode());
+        // TODO: Currently, only the Service QName is used to base key equality
+//		hash = hash +((wsdlUrl == null) ? 0 : wsdlUrl.hashCode());
 		return hash;
 		
 	}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionRegistry.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionRegistry.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionRegistry.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/DescriptionRegistry.java Tue Sep 19 06:41:52 2006
@@ -35,7 +35,7 @@
 		
 	}
 	
-	public ServiceDescription getServiceDescription(DescriptionKey key){
+	synchronized public ServiceDescription getServiceDescription(DescriptionKey key){
 		ServiceDescription sd = cache.get(key);
 		if(sd == null){
 			sd = DescriptionFactory.createServiceDescription(key.getWsdlUrl(), key.getServiceName(), key.getServiceClass());

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/ServiceDescription.java Tue Sep 19 06:41:52 2006
@@ -97,6 +97,7 @@
  */
 public class ServiceDescription {
     private AxisService axisService;
+    private ConfigurationContext configContext;
 
     private URL wsdlURL;
     private QName serviceQName;
@@ -153,6 +154,8 @@
         setupAxisService();
         buildDescriptionHierachy();
         addAnonymousAxisOperations();
+        // This will set the serviceClient field after adding the AxisService to the AxisConfig
+        getServiceClient();
     }
 
     /**
@@ -187,7 +190,7 @@
         EndpointDescription endpointDescription = new EndpointDescription(serviceImplClass, null, this);
         addEndpointDescription(endpointDescription);
         
-        // TODO: (JLB) The ServiceQName instance variable should be set based on annotation or default
+        // TODO: The ServiceQName instance variable should be set based on annotation or default
 
         // The anonymous AxisOperations are currently NOT added here.  The reason 
         // is that (for now) this is a SERVER-SIDE code path, and the anonymous operations
@@ -290,7 +293,9 @@
         // Patterned after AxisService.createClientSideAxisService
         serviceBuilder.setServerSide(false);
         try {
+            // TODO: This probably needs to use the target namespace like buildAxisServiceFromNoWSDL does
             axisService = serviceBuilder.populateService();
+            axisService.setName(serviceQName.toString());
         } catch (AxisFault e) {
             // TODO We should not swallow a fault here.
             log.warn(Messages.getMessage("warnAxisFault", e.toString()));
@@ -299,22 +304,17 @@
     
     private void buildAxisServiceFromNoWSDL() {
         // TODO: Refactor this to create from annotations.
-//        if (true) return;
-//        
-//        // Patterned after ServiceClient.createAnonymousService()
-//        String serviceName = null;
-//        if (serviceQName != null) {
+        String serviceName = null;
+        if (serviceQName != null) {
+            // TODO: This uses TNS in the AxisService name, but using WSDL does not
+            serviceName = serviceQName.toString();
 //            serviceName = serviceQName.getLocalPart();
-//        }
-//        else {
-//            serviceName = ServiceClient.ANON_SERVICE;
-//        }
-//        // Make this service name unique.  The Axis2 engine assumes that a service it can not find is a client-side service.
-//        // See org.apache.axis2.client.ServiceClient.configureServiceClient()
-//        axisService = new AxisService(serviceName + this.hashCode());
-//        axisService.addOperation(new RobustOutOnlyAxisOperation(ServiceClient.ANON_ROBUST_OUT_ONLY_OP));
-//        axisService.addOperation(new OutOnlyAxisOperation(ServiceClient.ANON_OUT_ONLY_OP));
-//        axisService.addOperation(new OutInAxisOperation(ServiceClient.ANON_OUT_IN_OP));
+        }
+        else {
+            // Make this service name unique.  The Axis2 engine assumes that a service it can not find is a client-side service.
+            serviceName = ServiceClient.ANON_SERVICE + this.hashCode();
+        }
+        axisService = new AxisService(serviceName);
     }
     
     private void buildDescriptionHierachy() {
@@ -387,10 +387,12 @@
     	return serviceClient;
     }
     
-    private ConfigurationContext getAxisConfigContext() {
-    	ClientConfigurationFactory factory = ClientConfigurationFactory.newInstance(); 
-    	ConfigurationContext configCtx = factory.getClientConfigurationContext();
-    	return configCtx;
+    public ConfigurationContext getAxisConfigContext() {
+        if (configContext == null) {
+            ClientConfigurationFactory factory = ClientConfigurationFactory.newInstance(); 
+            configContext = factory.getClientConfigurationContext();
+        }
+    	return configContext;
     	
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/spi/ServiceDelegate.java Tue Sep 19 06:41:52 2006
@@ -36,12 +36,7 @@
 import javax.xml.ws.http.HTTPBinding;
 import javax.xml.ws.soap.SOAPBinding;
 
-import org.apache.axis2.AxisFault;
 import org.apache.axis2.client.ServiceClient;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.description.AxisService;
-import org.apache.axis2.jaxws.ClientConfigurationFactory;
-import org.apache.axis2.jaxws.ClientMediator;
 import org.apache.axis2.jaxws.ExceptionFactory;
 import org.apache.axis2.jaxws.JAXWSClientContext;
 import org.apache.axis2.jaxws.client.JAXBDispatch;
@@ -71,7 +66,6 @@
 
     private ServiceDescription serviceDescription;
     private QName serviceQname;
-    private ClientMediator mediator = null;
     private ServiceClient serviceClient = null;
     // If no binding ID is available, use this one
     private static String DEFAULT_BINDING_ID = SOAPBinding.SOAP11HTTP_BINDING;
@@ -80,7 +74,6 @@
     	super();
     	this.serviceQname = qname;
     	ports = new Hashtable<QName, PortData>();
-    	mediator = new ClientMediator();
 
         if(!isValidServiceName()){
     		throw ExceptionFactory.makeWebServiceException(Messages.getMessage("serviceDelegateConstruct0", ""));
@@ -417,15 +410,7 @@
 	        }
         }
     }
-    
-    //TODO We should hang AxisConfiguration from ServiceDescription or something parent to ServiceDescription
-    private ConfigurationContext getAxisConfigContext() {
-    	ClientConfigurationFactory factory = ClientConfigurationFactory.newInstance(); 
-    	ConfigurationContext configCtx = factory.getClientConfigurationContext();
-    	return configCtx;
-    	
-    }
-    
+
     private ServiceDescription getServiceDescription(URL url, QName serviceName, Class clazz ){
     	DescriptionKey key = new DescriptionKey(serviceName, url, clazz);
     	return DescriptionRegistry.getRegistry().getServiceDescription(key);

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/ServiceDescriptionTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/ServiceDescriptionTests.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/ServiceDescriptionTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/ServiceDescriptionTests.java Tue Sep 19 06:41:52 2006
@@ -32,13 +32,14 @@
  * and other Description classes is done in WSDLDescriptionTests.
  */
 public class ServiceDescriptionTests extends TestCase {
-    private static final String namespaceURI= "http://ws.apache.org/axis2/tests";
+    private static final String namespaceURI= "http://org.apache.axis2.jaxws.description.ServiceDescriptionTests";
     private static final String localPart = "EchoService";
     private static final QName serviceQName = new QName(namespaceURI, localPart);
     
     public void testNullWSDL() {
 
-        ServiceDescription serviceDescription = new ServiceDescription(null, serviceQName, javax.xml.ws.Service.class);
+        QName uniqueQName = new QName(namespaceURI, localPart + "_testNullWSDL");
+        ServiceDescription serviceDescription = new ServiceDescription(null, uniqueQName, javax.xml.ws.Service.class);
         assertNotNull("Service description not created with null WSDL", serviceDescription);
     }
     
@@ -81,7 +82,8 @@
     }
     
     public void testValidServiceSubclass() {
-        ServiceDescription serviceDescription = new ServiceDescription(null, serviceQName, ServiceSubclass.class);
+        QName uniqueQName = new QName(namespaceURI, localPart + "_testValidServiceSubclass");
+        ServiceDescription serviceDescription = new ServiceDescription(null, uniqueQName, ServiceSubclass.class);
         assertNotNull("Service description not created with valid Service subclass", serviceDescription);
     }
 }

Modified: webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLTests.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLTests.java?view=diff&rev=447843&r1=447842&r2=447843
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLTests.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/test/org/apache/axis2/jaxws/description/WSDLTests.java Tue Sep 19 06:41:52 2006
@@ -79,7 +79,7 @@
         Service service = null;
 
         String namespaceURI= "http://ws.apache.org/axis2/tests";
-        String localPart = "EchoService";
+        String localPart = "EchoService_nullWSDL";
         service = Service.create(new QName(namespaceURI, localPart));
         assertNotNull("Service not created", service);
         



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org