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 ng...@apache.org on 2006/12/04 23:49:25 UTC

svn commit: r482397 - in /webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws: BindingProvider.java client/BaseDispatch.java client/proxy/JAXWSProxyHandler.java description/impl/EndpointDescriptionImpl.java

Author: ngallardo
Date: Mon Dec  4 14:49:23 2006
New Revision: 482397

URL: http://svn.apache.org/viewvc?view=rev&rev=482397
Log:
AXIS2-1822

Part 1: cleaning up some bad behavior re: initializing the request context and setting of the SOAPAction

Modified:
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
    webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java?view=diff&rev=482397&r1=482396&r2=482397
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/BindingProvider.java Mon Dec  4 14:49:23 2006
@@ -21,7 +21,6 @@
 import java.util.Hashtable;
 import java.util.Map;
 
-import javax.xml.soap.SOAPFactory;
 import javax.xml.ws.Binding;
 
 import org.apache.axis2.jaxws.binding.SOAPBinding;
@@ -34,30 +33,40 @@
 
 	protected Map<String, Object> requestContext;
     protected Map<String, Object> responseContext;
-    private Binding binding;  // force subclasses to use the lazy getter
     protected EndpointDescription endpointDesc;
     protected ServiceDelegate serviceDelegate;
     
-    private BindingProvider() {
+    private Binding binding;  // force subclasses to use the lazy getter
+    
+    public BindingProvider(ServiceDelegate svcDelegate, EndpointDescription epDesc) {
+        endpointDesc = epDesc;
+        serviceDelegate = svcDelegate;
+
+        initialize();
+    }
+
+    /*
+     * Initialize any objects needed by the BindingProvider
+     */
+    private void initialize() {
         requestContext = new Hashtable<String,Object>();
         responseContext = new Hashtable<String,Object>();
         
-        //Setting standard property defaults for request context
+        // Setting standard property defaults for the request context
         requestContext.put(BindingProvider.SESSION_MAINTAIN_PROPERTY, new Boolean(false));
         requestContext.put(BindingProvider.SOAPACTION_USE_PROPERTY, new Boolean(false));
-        requestContext.put(BindingProvider.SOAPACTION_URI_PROPERTY, "");
-        
-    }
-    
-    public BindingProvider(ServiceDelegate svcDelegate, EndpointDescription epDesc) {
-        this();
-        endpointDesc = epDesc;
-        serviceDelegate = svcDelegate;
+       
+        // Set the endpoint address
+        String endpointAddress = endpointDesc.getEndpointAddress();
+        if (endpointAddress != null) {
+            requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endpointAddress);            
+        }
     }
     
     public ServiceDelegate getServiceDelegate() {
         return serviceDelegate;
     }
+    
     public EndpointDescription getEndpointDescription() {
         return endpointDesc;
     }
@@ -83,20 +92,6 @@
 
     public Map<String, Object> getResponseContext() {
         return responseContext;
-    }
-    
-    protected void initRequestContext(String endPointAddress, String soapAddress, String soapAction){
-    	if (endPointAddress != null && !"".equals(endPointAddress)) {
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-					endPointAddress);
-		} else if (soapAddress != null && !"".equals(soapAddress)) {
-			requestContext.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
-					soapAddress);
-		}
-		if (soapAction != null && !"".equals(soapAction)) {
-			getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY,
-					soapAction);
-		}
     }
     
     /*

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java?view=diff&rev=482397&r1=482396&r2=482397
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/BaseDispatch.java Mon Dec  4 14:49:23 2006
@@ -1,18 +1,20 @@
 /*
- * Copyright 2006 The Apache Software Foundation.
- * Copyright 2006 International Business Machines Corp.
- *
- * 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
- *
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you 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.
+ *      
+ * 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.axis2.jaxws.client;
 
@@ -57,7 +59,6 @@
         super(svcDelgate, epDesc);
         
         ic = new AxisInvocationController();
-        setRequestContext();
     }
     
     /**
@@ -303,28 +304,6 @@
         return asyncResponse;
     }
     
-    //FIXME: This needs to be moved up to the BindingProvider and should actually
-    //be called "initRequestContext()" or something like that.
-    protected void setRequestContext(){
-        String endPointAddress = endpointDesc.getEndpointAddress();
-        //WSDLWrapper wsdl =  axisController.getWSDLContext();
-        //QName serviceName = axisController.getServiceName();
-        //QName portName = axisController.getPortName();
-        
-        
-        if(endPointAddress != null && !"".equals(endPointAddress)){
-            getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, endPointAddress);
-        }
-        //else if(wsdl != null){
-        //    String soapAddress = wsdl.getSOAPAddress(serviceName, portName);
-        //    getRequestContext().put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, soapAddress);
-        //}
-        
-        //if(wsdl != null){
-        //    String soapAction = wsdl.getSOAPAction(serviceName, portName);
-        //    getRequestContext().put(BindingProvider.SOAPACTION_URI_PROPERTY, soapAction);
-        //}
-    }
     public void setServiceClient(ServiceClient sc) {
         serviceClient = sc;
     }
@@ -361,9 +340,10 @@
     }
     
     /*
-     * Validate the invocation param for the Dispatch.  There are 
-     * some cases when nulls are allowed and others where it's 
-     * a violation.
+     * Checks to see if the parameter for the invocation is valid
+     * given the scenario that the client is operating in.  There are 
+     * some cases when nulls are allowed and others where it is 
+     * an error.
      */
     private boolean isValidInvocationParam(Object object){
         String bindingId = endpointDesc.getClientBindingID();

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java?view=diff&rev=482397&r1=482396&r2=482397
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/client/proxy/JAXWSProxyHandler.java Mon Dec  4 14:49:23 2006
@@ -25,7 +25,6 @@
 
 import javax.jws.soap.SOAPBinding;
 import javax.jws.soap.SOAPBinding.ParameterStyle;
-import javax.xml.namespace.QName;
 import javax.xml.ws.AsyncHandler;
 import javax.xml.ws.Binding;
 import javax.xml.ws.Response;
@@ -39,10 +38,8 @@
 import org.apache.axis2.jaxws.core.controller.AxisInvocationController;
 import org.apache.axis2.jaxws.core.controller.InvocationController;
 import org.apache.axis2.jaxws.description.EndpointDescription;
-import org.apache.axis2.jaxws.description.EndpointDescriptionWSDL;
 import org.apache.axis2.jaxws.description.OperationDescription;
 import org.apache.axis2.jaxws.description.ServiceDescription;
-import org.apache.axis2.jaxws.description.ServiceDescriptionWSDL;
 import org.apache.axis2.jaxws.i18n.Messages;
 import org.apache.axis2.jaxws.marshaller.MethodMarshaller;
 import org.apache.axis2.jaxws.marshaller.factory.MethodMarshallerFactory;
@@ -51,7 +48,6 @@
 import org.apache.axis2.jaxws.message.Protocol;
 import org.apache.axis2.jaxws.registry.FactoryRegistry;
 import org.apache.axis2.jaxws.spi.ServiceDelegate;
-import org.apache.axis2.jaxws.util.WSDLWrapper;
 import org.apache.commons.logging.Log;
 import org.apache.commons.logging.LogFactory;
 
@@ -101,9 +97,9 @@
 	
 	public JAXWSProxyHandler(ServiceDelegate delegate, Class seiClazz, EndpointDescription epDesc) {
 		super(delegate, epDesc);
+        
 		this.seiClazz = seiClazz;
-		this.serviceDesc=delegate.getServiceDescription();
-		initRequestContext();
+		this.serviceDesc = delegate.getServiceDescription();
 	}
 	
 	/* (non-Javadoc)
@@ -114,14 +110,15 @@
 	 */
 	public Object invoke(Object proxy, Method method, Object[] args)
 			throws Throwable {
-		if (log.isDebugEnabled()) {
-            log.debug("Attemping to invoke Method: " +method.getName());
+		boolean debug = log.isDebugEnabled();
+        if (debug) {
+            log.debug("Attemping to invoke Method: " + method.getName());
         }
         
 		this.method = method;
 		
 		if(!isValidMethodCall(method)){
-			throw ExceptionFactory.makeWebServiceException(Messages.getMessage("proxyErr1",method.getName(), seiClazz.getName()));
+			throw ExceptionFactory.makeWebServiceException(Messages.getMessage("proxyErr1", method.getName(), seiClazz.getName()));
 		}
 		
 		if(!isPublic(method)){
@@ -129,17 +126,20 @@
 		}
 		
 		if(isBindingProviderInvoked(method)){
-			if (log.isDebugEnabled()) {
-	            log.debug("Invoking method on Binding Provider");
+			if (debug) {
+	            log.debug("Invoking a public method on the javax.xml.ws.BindingProvider interface.");
 	        }
-			try{
+            try { 
 				return method.invoke(this, args);
-			}catch(Throwable e){
-				throw ExceptionFactory.makeMessageException(e);
-			}
-			
+			} 
+            catch(Throwable e) {
+                if (debug) {
+				    log.debug("An error occured while invoking the method: " + e.getMessage());
+                }
+                throw ExceptionFactory.makeMessageException(e);
+			}			
 		}
-		else{
+		else {
 			operationDesc = endpointDesc.getEndpointInterfaceDescription().getOperation(method);
 			if(isMethodExcluded()){
 				throw ExceptionFactory.makeWebServiceException("Invalid Method Call, Method "+method.getName() + " has been excluded using @webMethod annotation");
@@ -336,21 +336,6 @@
 		return false;
 	}
 	
-	protected void initRequestContext() {
-		String soapAddress = null;
-		String soapAction = null;
-		String endPointAddress = endpointDesc.getEndpointAddress();
-		WSDLWrapper wsdl = ((ServiceDescriptionWSDL) serviceDelegate.getServiceDescription()).getWSDLWrapper();
-		QName serviceName = serviceDelegate.getServiceName();
-		QName portName = endpointDesc.getPortQName();
-        soapAddress = ((EndpointDescriptionWSDL) endpointDesc).getWSDLSOAPAddress();
-		if (wsdl != null) {
-            // FIXME: This is getting the Action from the FIRST operation; that seems wrong!
-			soapAction = wsdl.getSOAPAction(serviceName, portName);
-		}
-		super.initRequestContext(endPointAddress, soapAddress, soapAction);
-	}
-
 	private boolean isPublic(Method method){
 		return Modifier.isPublic(method.getModifiers());
 	}

Modified: webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java?view=diff&rev=482397&r1=482396&r2=482397
==============================================================================
--- webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java (original)
+++ webservices/axis2/trunk/java/modules/jaxws/src/org/apache/axis2/jaxws/description/impl/EndpointDescriptionImpl.java Mon Dec  4 14:49:23 2006
@@ -1218,7 +1218,6 @@
     public String getClientBindingID() {
         if (clientBindingID == null) {
             if (getWSDLDefinition() != null) {
-                System.out.println(">> Getting bindingID from WSDL");
                 clientBindingID = getWSDLBindingType();
             }
             else {



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