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 pr...@apache.org on 2008/04/04 16:40:50 UTC

svn commit: r644726 - in /webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description: AxisService.java WSDL11ToAxisServiceBuilder.java

Author: pradine
Date: Fri Apr  4 07:40:47 2008
New Revision: 644726

URL: http://svn.apache.org/viewvc?rev=644726&view=rev
Log:
Ensure that operations from imported namespaces are located as well.

Modified:
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java?rev=644726&r1=644725&r2=644726&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/AxisService.java Fri Apr  4 07:40:47 2008
@@ -57,6 +57,7 @@
 import org.apache.axis2.transport.TransportListener;
 import org.apache.axis2.transport.http.server.HttpUtils;
 import org.apache.axis2.util.Loader;
+import org.apache.axis2.util.LoggingControl;
 import org.apache.axis2.util.XMLPrettyPrinter;
 import org.apache.axis2.util.XMLUtils;
 import org.apache.axis2.wsdl.WSDLConstants;
@@ -261,6 +262,8 @@
 	private String soapNsUri;
 	private String endpointName;
 	private String endpointURL;
+    
+    private List importedNamespaces;
 
 	private boolean clientSide = false;
 
@@ -376,7 +379,6 @@
 		objectSupplier = new DefaultObjectSupplier();
 		dataLocators = new HashMap();
 		dataLocatorClassNames = new HashMap();
-
 	}
 
 	/**
@@ -1594,15 +1596,51 @@
 	 * @return Returns AxisOperation.
 	 */
 	public AxisOperation getOperation(QName operationName) {
+        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
+            log.debug("Get operation for " + operationName);
+                
 		AxisOperation axisOperation = (AxisOperation) getChild(operationName);
-		if (axisOperation == null) {
+		
+        if (axisOperation == null) {
 			axisOperation = (AxisOperation) getChild(new QName(
 					getTargetNamespace(), operationName.getLocalPart()));
+            
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
+                log.debug("Target namespace: " + getTargetNamespace());
 		}
+        
 		if (axisOperation == null) {
 			axisOperation = (AxisOperation) operationsAliasesMap
 					.get(operationName.getLocalPart());
+            
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
+                log.debug("Operations aliases map: " + operationsAliasesMap);
 		}
+        
+        //The operation may be associated with a namespace other than the
+        //target namespace, e.g. if the operation is from an imported wsdl.
+        if (axisOperation == null) {            
+            List namespaces = getImportedNamespaces();
+            
+            if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
+                log.debug("Imported namespaces: " + namespaces);
+
+            if (namespaces != null) {
+                Iterator iterator = namespaces.iterator();
+                
+                while (iterator.hasNext()) {
+                    String namespace = (String) iterator.next();
+                    axisOperation = (AxisOperation) getChild(new QName(
+                            namespace, operationName.getLocalPart()));
+                    
+                    if (axisOperation != null)
+                        break;
+                }
+            }
+        }
+
+        if (LoggingControl.debugLoggingAllowed && log.isDebugEnabled())
+            log.debug("Found axis operation:  " + axisOperation);
 
 		return axisOperation;
 	}
@@ -2314,7 +2352,25 @@
 	public Map getNamespaceMap() {
 		return namespaceMap;
 	}
+    
+    /**
+     * Get the namespaces associated with imported WSDLs
+     * 
+     * @return a <code>List</code> of namespace URIs (String)
+     */
+    public List getImportedNamespaces() {
+        return importedNamespaces;
+    }
 
+    /**
+     * Set the namespaces associated with imported WSDLs
+     * 
+     * @param importedNamespaces
+     */
+    public void setImportedNamespaces(List importedNamespaces) {
+        this.importedNamespaces = importedNamespaces;
+    }
+    
     /**
      * @deprecated please use setNamespaceMap
      * @param nameSpacesMap

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?rev=644726&r1=644725&r2=644726&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Fri Apr  4 07:40:47 2008
@@ -317,7 +317,14 @@
             // setting target name space
             axisService.setTargetNamespace(wsdl4jDefinition.getTargetNamespace());
             axisService.setNamespaceMap(new NamespaceMap(wsdl4jDefinition.getNamespaces()));
-
+            
+            Map importsMap = wsdl4jDefinition.getImports();
+            
+            if (importsMap != null) {
+                List imports = new ArrayList(importsMap.keySet());
+                axisService.setImportedNamespaces(imports);
+            }
+            
             //TODO : find the service also in imported wsdls
             Service wsdl4jService = findService(wsdl4jDefinition);
 



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