Author: nadiramra
Date: Mon Jun 11 21:46:48 2012
New Revision: 1349033

URL: http://svn.apache.org/viewvc?rev=1349033&view=rev
Log:
Minor, need to obtain reference type for arrays...

Modified:
    axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java

Modified: 
axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java
URL: 
http://svn.apache.org/viewvc/axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java?rev=1349033&r1=1349032&r2=1349033&view=diff
==============================================================================
--- axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java 
(original)
+++ axis/axis1/c/trunk/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/WSDLInfo.java 
Mon Jun 11 21:46:48 2012
@@ -625,22 +625,19 @@ public class WSDLInfo
         
         if (-1 != type.getQName().getLocalPart().indexOf('['))
         { 
-            /* it seems that this is an array */
-            if (null == type.getRefType())
-                throw new WrapperFault("Array type found without a Ref type");
+            // An array...
             
-            // Handle array that references an element
-            QName qn = type.getRefType().getQName();
-            // TODO
-//            if (type.getRefType().getRefType() != null)
-//                qn = type.getRefType().getRefType().getQName();
-           
-            if (null == qn)
-                throw new WrapperFault("Array type found without a Ref type");
+            // Get referenced type
+            TypeEntry typeEntryOfRefType = getActualRefType(type);
+            if (null == typeEntryOfRefType || typeEntryOfRefType.getQName() == 
null)
+                throw new WrapperFault("Array type found without a Ref type: " 
+ type.getQName());
             
+            // If referenced type is primitive, we are done...
+            QName qn = typeEntryOfRefType.getQName();
             if (CUtils.isPrimitiveType(qn))
                 return null;
             
+            // Create array 
             QName newqn;
             if (useCounter)
             {
@@ -651,7 +648,7 @@ public class WSDLInfo
             else
                 newqn = new QName(type.getQName().getNamespaceURI(), 
qn.getLocalPart() + "_Array");
             
-            // type is a inbuilt type or a already created type?
+            // type is a inbuilt type or an already created type?
             typedata = c_typeMap.getType(newqn);
             if (typedata != null)
             {
@@ -898,6 +895,29 @@ public class WSDLInfo
     }    
     
     /**
+     * Returns the actual referenced type (i.e. a defined type or base type)
+     *  
+     * @param type
+     * @return
+     */
+    private TypeEntry getActualRefType(TypeEntry type)
+    {
+        if (type == null)
+            return null;
+        
+        TypeEntry rt = type.getRefType();
+        
+        if (rt != null)
+        {
+            if (rt instanceof org.apache.axis.wsdl.symbolTable.DefinedType 
+                    || rt instanceof org.apache.axis.wsdl.symbolTable.BaseType)
+                return rt;
+        }
+        
+        return getActualRefType(rt);
+    }
+
+    /**
      * If the specified node represents a supported JAX-RPC restriction,
      * a Vector is returned which contains the base type and the values 
(enumerations etc).
      * The first element in the vector is the base type (an TypeEntry).


Reply via email to