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 di...@apache.org on 2004/06/05 13:05:50 UTC

cvs commit: ws-axis/java/src/org/apache/axis/wsdl/toJava JavaGeneratorFactory.java

dims        2004/06/05 04:05:50

  Modified:    java/src/org/apache/axis/wsdl/symbolTable SchemaUtils.java
                        SymbolTable.java
               java/src/org/apache/axis/wsdl/toJava
                        JavaGeneratorFactory.java
  Log:
  Fix for AXIS-1382 - Failure to generate code for ws-trust.wsdl
  
  Revision  Changes    Path
  1.42      +15 -0     ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java
  
  Index: SchemaUtils.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SchemaUtils.java,v
  retrieving revision 1.41
  retrieving revision 1.42
  diff -u -r1.41 -r1.42
  --- SchemaUtils.java	21 Apr 2004 18:24:38 -0000	1.41
  +++ SchemaUtils.java	5 Jun 2004 11:05:49 -0000	1.42
  @@ -69,6 +69,21 @@
           return false;
       }
   
  +    public static boolean isSimpleTypeWithUnion(Node node) {
  +        // Expecting a schema complexType
  +        if (isXSDNode(node, "simpleType")) {
  +            // Under the simpleType there could be union
  +            NodeList children = node.getChildNodes();
  +            for (int j = 0; j < children.getLength(); j++) {
  +                Node kid = children.item(j);
  +                if (isXSDNode(kid, "union")) {
  +                    return true;
  +                }
  +            }
  +        }
  +        return false;
  +    }
  +    
     /**
      * This method checks out if the given node satisfies the 3rd condition
      * of the "wrapper" style:
  
  
  
  1.99      +0 -1      ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java
  
  Index: SymbolTable.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/symbolTable/SymbolTable.java,v
  retrieving revision 1.98
  retrieving revision 1.99
  diff -u -r1.98 -r1.99
  --- SymbolTable.java	12 Apr 2004 18:17:31 -0000	1.98
  +++ SymbolTable.java	5 Jun 2004 11:05:49 -0000	1.99
  @@ -1232,7 +1232,6 @@
                               if (SchemaUtils.isSimpleTypeOrSimpleContent(node)) {
                                   te.setSimpleType(true);
                               }
  -
                               symbolTablePut(te);
                           }
                       }
  
  
  
  1.51      +22 -20    ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java
  
  Index: JavaGeneratorFactory.java
  ===================================================================
  RCS file: /home/cvs/ws-axis/java/src/org/apache/axis/wsdl/toJava/JavaGeneratorFactory.java,v
  retrieving revision 1.50
  retrieving revision 1.51
  diff -u -r1.50 -r1.51
  --- JavaGeneratorFactory.java	9 Apr 2004 18:37:04 -0000	1.50
  +++ JavaGeneratorFactory.java	5 Jun 2004 11:05:49 -0000	1.51
  @@ -524,26 +524,28 @@
   
               if (Utils.getEnumerationBaseAndValues(te.getNode(), symbolTable) == null
                       &&SchemaUtils.getContainedAttributeTypes(te.getNode(), symbolTable) == null) {
  -                if (base.isSimpleType()) {
  -                    // Case 1:
  -                    // <simpleType name="mySimpleStringType">
  -                    //   <restriction base="xs:string">
  -                    //   </restriction>
  -                    // </simpleType>
  -                    te.setSimpleType(true);
  -                    te.setName(base.getName());
  -                    te.setRefType(base);
  -                }
  -
  -                if (base.isBaseType()) {
  -                    // Case 2:
  -                    // <simpleType name="FooString">
  -                    //   <restriction base="foo:mySimpleStringType">
  -                    //   </restriction>
  -                    // </simpleType>
  -                    te.setBaseType(true);
  -                    te.setName(base.getName());
  -                    te.setRefType(base);
  +                if(!SchemaUtils.isSimpleTypeWithUnion(te.getNode())) {
  +                    if (base.isSimpleType()) {
  +                        // Case 1:
  +                        // <simpleType name="mySimpleStringType">
  +                        //   <restriction base="xs:string">
  +                        //   </restriction>
  +                        // </simpleType>
  +                        te.setSimpleType(true);
  +                        te.setName(base.getName());
  +                        te.setRefType(base);
  +                    }
  +    
  +                    if (base.isBaseType()) {
  +                        // Case 2:
  +                        // <simpleType name="FooString">
  +                        //   <restriction base="foo:mySimpleStringType">
  +                        //   </restriction>
  +                        // </simpleType>
  +                        te.setBaseType(true);
  +                        te.setName(base.getName());
  +                        te.setRefType(base);
  +                    }
                   }
               }