You are viewing a plain text version of this content. The canonical link for it is here.
Posted to yoko-commits@incubator.apache.org by br...@apache.org on 2007/05/07 12:57:31 UTC

svn commit: r535873 - in /incubator/yoko/trunk: bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/ bindings/src/main/java/org/apache/yoko/bindings/corba/types/ bindings/src/test/java/org/apache/yoko/bindings/corba/ tools/src/main/java/org/a...

Author: bravi
Date: Mon May  7 05:57:30 2007
New Revision: 535873

URL: http://svn.apache.org/viewvc?view=rev&rev=535873
Log:
[YOKO-331] - Fixed the idltowsdl union mapping & also the related bindings refactoring to get the union working.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTest.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonarray.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonboundedsequence.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonsequence.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring_unbounded.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Declarators.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceStructUnion.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceTypedef.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardUnion.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_ObjectRef.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Typedef.wsdl
    incubator/yoko/trunk/tools/src/test/resources/idl/expected_Union.wsdl

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/runtime/CorbaStaxObject.java Mon May  7 05:57:30 2007
@@ -1176,14 +1176,6 @@
             if (evt.isStartElement()) {
                 branchName = evt.asStartElement().getName().getLocalPart();
             }
-            CorbaObjectHandler discObj = null;
-            // Check to see if we have the discriminator definition in Stax
-            if (branchName != null && branchName.equals("discriminator")) {
-                discObj = readObjectFromStax(reader, unionType.getDiscriminator(), null, true);
-                obj.setDiscriminator(discObj);
-                evt = reader.peek();
-                branchName = evt.asStartElement().getName().getLocalPart();
-            }
             List<Unionbranch> branches = unionType.getUnionbranch();
             XmlSchemaObjectCollection items = choiceType.getItems();                
             for (int i = 0; i < branches.size(); i++) {
@@ -1193,29 +1185,28 @@
                     branchObj = readObjectFromStax(reader, branch.getIdltype(), items.getItem(i), true);
                     // We also need to set the discriminator since this is the branch with the actual
                     // union value
-                    if (discObj == null) {
-                        discObj = CorbaHandlerUtils.createTypeHandler(orb,
-                                                                      new QName("discriminator"),
-                                                                      unionType.getDiscriminator(),
-                                                                      typeMaps,
-                                                                      serviceInfo);
-                        obj.setDiscriminator(discObj);
+                    CorbaObjectHandler discObj =
+                        CorbaHandlerUtils.createTypeHandler(orb,
+                                                            new QName("discriminator"),
+                                                            unionType.getDiscriminator(),
+                                                            typeMaps,
+                                                            serviceInfo);
+                    obj.setDiscriminator(discObj);
                     
-                        // Determine the value of the discriminator.  
-                        List<CaseType> branchCases = branch.getCase();
-                        String discValue = null;
-                        if (branchCases.size() != 0) {
-                            // This represents a union case.  Set the discriminator based on the first
-                            // label value associated with the branch (since we don't have this information)
-                            // from the Stax representation of the Celtix object).
-                            CaseType caseLabel = branchCases.get(0);
-                            discValue = caseLabel.getLabel();
-                        } else {
-                            // This represents the default case.
-                            discValue = obj.createDefaultDiscriminatorLabel();
-                        }
-                        obj.setDiscriminatorValueFromData(discValue);
+                    // Determine the value of the discriminator.  
+                    List<CaseType> branchCases = branch.getCase();
+                    String discValue = null;
+                    if (branchCases.size() != 0) {
+                        // This represents a union case.  Set the discriminator based on the first
+                        // label value associated with the branch (since we don't have this information)
+                        // from the Stax representation of the Celtix object).
+                        CaseType caseLabel = branchCases.get(0);
+                        discValue = caseLabel.getLabel();
+                    } else {
+                        // This represents the default case.
+                        discValue = obj.createDefaultDiscriminatorLabel();
                     }
+                    obj.setDiscriminatorValueFromData(discValue);
                     obj.setValue(branchName, branchObj);
                 } else {
                     XmlSchemaElement el = (XmlSchemaElement) items.getItem(i);
@@ -1274,22 +1265,6 @@
         } else {
             StartElement startEl = factory.createStartElement(objName, null, null);
             writer.add(startEl);
-            CorbaObjectHandler discValue = unionHandler.getDiscriminator();
-            if (discValue != null) {
-                Object value = null;
-                // the discriminator is either an enum or primitive type
-                if (discValue instanceof CorbaEnumHandler) {
-                    value = ((CorbaEnumHandler)discValue).getValue();
-                } else {
-                    value = ((CorbaPrimitiveHandler)discValue).getValue();
-                }
-
-                // we can have the situation where the discriminator object has
-                // been created but has no real value (a default case)
-                if (value != null) {
-                    writeObjectToStax(discValue, stype, writer, factory, true);
-                }
-            }
             CorbaObjectHandler unionValue = unionHandler.getValue();
             if (unionValue != null) {
                 writeObjectToStax(unionValue, stype, writer, factory, true);

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaUnionHandler.java Mon May  7 05:57:30 2007
@@ -19,10 +19,8 @@
 package org.apache.yoko.bindings.corba.types;
 
 import java.util.ArrayList;
-//import java.util.HashMap;
 import java.util.Iterator;
 import java.util.List;
-//import java.util.Map;
 
 import javax.xml.namespace.QName;
 
@@ -42,7 +40,6 @@
     private List<CorbaObjectHandler> cases = new ArrayList<CorbaObjectHandler>();
     private int defaultIndex;
     private List<String> labels = new ArrayList<String>();
-    //private Map<String, CorbaObject
     
 
     public CorbaUnionHandler(QName unionName, QName unionIdlType, TypeCode unionTC, Object unionType) {
@@ -129,13 +126,11 @@
     }
     
     public int getDefaultIndex() {
-        // TODO: What will this be used for?
         return defaultIndex;
     }
     
     public String createDefaultDiscriminatorLabel() {
         String label = null;
-
         // According to the CORBA specification, an enumeration discriminator can be one of the 
         // following types:
         //   - *integer* (short, long, ulong, either signed or unsigned)
@@ -184,16 +179,27 @@
                     }
                 }
             }
-        } else {
-            // this is some sort of integer (short, long, ulong)
+        } else if ((discriminator.getTypeCodeKind().value() == TCKind._tk_short)
+                   || (discriminator.getTypeCodeKind().value() == TCKind._tk_ushort)) {
             if (labels.isEmpty()) {
-                label = String.valueOf(0);   
-            } else {
-                long longValue = Long.parseLong(labels.get(0));
-                while (labels.contains(String.valueOf(longValue))) {
-                    longValue++;
+                label = String.valueOf(Short.MAX_VALUE);
+            }
+            for (int i = Short.MAX_VALUE; i >= Short.MIN_VALUE; i--) {
+                if (!labels.contains(String.valueOf(i))) {
+                    label = String.valueOf(i);
+                    break;
+                }   
+            }
+        } else if ((discriminator.getTypeCodeKind().value() == TCKind._tk_long)
+                   || (discriminator.getTypeCodeKind().value() == TCKind._tk_ulong)) {
+            if (labels.isEmpty()) {
+                label = String.valueOf(Integer.MAX_VALUE);
+            }
+            for (int i = Integer.MAX_VALUE; i >= Integer.MIN_VALUE; i--) {
+                if (!labels.contains(String.valueOf(i))) {
+                    label = String.valueOf(i);
+                    break;
                 }   
-                label = String.valueOf(longValue);
             }
         }
         return label;

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/AbstractIdlToWsdlTypeTestClient.java Mon May  7 05:57:30 2007
@@ -50,8 +50,8 @@
     // base_type
     public void testAlias() throws Exception {
         int valueSets[][] = {
-	    {10, 100},
-	    {1000, 2000}
+            {10, 100},
+            {1000, 2000}
         };
 
         for (int i = 0; i < valueSets.length; i++) {
@@ -544,13 +544,10 @@
 
     public void testUnion() {
         IdltowsdlTypeTestUnion1 u0 = new IdltowsdlTypeTestUnion1();
-        u0.setDiscriminator(IdltowsdlTypeTestEnum1.E_1_1);
         u0.setU11(Integer.MAX_VALUE);
         IdltowsdlTypeTestUnion1 u1 = new IdltowsdlTypeTestUnion1();
-        u1.setDiscriminator(IdltowsdlTypeTestEnum1.E_1_2);
         u1.setU12(new String("foo"));
         IdltowsdlTypeTestUnion1 u2 = new IdltowsdlTypeTestUnion1();
-        u2.setDiscriminator(IdltowsdlTypeTestEnum1.E_1_3);
         u2.setU12(new String("bar"));
         IdltowsdlTypeTestUnion1 u3 = new IdltowsdlTypeTestUnion1();
         u3.setU13(Short.MAX_VALUE);
@@ -578,23 +575,12 @@
 
     private boolean compareUnion(IdltowsdlTypeTestUnion1 left, IdltowsdlTypeTestUnion1 right) {
         boolean result = true;
-        // Need to handle the case were we are using the default union case and the discrimintator 
-        // is not set (i.e. null).
-        if (left.getDiscriminator() == null) {
-            return (left.getU13().equals(right.getU13()));
-        }
-        if (left.getDiscriminator().equals(right.getDiscriminator())) {
-            IdltowsdlTypeTestEnum1 discriminator = left.getDiscriminator();
-            if (discriminator.equals(IdltowsdlTypeTestEnum1.E_1_1)) {
-                result = left.getU11().equals(right.getU11());
-            } else if (discriminator.equals(IdltowsdlTypeTestEnum1.E_1_2)
-                || discriminator.equals(IdltowsdlTypeTestEnum1.E_1_3) ) {
-                result = left.getU12().equals(right.getU12());
-            } else {
-                result = left.getU13().equals(right.getU13());
-            }
+        if (left.getU11() != null) {
+            result = left.getU11().equals(right.getU11());
+        } else if (left.getU12() != null) {
+            result = left.getU12().equals(right.getU12());
         } else {
-            result = false;
+            result = left.getU13().equals(right.getU13());
         }
         return result;
     }

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTest.java?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/IdlToWsdlTypeTest.java Mon May  7 05:57:30 2007
@@ -116,5 +116,4 @@
     public void testOctet () { }
     public void testAny () { }
     public void testWstring() { }
-    //public void testUnion() { }    
 }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/IDLToWSDLProcessor.java Mon May  7 05:57:30 2007
@@ -113,7 +113,7 @@
 
     public void parseIDL() throws Exception {
         String location = env.get(ToolCorbaConstants.CFG_IDLFILE).toString();
-        File file = new File(location);
+        File file = new File(location).getAbsoluteFile();
         if (!file.exists()) {
             throw new Exception("IDL file " + file.getName() + " doesn't exist");
         }

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/idl/UnionVisitor.java Mon May  7 05:57:30 2007
@@ -33,7 +33,6 @@
 import org.apache.ws.commons.schema.XmlSchemaChoice;
 import org.apache.ws.commons.schema.XmlSchemaComplexType;
 import org.apache.ws.commons.schema.XmlSchemaElement;
-import org.apache.ws.commons.schema.XmlSchemaSequence;
 import org.apache.ws.commons.schema.XmlSchemaType;
 
 import org.apache.yoko.tools.common.ReferenceConstants;
@@ -41,8 +40,6 @@
 
 public class UnionVisitor extends VisitorBase {
 
-    private final String discriminator = "discriminator";
-    
     public UnionVisitor(Scope scope,
                         WSDLASTVisitor wsdlVisitor) {
         super(scope, wsdlVisitor);
@@ -86,9 +83,7 @@
         AST caseNode = discriminatorNode.getNextSibling();
         // xmlschema:union
         XmlSchemaComplexType unionSchemaComplexType = new XmlSchemaComplexType(schema);
-        XmlSchemaSequence sequence = new XmlSchemaSequence();
         unionSchemaComplexType.setName(unionScope.toString());
-        unionSchemaComplexType.setParticle(sequence);
         
         // REVISIT
         // TEMPORARILY 
@@ -100,23 +95,10 @@
         CorbaTypeImpl ctype = visitor.getCorbaType();
         Scope fullyQualifiedName = visitor.getFullyQualifiedName();
         
-        XmlSchemaElement discriminatorElement = new XmlSchemaElement();
-        discriminatorElement.setName(discriminator);
-        if (stype != null) {
-            discriminatorElement.setSchemaTypeName(stype.getQName());
-        } else {
-            UnionDeferredAction unionDiscriminatorAction = 
-                new UnionDeferredAction(discriminatorElement, fullyQualifiedName);
-            wsdlVisitor.getDeferredActions().add(unionDiscriminatorAction); 
-        }
-        discriminatorElement.setMinOccurs(1);
-        discriminatorElement.setMaxOccurs(1);
-        sequence.getItems().add(discriminatorElement);
-        
         XmlSchemaChoice choice = new XmlSchemaChoice();
         choice.setMinOccurs(1);
         choice.setMaxOccurs(1);
-        sequence.getItems().add(choice);
+        unionSchemaComplexType.setParticle(choice);
         
         
         // corba:union

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonarray.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonarray.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonarray.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonarray.wsdl Mon May  7 05:57:30 2007
@@ -216,18 +216,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="anonUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="unionLongArray" type="anonUnion._1_anonUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="unionLongArray" type="anonUnion._1_anonUnion">
-            </xs:element>
-            <xs:element name="unionLongArrayArray" type="anonUnion._3_anonUnion">
-            </xs:element>
-            <xs:element name="unionLongArrayArrayArray" type="anonUnion._6_anonUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="unionLongArrayArray" type="anonUnion._3_anonUnion">
+          </xs:element>
+          <xs:element name="unionLongArrayArrayArray" type="anonUnion._6_anonUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="anonTypedefUnion._1_anonTypedefUnion">
         <xs:sequence>
@@ -266,18 +262,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="anonTypedefUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="unionLongArray" type="anonTypedefUnion._1_anonTypedefUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="unionLongArray" type="anonTypedefUnion._1_anonTypedefUnion">
-            </xs:element>
-            <xs:element name="unionLongArrayArray" type="anonTypedefUnion._3_anonTypedefUnion">
-            </xs:element>
-            <xs:element name="unionLongArrayArrayArray" type="anonTypedefUnion._6_anonTypedefUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="unionLongArrayArray" type="anonTypedefUnion._3_anonTypedefUnion">
+          </xs:element>
+          <xs:element name="unionLongArrayArrayArray" type="anonTypedefUnion._6_anonTypedefUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="anonException._1_exceptionLongArray">
         <xs:sequence>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonboundedsequence.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonboundedsequence.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonboundedsequence.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonboundedsequence.wsdl Mon May  7 05:57:30 2007
@@ -284,18 +284,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="anonUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="unionSeqLong" type="_1_anonUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="unionSeqLong" type="_1_anonUnion">
-            </xs:element>
-            <xs:element name="unionSeqLong" type="_2_anonUnion">
-            </xs:element>
-            <xs:element name="unionSeqLong" type="_3_anonUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="unionSeqLong" type="_2_anonUnion">
+          </xs:element>
+          <xs:element name="unionSeqLong" type="_3_anonUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="_1_anonTypedefUnion">
         <xs:sequence>
@@ -334,18 +330,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="anonTypedefUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="typedefUnionSeqLong" type="_1_anonTypedefUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="typedefUnionSeqLong" type="_1_anonTypedefUnion">
-            </xs:element>
-            <xs:element name="typedefUnionSeqLong" type="_2_anonTypedefUnion">
-            </xs:element>
-            <xs:element name="typedefUnionSeqLong" type="_3_anonTypedefUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="typedefUnionSeqLong" type="_2_anonTypedefUnion">
+          </xs:element>
+          <xs:element name="typedefUnionSeqLong" type="_3_anonTypedefUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="_1_anonException">
         <xs:sequence>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonsequence.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonsequence.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonsequence.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonsequence.wsdl Mon May  7 05:57:30 2007
@@ -284,18 +284,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="anonUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="unionSeqLong" type="_1_anonUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="unionSeqLong" type="_1_anonUnion">
-            </xs:element>
-            <xs:element name="unionSeqSeqLong" type="_2_anonUnion">
-            </xs:element>
-            <xs:element name="unionSeqSeqSeqLong" type="_3_anonUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="unionSeqSeqLong" type="_2_anonUnion">
+          </xs:element>
+          <xs:element name="unionSeqSeqSeqLong" type="_3_anonUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="_1_anonTypedefUnion">
         <xs:sequence>
@@ -334,18 +330,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="anonTypedefUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="typedefUnionSeqLong" type="_1_anonTypedefUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="typedefUnionSeqLong" type="_1_anonTypedefUnion">
-            </xs:element>
-            <xs:element name="typedefUnionSeqSeqLong" type="_2_anonTypedefUnion">
-            </xs:element>
-            <xs:element name="typedefUnionSeqSeqSeqLong" type="_3_anonTypedefUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="typedefUnionSeqSeqLong" type="_2_anonTypedefUnion">
+          </xs:element>
+          <xs:element name="typedefUnionSeqSeqSeqLong" type="_3_anonTypedefUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="_1_anonException">
         <xs:sequence>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring.wsdl Mon May  7 05:57:30 2007
@@ -269,16 +269,12 @@
         </xs:restriction>
       </xs:simpleType>
       <xs:complexType name="AnonStrings.anonStringUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="anonStringUnion1" type="AnonStrings._1_anonStringUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="anonStringUnion1" type="AnonStrings._1_anonStringUnion">
-            </xs:element>
-            <xs:element name="anonStringUnionDefault" type="AnonStrings._2_anonStringUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="anonStringUnionDefault" type="AnonStrings._2_anonStringUnion">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:simpleType name="AnonStrings._1_typedefAnonStringUnion">
         <xs:restriction base="xs:string">
@@ -293,16 +289,12 @@
         </xs:restriction>
       </xs:simpleType>
       <xs:complexType name="AnonStrings.typedefAnonStringUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="anonStringUnion1" type="AnonStrings._1_typedefAnonStringUnion">
+          </xs:element>
+          <xs:element name="anonStringUnionDefault" type="AnonStrings._2_typedefAnonStringUnion">
           </xs:element>
-          <xs:choice>
-            <xs:element name="anonStringUnion1" type="AnonStrings._1_typedefAnonStringUnion">
-            </xs:element>
-            <xs:element name="anonStringUnionDefault" type="AnonStrings._2_typedefAnonStringUnion">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+        </xs:choice>
       </xs:complexType>
       <xs:simpleType name="AnonStrings._1_anonException">
         <xs:restriction base="xs:string">

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring_unbounded.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring_unbounded.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring_unbounded.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Anonstring_unbounded.wsdl Mon May  7 05:57:30 2007
@@ -160,28 +160,20 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="AnonStrings.anonStringUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="anonStringUnion1" type="xs:string">
           </xs:element>
-          <xs:choice>
-            <xs:element name="anonStringUnion1" type="xs:string">
-            </xs:element>
-            <xs:element name="anonStringUnionDefault" type="xs:string">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="anonStringUnionDefault" type="xs:string">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="AnonStrings.typedefAnonStringUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="anonStringUnion1" type="xs:string">
+          </xs:element>
+          <xs:element name="anonStringUnionDefault" type="xs:string">
           </xs:element>
-          <xs:choice>
-            <xs:element name="anonStringUnion1" type="xs:string">
-            </xs:element>
-            <xs:element name="anonStringUnionDefault" type="xs:string">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+        </xs:choice>
       </xs:complexType>
       <xs:element name="AnonStrings.anonException" type="AnonStrings.anonExceptionType">
       </xs:element>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Declarators.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Declarators.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Declarators.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Declarators.wsdl Mon May  7 05:57:30 2007
@@ -426,18 +426,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="aUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="aEnum">
+        <xs:choice>
+          <xs:element name="u1_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u1_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u1_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u1_3" type="aStruct">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u1_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u1_3" type="aStruct">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:simpleType name="union_module.aEnum">
         <xs:restriction base="xs:string">
@@ -462,46 +458,34 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="union_module.aUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="union_module.aEnum">
+        <xs:choice>
+          <xs:element name="u1_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u1_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u1_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u1_3" type="union_module.aStruct">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u1_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u1_3" type="union_module.aStruct">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="typedefUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="aEnum">
+        <xs:choice>
+          <xs:element name="u1_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u1_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u1_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u1_3" type="aStruct">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u1_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u1_3" type="aStruct">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="typedefUnion_module.typedefUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="aEnum">
+        <xs:choice>
+          <xs:element name="u1_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u1_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u1_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u1_3" type="aStruct">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u1_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u1_3" type="aStruct">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:simpleType name="testEnum">
         <xs:restriction base="xs:string">

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceStructUnion.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceStructUnion.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceStructUnion.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceStructUnion.wsdl Mon May  7 05:57:30 2007
@@ -44,16 +44,12 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="org.cc.u2">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="u2_1" nillable="true" type="wsa:EndpointReferenceType">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u2_1" nillable="true" type="wsa:EndpointReferenceType">
-            </xs:element>
-            <xs:element name="u2_2" type="xs:string">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u2_2" type="xs:string">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:element name="routeCallStruct">
         <xs:complexType>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceTypedef.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceTypedef.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceTypedef.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardInterfaceTypedef.wsdl Mon May  7 05:57:30 2007
@@ -63,16 +63,12 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="TypedefIf.typedefCall.aUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="aUnionMyLong">
           </xs:element>
-          <xs:choice>
-            <xs:element name="aUnionMyLong">
-            </xs:element>
-            <xs:element name="aUnionMyBoolean" type="xs:boolean">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="aUnionMyBoolean" type="xs:boolean">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="TypedefIf.typedefCall.anotherStruct">
         <xs:sequence>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardUnion.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardUnion.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardUnion.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_ForwardUnion.wsdl Mon May  7 05:57:30 2007
@@ -48,18 +48,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="UnionTest.Foo">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:int">
+        <xs:choice>
+          <xs:element name="u1_1" type="UnionTest.FooSeq">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u1_1" type="UnionTest.FooSeq">
-            </xs:element>
-            <xs:element name="u1_2" type="UnionTest.FooTree">
-            </xs:element>
-            <xs:element name="u1_3" type="xs:int">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u1_2" type="UnionTest.FooTree">
+          </xs:element>
+          <xs:element name="u1_3" type="xs:int">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:element name="getUnionTree">
         <xs:complexType>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_ObjectRef.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_ObjectRef.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_ObjectRef.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_ObjectRef.wsdl Mon May  7 05:57:30 2007
@@ -91,18 +91,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="TestUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="xs:short">
+        <xs:choice>
+          <xs:element name="ref" nillable="true" type="wsa:EndpointReferenceType">
           </xs:element>
-          <xs:choice>
-            <xs:element name="ref" nillable="true" type="wsa:EndpointReferenceType">
-            </xs:element>
-            <xs:element name="str" type="xs:string">
-            </xs:element>
-            <xs:element name="def" type="xs:int">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="str" type="xs:string">
+          </xs:element>
+          <xs:element name="def" type="xs:int">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:element name="_get_ref">
         <xs:complexType>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Typedef.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Typedef.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Typedef.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Typedef.wsdl Mon May  7 05:57:30 2007
@@ -122,18 +122,14 @@
         </xs:restriction>
       </xs:simpleType>
       <xs:complexType name="TypedefIf.aUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="TypedefIf.aEnum">
+        <xs:choice>
+          <xs:element name="aUnionMyLong" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="aUnionMyLong" type="xs:int">
-            </xs:element>
-            <xs:element name="aUnionLong" type="xs:int">
-            </xs:element>
-            <xs:element name="aUnionMyBoolean" type="xs:boolean">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="aUnionLong" type="xs:int">
+          </xs:element>
+          <xs:element name="aUnionMyBoolean" type="xs:boolean">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:complexType name="TypedefIf.anotherStruct">
         <xs:sequence>
@@ -152,18 +148,14 @@
         </xs:restriction>
       </xs:simpleType>
       <xs:complexType name="TypedefIf.anotherUnion">
-        <xs:sequence>
-          <xs:element name="discriminator" type="TypedefIf.anotherEnum">
+        <xs:choice>
+          <xs:element name="anotherUnionMyLong" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="anotherUnionMyLong" type="xs:int">
-            </xs:element>
-            <xs:element name="anotherUnionLong" type="xs:int">
-            </xs:element>
-            <xs:element name="anotherUnionMyBoolean" type="xs:boolean">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="anotherUnionLong" type="xs:int">
+          </xs:element>
+          <xs:element name="anotherUnionMyBoolean" type="xs:boolean">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:element name="opIn">
         <xs:complexType>

Modified: incubator/yoko/trunk/tools/src/test/resources/idl/expected_Union.wsdl
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/test/resources/idl/expected_Union.wsdl?view=diff&rev=535873&r1=535872&r2=535873
==============================================================================
--- incubator/yoko/trunk/tools/src/test/resources/idl/expected_Union.wsdl (original)
+++ incubator/yoko/trunk/tools/src/test/resources/idl/expected_Union.wsdl Mon May  7 05:57:30 2007
@@ -111,18 +111,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="u1">
-        <xs:sequence>
-          <xs:element name="discriminator" type="e1">
+        <xs:choice>
+          <xs:element name="u1_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u1_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u1_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u1_3" type="s1">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u1_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u1_3" type="s1">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:simpleType name="if.e2">
         <xs:restriction base="xs:string">
@@ -147,18 +143,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="if.u2">
-        <xs:sequence>
-          <xs:element name="discriminator" type="if.e2">
+        <xs:choice>
+          <xs:element name="u2_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u2_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u2_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u2_3" type="if.s2">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u2_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u2_3" type="if.s2">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
       <xs:simpleType name="m.e3">
         <xs:restriction base="xs:string">
@@ -183,18 +175,14 @@
         </xs:sequence>
       </xs:complexType>
       <xs:complexType name="m.u3">
-        <xs:sequence>
-          <xs:element name="discriminator" type="m.e3">
+        <xs:choice>
+          <xs:element name="u3_1" type="xs:int">
           </xs:element>
-          <xs:choice>
-            <xs:element name="u3_1" type="xs:int">
-            </xs:element>
-            <xs:element name="u3_2" type="xs:string">
-            </xs:element>
-            <xs:element name="u3_3" type="m.s3">
-            </xs:element>
-          </xs:choice>
-        </xs:sequence>
+          <xs:element name="u3_2" type="xs:string">
+          </xs:element>
+          <xs:element name="u3_3" type="m.s3">
+          </xs:element>
+        </xs:choice>
       </xs:complexType>
     </xs:schema>
   </wsdl:types>