[ 
http://issues.apache.org/jira/browse/AXIS-2405?page=comments#action_12367880 ] 

qin bethune commented on AXIS-2405:
-----------------------------------

This fix works for pasted WSDL file.

Index: src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
===================================================================
--- src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java       (revision 
381218)
+++ src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java       (working copy)
@@ -316,9 +316,10 @@
                         // extending another simpleContent type and will
                         // already have a "value".
 
-                        if (extendsOrRestrictsType == null ||
-                            extendsOrRestrictsType.isBaseType())
-                        {
+                        if (extendsOrRestrictsType == null
+                                || extendsOrRestrictsType.isBaseType()
+                                || isRealSimple(extendsOrRestrictsType,
+                                        symbolTable)) {
                         // Return an element declaration with a fixed name
                         // ("value") and the correct type.
                         Vector v = new Vector();
@@ -429,7 +430,23 @@
         return null;
     }
 
+    // fix for Axis-2405
     /**
+     * a real simple type is a simple type restricted from a built-in style
+     * directly or indirectly without adding any attributes in the hierarchy.
+     * 
+     * @param type
+     * @param symbolTable
+     * @return
+     */
+    private static boolean isRealSimple(TypeEntry type, SymbolTable 
symbolTable) {
+        while (type != null && type.getContainedAttributes() == null) {
+            type = SchemaUtils.getBaseType(type, symbolTable);
+        }
+        return type == null;
+    }    
+       
+    /**
      * Invoked by getContainedElementDeclarations to get the child element 
types
      * and child element names underneath a Choice Node
      *


> WSDL2Java can't generate correct java class for complex type derived by 
> extending a simple type which is further derived by restricting from build-in 
> type.
> -----------------------------------------------------------------------------------------------------------------------------------------------------------
>
>          Key: AXIS-2405
>          URL: http://issues.apache.org/jira/browse/AXIS-2405
>      Project: Apache Axis
>         Type: Bug
>   Components: WSDL processing
>  Environment: Windows XP
>     Reporter: qin bethune

>
> Run  WSDL2Java against the attached WSDL, the  generated java class can't be 
> compiled.
> test\HuntSequenceWorkingTelephoneNumber.java:18: Object() in java.lang.Object 
> ca
> nnot be applied to (java.lang.String)
>         super(_value);
>         ^
> 1 error

-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira

Reply via email to