incubator-yoko-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From br...@apache.org
Subject svn commit: r500299 - in /incubator/yoko/trunk: bindings/src/main/java/org/apache/yoko/bindings/corba/ bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/ bindings/src/main/java/org/apache/yoko/bindings/corba/types/ bindings/src/test/ja...
Date Fri, 26 Jan 2007 18:31:23 GMT
Author: bravi
Date: Fri Jan 26 10:31:23 2007
New Revision: 500299

URL: http://svn.apache.org/viewvc?view=rev&rev=500299
Log:
[YOKO-170] - Updated the CorbaStaxObject to allow for using the XmlSchemaType in addition to the corba type map to handle some complex types in the type_test.

Modified:
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultInInterceptor.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultOutInterceptor.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptor.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
    incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java
    incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
    incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaHelper.java

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaStaxObject.java Fri Jan 26 10:31:23 2007
@@ -52,6 +52,15 @@
 import org.apache.schemas.yoko.bindings.corba.Struct;
 import org.apache.schemas.yoko.bindings.corba.Union;
 import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+
+import org.apache.ws.commons.schema.XmlSchemaComplexType;
+import org.apache.ws.commons.schema.XmlSchemaElement;
+import org.apache.ws.commons.schema.XmlSchemaGroupBase;
+import org.apache.ws.commons.schema.XmlSchemaGroupRef;
+import org.apache.ws.commons.schema.XmlSchemaObject;
+import org.apache.ws.commons.schema.XmlSchemaObjectCollection;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
 import org.apache.yoko.bindings.corba.interceptors.CorbaOutInterceptor;
 import org.apache.yoko.bindings.corba.types.CorbaAnyHandler;
 import org.apache.yoko.bindings.corba.types.CorbaArrayHandler;
@@ -119,61 +128,70 @@
     }
 
     public CorbaObjectHandler readObjectFromStax(XMLEventReader reader, 
-                                                 QName idlType,
-                                                 boolean isNested)
+                                                 QName idlType)
         throws CorbaBindingException {
-        CorbaObjectHandler obj = null;
         // Find the first start element in the reader. This should be the
         // beginning of our object
         try {
-            if (!isNested) {
-                while (reader.peek().getEventType() != XMLStreamConstants.START_ELEMENT) {
-                    reader.nextEvent();
-                }
+            while (reader.peek().getEventType() != XMLStreamConstants.START_ELEMENT) {
+                reader.nextEvent();
             }
         } catch (XMLStreamException ex) {
             throw new CorbaBindingException("Unable to locate start of object", ex);
         }
+        CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMaps);
+        XmlSchemaType schemaType = null;
+        if (type != null) {
+            schemaType = CorbaUtils.getXmlSchemaType(serviceInfo, type.getType());
+        }
+        return readObjectFromStax(reader, idlType, schemaType, false);
+    }
 
+    protected CorbaObjectHandler readObjectFromStax(XMLEventReader reader, 
+                                                    QName idlType,
+                                                    XmlSchemaObject schemaType,
+                                                    boolean isNested)
+        throws CorbaBindingException {
         TypeCode tc = CorbaUtils.getTypeCode(orb, idlType, typeMaps);
+        CorbaObjectHandler obj = null;
         if (CorbaUtils.isPrimitiveIdlType(idlType)) {
             LOG.log(Level.INFO, "Reading primitive type from XML reader");
-            obj = readPrimitiveFromStax(reader, idlType, tc);
+            obj = readPrimitiveFromStax(reader, idlType, tc, schemaType);
         } else {
             switch (tc.kind().value()) {
             case TCKind._tk_array:
                 LOG.log(Level.INFO, "Reading array type from XML reader");
-                obj = readArrayFromStax(reader, idlType, tc);
+                obj = readArrayFromStax(reader, idlType, tc, schemaType, !isNested);
                 break;
             case TCKind._tk_enum:
                 LOG.log(Level.INFO, "Reading enumeration type from XML reader");
-                obj = readEnumFromStax(reader, idlType, tc);
+                obj = readEnumFromStax(reader, idlType, tc, schemaType);
                 break;
             case TCKind._tk_except:
                 LOG.log(Level.INFO, "Reading exception type from XML reader");
-                obj = readExceptionFromStax(reader, idlType, tc);
+                obj = readExceptionFromStax(reader, idlType, tc, schemaType);
                 break;
             case TCKind._tk_fixed:
                 LOG.log(Level.INFO, "Reading fixed type from XML reader");
-                obj = readFixedFromStax(reader, idlType, tc);
+                obj = readFixedFromStax(reader, idlType, tc, schemaType);
                 break;
             case TCKind._tk_sequence:
                 LOG.log(Level.INFO, "Reading sequence type from XML reader");
-                obj = readSequenceFromStax(reader, idlType, tc, !isNested);
+                obj = readSequenceFromStax(reader, idlType, tc, schemaType, !isNested);
                 break;
             case TCKind._tk_string:
             case TCKind._tk_wstring:
                 // These will be the case if we have anonymous strings
                 LOG.log(Level.INFO, "Reading anonymous string from XML reader");
-                obj = readAnonStringsFromStax(reader, idlType, tc);
+                obj = readAnonStringsFromStax(reader, idlType, tc, schemaType);
                 break;
             case TCKind._tk_struct:
                 LOG.log(Level.INFO, "Reading struct type from XML reader");
-                obj = readStructFromStax(reader, idlType, tc);
+                obj = readStructFromStax(reader, idlType, tc, schemaType);
                 break;
             case TCKind._tk_union:
                 LOG.log(Level.INFO, "Reading union type from XML reader");
-                obj = readUnionFromStax(reader, idlType, tc);
+                obj = readUnionFromStax(reader, idlType, tc, schemaType);
                 break;
             default:
                 throw new CorbaBindingException("Unsupported complex type");
@@ -185,8 +203,14 @@
 
     public void writeObjectToStax(CorbaObjectHandler obj,
                                   XMLEventWriter writer,
-                                  XMLEventFactory factory,
-                                  boolean isNested) {
+                                  XMLEventFactory factory) {
+        writeObjectToStax(obj, writer, factory, false);
+    }
+
+    protected void writeObjectToStax(CorbaObjectHandler obj,
+                                     XMLEventWriter writer,
+                                     XMLEventFactory factory,
+                                     boolean isNested) {
         try {
             if (obj != null) {
                 TypeCode tc = obj.getTypeCode();
@@ -196,7 +220,7 @@
                     switch (tc.kind().value()) {
                     case TCKind._tk_array:
                         LOG.log(Level.INFO, "Writing array type to XML writer");
-                        writeArrayToStax(obj, writer, factory);
+                        writeArrayToStax(obj, writer, factory, !isNested);
                         break;
                     case TCKind._tk_enum:
                         LOG.log(Level.INFO, "Writing enum type to XML writer");
@@ -244,7 +268,10 @@
         }
     }
 
-    public CorbaObjectHandler readPrimitiveFromStax(XMLEventReader reader, QName idlType, TypeCode tc) 
+    protected CorbaObjectHandler readPrimitiveFromStax(XMLEventReader reader,
+                                                       QName idlType,
+                                                       TypeCode tc,
+                                                       XmlSchemaObject schemaType) 
         throws CorbaBindingException {
         try {
             StartElement startEl = reader.nextEvent().asStartElement();
@@ -258,7 +285,6 @@
             }                                    
                                     
             reader.nextEvent().asEndElement();             
-
             if (tc.kind().value() == TCKind._tk_any) {
                 Iterator attrIter = startEl.getAttributes();
                 String anySchemaType = null;
@@ -288,7 +314,9 @@
         }
     }
     
-    public void writePrimitiveToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
+    protected void writePrimitiveToStax(CorbaObjectHandler obj,
+                                        XMLEventWriter writer,
+                                        XMLEventFactory factory) 
         throws XMLStreamException {
         StartElement startEl;
         QName objName = obj.getName();
@@ -332,7 +360,10 @@
         writer.add(endEl);    
     }
 
-    public CorbaObjectHandler readAnonStringsFromStax(XMLEventReader reader, QName idlType, TypeCode tc) {
+    protected CorbaObjectHandler readAnonStringsFromStax(XMLEventReader reader,
+                                                         QName idlType,
+                                                         TypeCode tc,
+                                                         XmlSchemaObject schemaType) {
         CorbaPrimitiveHandler obj = null;
         
         try {
@@ -357,31 +388,54 @@
     
     // Anonymous strings do not need an equivalent write - the primitive handler write is sufficuent. 
     
-    public CorbaObjectHandler readArrayFromStax(XMLEventReader reader, QName idlType, TypeCode tc)
+    protected CorbaObjectHandler readArrayFromStax(XMLEventReader reader,
+                                                   QName idlType,
+                                                   TypeCode tc,
+                                                   XmlSchemaObject schemaType,
+                                                   boolean isTopLevel)
         throws CorbaBindingException {
         CorbaArrayHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
+        if (schemaType == null) {
+            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
+        }
         try {
             QName arrayElemType = null;
             long arrayBound = 0;
+            CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMaps);
             // Arrays and anonymous arrays can be handled by the same method
-            if (typeDefinition instanceof Anonarray) {
-                Anonarray anonArrayType = (Anonarray)typeDefinition;
+            if (type instanceof Anonarray) {
+                Anonarray anonArrayType = (Anonarray)type;
                 arrayElemType = anonArrayType.getElemtype();
                 arrayBound = anonArrayType.getBound();
             } else {
-                Array arrayType = (Array)typeDefinition;
+                Array arrayType = (Array)type;
                 arrayElemType = arrayType.getElemtype();
                 arrayBound = arrayType.getBound();
             }
-            StartElement arrayStartEl = reader.nextEvent().asStartElement();
-            obj = new CorbaArrayHandler(arrayStartEl.getName(), idlType, tc, typeDefinition);
+            XmlSchemaElement el = getXmlSchemaSequenceElement(schemaType, idlType);
+
+            QName name;
+            if (isTopLevel) {
+                name = reader.nextEvent().asStartElement().getName();
+            } else {
+                name = el.getQName();
+            }
+
+            obj = new CorbaArrayHandler(name, idlType, tc, type);
+            boolean nestedArray = isNestedArray(arrayElemType);
             for (int i = 0; i < arrayBound; ++i) {
-                CorbaObjectHandler element = readObjectFromStax(reader, arrayElemType, true);
+                if (nestedArray) {
+                    reader.nextEvent().asStartElement();
+                }
+                CorbaObjectHandler element = readObjectFromStax(reader, arrayElemType, el, true);
                 obj.addElement(element);
+                if (nestedArray) {
+                    reader.nextEvent().asEndElement();
+                }
+            }
+            if (isTopLevel) {
+                reader.nextEvent().asEndElement();
             }
-            reader.nextEvent().asEndElement();
         } catch (java.lang.Exception ex) {
             LOG.log(Level.SEVERE, "Received exception while reading object of type " + idlType);
             throw new CorbaBindingException("Error while reading array corba type", ex);
@@ -390,27 +444,46 @@
         return obj;
     }
 
-    public void writeArrayToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
+    protected void writeArrayToStax(CorbaObjectHandler obj,
+                                    XMLEventWriter writer,
+                                    XMLEventFactory factory,
+                                    boolean isTopLevel) 
         throws XMLStreamException {
         QName objName = obj.getName();
-        StartElement startEl = factory.createStartElement(objName, null, null);
-        writer.add(startEl);
+        if (isTopLevel) {
+            StartElement startEl = factory.createStartElement(objName, null, null);
+            writer.add(startEl);
+        }
         CorbaArrayHandler arrayHandler = (CorbaArrayHandler)obj;
         List<CorbaObjectHandler> elements = arrayHandler.getElements();
         for (Iterator<CorbaObjectHandler> elementsIter = elements.iterator(); elementsIter.hasNext();) {
-            writeObjectToStax(elementsIter.next(), writer, factory, true);
+            CorbaObjectHandler handler = elementsIter.next();
+            QName handlerName = handler.getName();
+            boolean nestedArray = isNestedArray(handler.getTypeCode());
+            if (nestedArray) {               
+                StartElement startEl = factory.createStartElement(handlerName, null, null);
+                writer.add(startEl);
+            }
+            writeObjectToStax(handler, writer, factory, true);
+            if (nestedArray) {
+                EndElement endEl = factory.createEndElement(handlerName, null);
+                writer.add(endEl);
+            }
         }
-        EndElement endEl = factory.createEndElement(objName, null);
-        writer.add(endEl);    
+        if (isTopLevel) {
+            EndElement endEl = factory.createEndElement(objName, null);
+            writer.add(endEl);
+        } 
     }
     
-    public CorbaObjectHandler readEnumFromStax(XMLEventReader reader, QName idlType, TypeCode tc)
+    protected CorbaObjectHandler readEnumFromStax(XMLEventReader reader,
+                                                  QName idlType,
+                                                  TypeCode tc,
+                                                  XmlSchemaObject schemaType)
         throws CorbaBindingException {
         CorbaEnumHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
         try {
-            Enum enumType = (Enum)typeDefinition;
+            Enum enumType = (Enum) CorbaUtils.getCorbaType(idlType, typeMaps);
             StartElement enumStartEl = reader.nextEvent().asStartElement();
             obj = new CorbaEnumHandler(enumStartEl.getName(), idlType, tc, enumType);
             Characters enumCharEl = reader.nextEvent().asCharacters();
@@ -424,7 +497,7 @@
         return obj;
     }
     
-    public void writeEnumToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
+    protected void writeEnumToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
         throws XMLStreamException {
         QName objName = obj.getName();
         StartElement startEl = factory.createStartElement(objName, null, null);
@@ -436,19 +509,26 @@
         writer.add(endEl); 
     }
 
-    public CorbaObjectHandler readExceptionFromStax(XMLEventReader reader, QName idlType, TypeCode tc)
+    protected CorbaObjectHandler readExceptionFromStax(XMLEventReader reader,
+                                                       QName idlType,
+                                                       TypeCode tc,
+                                                       XmlSchemaObject schemaType)
         throws CorbaBindingException {
+        if (schemaType == null) {
+            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
+        }
         CorbaExceptionHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
         try {
-            Exception exType = (Exception)typeDefinition;
+            Exception exType = (Exception) CorbaUtils.getCorbaType(idlType, typeMaps);
             StartElement exStartEl = reader.nextEvent().asStartElement();
             obj = new CorbaExceptionHandler(exStartEl.getName(), idlType, tc, exType);
+            XmlSchemaComplexType ctype = (XmlSchemaComplexType) schemaType;
+            XmlSchemaGroupBase group = (XmlSchemaGroupBase) ctype.getParticle();
             List<MemberType> exMembers = exType.getMember();
             for (int i = 0; i < exMembers.size(); ++i) {
                 CorbaObjectHandler member = readObjectFromStax(reader,
                                                                exMembers.get(i).getIdltype(),
+                                                               group.getItems().getItem(i),
                                                                true);
                 obj.addMember(member);
             }
@@ -461,7 +541,9 @@
         return obj;
     }
 
-    public void writeExceptionToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
+    protected void writeExceptionToStax(CorbaObjectHandler obj,
+                                        XMLEventWriter writer,
+                                        XMLEventFactory factory) 
         throws XMLStreamException {
         QName objName = obj.getName();
         StartElement startEl = factory.createStartElement(objName, null, null);
@@ -475,61 +557,74 @@
         writer.add(endEl); 
     }
 
-    public CorbaObjectHandler readSequenceFromStax(XMLEventReader reader,
-                                                   QName idlType,
-                                                   TypeCode tc,
-                                                   boolean isTopLevel)
+    protected CorbaObjectHandler readSequenceFromStax(XMLEventReader reader,
+                                                      QName idlType,
+                                                      TypeCode tc,
+                                                      XmlSchemaObject schemaType,
+                                                      boolean isTopLevel)
         throws CorbaBindingException {
+        if (schemaType == null) {
+            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
+        }
         CorbaSequenceHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
         try {
             QName seqElementType = null;
             long bound = 0;
-            if (typeDefinition instanceof Anonsequence) {
-                Anonsequence anonSeqType = (Anonsequence)typeDefinition;
+            CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMaps);
+            if (type instanceof Anonsequence) {
+                Anonsequence anonSeqType = (Anonsequence)type;
                 seqElementType = anonSeqType.getElemtype();
                 bound = anonSeqType.getBound();
             } else {
-                Sequence seqType = (Sequence)typeDefinition;
+                Sequence seqType = (Sequence)type;
                 seqElementType = seqType.getElemtype();
                 bound = seqType.getBound();
             }
-            QName name = new QName("", typeDefinition.getName());
+
+            QName name = null;
+            if (schemaType instanceof XmlSchemaElement) {
+                name = ((XmlSchemaElement) schemaType).getQName();
+            }
+            XmlSchemaElement el = getXmlSchemaSequenceElement(schemaType, idlType);
             if (isTopLevel) {
-                StartElement el = reader.nextEvent().asStartElement();
-                name = el.getName();
+                name = reader.nextEvent().asStartElement().getName();
+            }
+            if (name == null) {
+                throw new CorbaBindingException("Couldn't find Schema element for corba:sequence " + idlType);
             }
 
             obj = new CorbaSequenceHandler(name,
                                            idlType,
                                            tc,
-                                           typeDefinition);
+                                           type);
             boolean nestedSequence = isNestedSequence(seqElementType);
             if (bound == 0) {
                 LOG.log(Level.INFO, "Unbounded sequence found");
-                while (reader.peek().getEventType() == XMLStreamConstants.START_ELEMENT) {
-                    QName elName = null;
-                    if (nestedSequence) {
-                        elName = reader.nextEvent().asStartElement().getName();
+                XMLEvent event = reader.peek();
+                while (event.getEventType() == XMLStreamConstants.START_ELEMENT) {
+                    StartElement startEl = (StartElement) event;
+                    if (startEl.getName().equals(el.getQName())) {
+                        if (nestedSequence) {
+                            reader.nextEvent().asStartElement();
+                        }
+                    } else {
+                        break;
                     }
-                    CorbaObjectHandler element = readObjectFromStax(reader, seqElementType, true);
+                    CorbaObjectHandler element = readObjectFromStax(reader, seqElementType, el, true);
                     if (nestedSequence) {
-                        element.setName(elName);
                         reader.nextEvent().asEndElement();
                     }
                     obj.addElement(element);
+                    event = reader.peek();
                 }
             } else {
                 LOG.log(Level.INFO, "Bounded sequence found");
                 for (long i = 0; i < bound; ++i) {
-                    QName elName = null;
                     if (nestedSequence) {
-                        elName = reader.nextEvent().asStartElement().getName();
+                        reader.nextEvent().asStartElement();
                     }
-                    CorbaObjectHandler element = readObjectFromStax(reader, seqElementType, true);
+                    CorbaObjectHandler element = readObjectFromStax(reader, seqElementType, el, true);
                     if (nestedSequence) {
-                        element.setName(elName);
                         reader.nextEvent().asEndElement();
                     }
                     obj.addElement(element);
@@ -546,10 +641,10 @@
         return obj;
     }
 
-    public void writeSequenceToStax(CorbaObjectHandler obj,
-                                    XMLEventWriter writer,
-                                    XMLEventFactory factory,
-                                    boolean isTopLevel) 
+    protected void writeSequenceToStax(CorbaObjectHandler obj,
+                                       XMLEventWriter writer,
+                                       XMLEventFactory factory,
+                                       boolean isTopLevel) 
         throws XMLStreamException {
         QName name = obj.getName();
         if (isTopLevel) {
@@ -562,7 +657,7 @@
             CorbaObjectHandler handler = elementsIter.next();
             QName objName = handler.getName();
             boolean nestedSequence = isNestedSequence(handler.getTypeCode());
-            if (nestedSequence) {               
+            if (nestedSequence) {
                 StartElement startEl = factory.createStartElement(objName, null, null);
                 writer.add(startEl);
             }
@@ -578,25 +673,71 @@
         }
     }
 
-    public CorbaObjectHandler readStructFromStax(XMLEventReader reader,
-                                                 QName idlType,
-                                                 TypeCode tc)
+    protected CorbaObjectHandler readStructFromStax(XMLEventReader reader,
+                                                    QName idlType,
+                                                    TypeCode tc,
+                                                    XmlSchemaObject schemaType)
         throws CorbaBindingException {
+        if (schemaType == null) {
+            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
+        }
         CorbaStructHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
-        try {
-            Struct structType = (Struct)typeDefinition;
-            StartElement structStartEl = reader.nextEvent().asStartElement();
-            obj = new CorbaStructHandler(structStartEl.getName(), idlType, tc, structType);
+        try {            
+            Struct structType = (Struct) CorbaUtils.getCorbaType(idlType, typeMaps);
+ 
+            XmlSchemaObjectCollection attrs = null;
+            XmlSchemaObjectCollection members = null;
+            
+            boolean readElement = false;
+
+            XmlSchemaObject stype = schemaType;
+            if (schemaType instanceof XmlSchemaElement) {
+                XmlSchemaElement el = (XmlSchemaElement) schemaType;
+                stype = el.getSchemaType();
+                if (stype == null) {
+                    stype = CorbaUtils.getXmlSchemaType(serviceInfo, el.getRefName());
+                }
+                readElement = true;
+            }
+            if (stype instanceof XmlSchemaComplexType) {
+                XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype;
+                attrs = ctype.getAttributes();
+                stype = ctype.getParticle();
+                readElement = true;
+            }
+            if (stype instanceof XmlSchemaGroupRef) {
+                members = ((XmlSchemaGroupRef) stype).getParticle().getItems();
+            } else if (stype instanceof XmlSchemaGroupBase) {
+                members = ((XmlSchemaGroupBase) stype).getItems();
+            }
+            QName elName;
+            if (readElement) {
+                StartElement structStartEl = reader.nextEvent().asStartElement();
+                elName = structStartEl.getName();
+            } else {
+                elName = CorbaUtils.EMPTY_QNAME;
+            }
+            obj = new CorbaStructHandler(elName, idlType, tc, structType);
+
             List<MemberType> structMembers = structType.getMember();
+            int attrCount = 0;
+            int memberCount = 0;
             for (int i = 0; i < structMembers.size(); ++i) {
+                XmlSchemaObject schemaObj;
+                if ((attrs != null) && (attrCount != attrs.getCount())) {
+                    schemaObj = attrs.getItem(attrCount++);
+                } else {
+                    schemaObj = members.getItem(memberCount++);
+                }
                 CorbaObjectHandler member = readObjectFromStax(reader, 
-                                                               structMembers.get(i).getIdltype(), 
+                                                               structMembers.get(i).getIdltype(),
+                                                               schemaObj,
                                                                true);
                 obj.addMember(member);
             }
-            reader.nextEvent().asEndElement();
+            if (readElement) {
+                reader.nextEvent().asEndElement();
+            }
         } catch (java.lang.Exception ex) {
             LOG.log(Level.SEVERE, "Received exception while reading object of type " + idlType);
             throw new CorbaBindingException("Error while reading struct corba type", ex);
@@ -605,7 +746,7 @@
         return obj;
     }
 
-    public void writeStructToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
+    protected void writeStructToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
         throws XMLStreamException {
         QName objName = obj.getName();
         StartElement startEl = factory.createStartElement(objName, null, null);
@@ -620,13 +761,17 @@
     }
 
 
-    public CorbaObjectHandler readUnionFromStax(XMLEventReader reader, QName idlType, TypeCode tc)
+    protected CorbaObjectHandler readUnionFromStax(XMLEventReader reader,
+                                                   QName idlType,
+                                                   TypeCode tc,
+                                                   XmlSchemaObject schemaType)
         throws CorbaBindingException {
+        if (schemaType == null) {
+            throw new CorbaBindingException("Couldn't find xml schema object for : " + idlType);
+        }
         CorbaUnionHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
         try {
-            Union unionType = (Union)typeDefinition;
+            Union unionType = (Union) CorbaUtils.getCorbaType(idlType, typeMaps);
             StartElement unionStartEl = reader.nextEvent().asStartElement();            
 
             obj = new CorbaUnionHandler(unionStartEl.getName(), idlType, tc, unionType);
@@ -648,7 +793,7 @@
                 Unionbranch branch = branchesIter.next();
                 CorbaObjectHandler branchObj = null;
                 if (branch.getName().equals(branchName)) {
-                    branchObj = readObjectFromStax(reader, branch.getIdltype(), true);
+                    branchObj = readObjectFromStax(reader, branch.getIdltype(), null, true);
                     // We also need to set the discriminator since this is the branch with the actual
                     // union value
                     CorbaObjectHandler discObj = 
@@ -693,7 +838,7 @@
         return obj;
     }
     
-    public void writeUnionToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory)
+    protected void writeUnionToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory)
         throws XMLStreamException {
         QName objName = obj.getName();
         StartElement startEl = factory.createStartElement(objName, null, null);
@@ -707,14 +852,16 @@
         writer.add(endEl); 
     }
     
-    public CorbaObjectHandler readFixedFromStax(XMLEventReader reader, QName idlType, TypeCode tc) 
+    protected CorbaObjectHandler readFixedFromStax(XMLEventReader reader,
+                                                   QName idlType,
+                                                   TypeCode tc,
+                                                   XmlSchemaObject schemaType) 
         throws CorbaBindingException {
         CorbaFixedHandler obj = null;
-        CorbaTypeImpl typeDefinition = CorbaUtils.getCorbaType(idlType, typeMaps);
-        
         try {
+            CorbaTypeImpl type = CorbaUtils.getCorbaType(idlType, typeMaps);
             StartElement fixedStartEl = reader.nextEvent().asStartElement();
-            obj = new CorbaFixedHandler(fixedStartEl.getName(), idlType, tc, typeDefinition);
+            obj = new CorbaFixedHandler(fixedStartEl.getName(), idlType, tc, type);
             Characters fixedCharEl = reader.nextEvent().asCharacters();
             obj.setValueFromData(fixedCharEl.getData());
             reader.nextEvent().asEndElement();
@@ -725,7 +872,7 @@
         return obj;
     }
     
-    public void writeFixedToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
+    protected void writeFixedToStax(CorbaObjectHandler obj, XMLEventWriter writer, XMLEventFactory factory) 
         throws XMLStreamException {
         QName objName = obj.getName();
         StartElement startEl = factory.createStartElement(objName, null, null);
@@ -748,5 +895,39 @@
     private boolean isNestedSequence(QName seqElType) {
         TypeCode tc = CorbaUtils.getTypeCode(orb, seqElType, typeMaps);
         return isNestedSequence(tc);
+    }
+
+    private boolean isNestedArray(TypeCode tc) {
+        boolean result = false;
+        if (tc.kind().value() == TCKind._tk_array) {
+            result = true;
+        }
+        return result;
+    }
+
+    private boolean isNestedArray(QName arrayElType) {
+        TypeCode tc = CorbaUtils.getTypeCode(orb, arrayElType, typeMaps);
+        return isNestedArray(tc);
+    }
+    
+    private XmlSchemaElement getXmlSchemaSequenceElement(XmlSchemaObject schemaType, QName idlType) {
+        XmlSchemaObject stype = schemaType;
+        XmlSchemaElement el = null;
+        if (schemaType instanceof XmlSchemaElement) {
+            stype = ((XmlSchemaElement) schemaType).getSchemaType();
+            if (stype == null) {
+                stype = CorbaUtils.getXmlSchemaType(serviceInfo, el.getRefName());
+            }
+        }
+        
+        if (stype instanceof XmlSchemaComplexType) {
+            //only one element inside the XmlSchemaComplexType
+            XmlSchemaComplexType ctype = (XmlSchemaComplexType) stype;
+            XmlSchemaGroupBase group = (XmlSchemaGroupBase) ctype.getParticle();
+            el = (XmlSchemaElement) group.getItems().getItem(0);
+        } else {
+            el = (XmlSchemaElement) schemaType;
+        }
+        return el;
     }
 }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/CorbaUtils.java Fri Jan 26 10:31:23 2007
@@ -31,6 +31,8 @@
 import javax.xml.namespace.QName;
 
 import org.apache.cxf.common.logging.LogUtils;
+import org.apache.cxf.service.model.SchemaInfo;
+import org.apache.cxf.service.model.ServiceInfo;
 
 import org.apache.schemas.yoko.bindings.corba.Alias;
 import org.apache.schemas.yoko.bindings.corba.Anonarray;
@@ -52,6 +54,11 @@
 import org.apache.schemas.yoko.bindings.corba.TypeMappingType;
 import org.apache.schemas.yoko.bindings.corba.Union;
 import org.apache.schemas.yoko.bindings.corba.Unionbranch;
+
+import org.apache.ws.commons.schema.XmlSchema;
+import org.apache.ws.commons.schema.XmlSchemaExternal;
+import org.apache.ws.commons.schema.XmlSchemaType;
+
 import org.apache.yoko.wsdl.CorbaConstants;
 import org.apache.yoko.wsdl.CorbaTypeImpl;
 
@@ -64,34 +71,40 @@
 public class CorbaUtils {
 
     static Map<QName, TCKind> PRIMITIVE_TYPECODES = new HashMap<QName, TCKind>();
-   
+    static QName EMPTY_QNAME = new QName("", "");
+
     private static final Logger LOG = LogUtils.getL7dLogger(CorbaUtils.class);
     
     public static TypeCode getTypeCode(ORB orb, QName type, List<CorbaTypeMap> typeMaps) {
+        return getTypeCode(orb, type, null, typeMaps);
+    }
+
+    public static TypeCode getTypeCode(ORB orb, QName type, CorbaType obj, List<CorbaTypeMap> typeMaps) {
         TypeCode tc = null;
 
         // first see if it is a primitive
         tc = getPrimitiveTypeCode(orb, type);
         if (tc == null) {
             // this means it is not a primitive type
-            CorbaTypeMap currentMap = null;
-            for (int i = 0; i < typeMaps.size(); ++i) {
-                if (typeMaps.get(i).getTargetNamespace().equals(type.getNamespaceURI())) {
-                    currentMap = typeMaps.get(i);
-                    break;
+            if (obj == null) {
+                CorbaTypeMap currentMap = null;
+                for (int i = 0; i < typeMaps.size(); ++i) {
+                    if (typeMaps.get(i).getTargetNamespace().equals(type.getNamespaceURI())) {
+                        currentMap = typeMaps.get(i);
+                        break;
+                    }
                 }
-            }
 
-            if (currentMap == null) {
-                throw new CorbaBindingException("Unable to locate typemap for namespace \"" 
-                                                + type.getNamespaceURI() + "\"");
-            }
+                if (currentMap == null) {
+                    throw new CorbaBindingException("Unable to locate typemap for namespace \"" 
+                                                    + type.getNamespaceURI() + "\"");
+                }
 
-            CorbaType obj = currentMap.getType(type.getLocalPart());
-            if (obj == null) {
-                throw new CorbaBindingException("Unable to locate object definition");
+                obj = currentMap.getType(type.getLocalPart());
+                if (obj == null) {
+                    throw new CorbaBindingException("Unable to locate object definition");
+                }
             }
-
             tc = getComplexTypeCode(orb, type, obj, typeMaps);
         }
         return tc;
@@ -285,13 +298,14 @@
 
     public static CorbaTypeImpl getCorbaType(QName idlType, List<CorbaTypeMap> typeMaps) {
         CorbaTypeMap currentMap = null;
-        for (int i = 0; i < typeMaps.size(); ++i) {
-            currentMap = typeMaps.get(i);
-            if (currentMap.getTargetNamespace().equals(idlType.getNamespaceURI())) {
-                return (CorbaTypeImpl) currentMap.getType(idlType.getLocalPart());
+        if (!isPrimitiveIdlType(idlType)) {
+            for (int i = 0; i < typeMaps.size(); ++i) {
+                currentMap = typeMaps.get(i);
+                if (currentMap.getTargetNamespace().equals(idlType.getNamespaceURI())) {
+                    return (CorbaTypeImpl) currentMap.getType(idlType.getLocalPart());
+                }
             }
         }
-
         return null;
     }
 
@@ -320,7 +334,7 @@
                 List<CorbaTypeImpl> types = tmType.getStructOrExceptionOrUnion();
                 LOG.info("Found " + types.size() + " types defined in the typemap");
                 for (Iterator<CorbaTypeImpl> it = types.iterator(); it.hasNext();) {
-                    CorbaTypeImpl corbaType = it.next();
+                    CorbaTypeImpl corbaType = it.next();                     
                     map.addType(corbaType.getName(), corbaType);
                     LOG.info("Adding type " + corbaType.getName());
                 }
@@ -374,6 +388,31 @@
             result = orb.string_to_object(ior.trim());
         } catch (java.io.IOException ex) {
             throw new RuntimeException(ex);
+        }
+        return result;
+    }
+
+    //Change this method to access the XmlSchemaCollection.
+    public static XmlSchemaType getXmlSchemaType(ServiceInfo serviceInfo, QName name) {
+        if ((name != null) && (serviceInfo != null)) {
+            Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
+            while (it.hasNext()) {
+                XmlSchema schema = it.next().getSchema();
+                return getXmlSchemaType(schema, name);
+            }
+        }
+        return null;
+    }
+
+    //Change this method to access the XmlSchemaCollection.    
+    private static XmlSchemaType getXmlSchemaType(XmlSchema schema, QName name) {
+        XmlSchemaType result = schema.getTypeByName(name);
+        if (result == null) {
+            Iterator it = schema.getIncludes().getIterator();
+            while (it.hasNext()) {
+                XmlSchemaExternal extSchema = (XmlSchemaExternal) it.next();
+                return getXmlSchemaType(extSchema.getSchema(), name);
+            }
         }
         return result;
     }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultInInterceptor.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultInInterceptor.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultInInterceptor.java Fri Jan 26 10:31:23 2007
@@ -107,8 +107,7 @@
                 XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
                 corbaStaxObject.writeObjectToStax(exStreamable.getObject(),
                                                   evtWriter,
-                                                  XMLEventFactory.newInstance(),
-                                                  false);
+                                                  XMLEventFactory.newInstance());
                 evtWriter.flush();
                 ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
                 XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultOutInterceptor.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultOutInterceptor.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaFaultOutInterceptor.java Fri Jan 26 10:31:23 2007
@@ -183,7 +183,7 @@
         LOG.log(Level.INFO, "Found exception in the raises list.  Marshalling.");
         ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
         XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);
-        CorbaObjectHandler obj = corbaStaxObject.readObjectFromStax(evtReader, exIdlType, false);
+        CorbaObjectHandler obj = corbaStaxObject.readObjectFromStax(evtReader, exIdlType);
         CorbaStreamable streamable = new CorbaStreamable(obj, elName);
         message.setStreamableException(streamable);
     }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptor.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptor.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaInInterceptor.java Fri Jan 26 10:31:23 2007
@@ -332,8 +332,7 @@
             XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
             CorbaStreamable retVal = outMessage.getStreamableReturn();
             corbaStaxObject.writeObjectToStax(retVal.getObject(), evtWriter, 
-                                              XMLEventFactory.newInstance(),
-                                              false);
+                                              XMLEventFactory.newInstance());
             evtWriter.flush();
             ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
             XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);            
@@ -388,8 +387,7 @@
                 XMLEventWriter evtWriter = outputFactory.createXMLEventWriter(outStream);
                 corbaStaxObject.writeObjectToStax(streamables[i].getObject(),
                                                   evtWriter,
-                                                  XMLEventFactory.newInstance(),
-                                                  false);
+                                                  XMLEventFactory.newInstance());
                 evtWriter.flush();
                 ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());
                 XMLEventReader evtReader = inputFactory.createXMLEventReader(inStream);

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/interceptors/CorbaOutInterceptor.java Fri Jan 26 10:31:23 2007
@@ -196,9 +196,7 @@
                 if (param.getMode().equals(ModeType.OUT)) {
                     obj = CorbaHandlerUtils.initializeObjectHandler(orb, elName, idlType, typeMaps, service);
                 } else {
-                    obj = corbaStaxObject.readObjectFromStax(evtReader,
-                                                             idlType,
-                                                             false);
+                    obj = corbaStaxObject.readObjectFromStax(evtReader, idlType);
                 }
                 CorbaStreamable streamable = new CorbaStreamable(obj, elName);
                 ModeType paramMode = param.getMode();
@@ -248,9 +246,7 @@
             if (returnParam != null) {
                 QName retIdlType = returnParam.getIdltype();
                 QName retName = new QName("", returnParam.getName());
-                CorbaObjectHandler obj = corbaStaxObject.readObjectFromStax(evtReader,
-                                                                            retIdlType,
-                                                                            false);
+                CorbaObjectHandler obj = corbaStaxObject.readObjectFromStax(evtReader, retIdlType);
                 CorbaStreamable streamable = new CorbaStreamable(obj, retName);
                 message.setStreamableReturn(streamable);
             }
@@ -264,9 +260,7 @@
                 if (param.getMode().equals(ModeType.IN)) {
                     obj = CorbaHandlerUtils.initializeObjectHandler(orb, elName, idlType, typeMaps, service);
                 } else {
-                    obj = corbaStaxObject.readObjectFromStax(evtReader,
-                                                             idlType,
-                                                             false);
+                    obj = corbaStaxObject.readObjectFromStax(evtReader, idlType);
                 }
 
                 CorbaStreamable streamable = new CorbaStreamable(obj, elName);

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaHandlerUtils.java Fri Jan 26 10:31:23 2007
@@ -153,7 +153,7 @@
         QName arrayElementType = null;
         long arrayBound = 0;
         CorbaTypeImpl baseType = obj.getType();
-        XmlSchemaType schemaType = getXmlSchemaType(serviceInfo, baseType.getType());
+        XmlSchemaType schemaType = CorbaUtils.getXmlSchemaType(serviceInfo, baseType.getType());
         String elName = "item";
         if ((schemaType != null) && (schemaType instanceof XmlSchemaComplexType)) {
             XmlSchemaSequence seq = (XmlSchemaSequence) ((XmlSchemaComplexType) schemaType).getParticle();
@@ -205,7 +205,7 @@
         QName seqElementType = null;
         long seqBound = 0;
         CorbaTypeImpl baseType = obj.getType();
-        XmlSchemaType schemaType = getXmlSchemaType(serviceInfo, baseType.getType());
+        XmlSchemaType schemaType = CorbaUtils.getXmlSchemaType(serviceInfo, baseType.getType());
         String elName = name.getLocalPart();
         if ((schemaType != null) && (schemaType instanceof XmlSchemaComplexType)) {
             XmlSchemaSequence seq = (XmlSchemaSequence) ((XmlSchemaComplexType) schemaType).getParticle();
@@ -322,28 +322,5 @@
         return false;
     }
 
-    //Change this method to access the XmlSchemaCollection.
-    public static XmlSchemaType getXmlSchemaType(ServiceInfo serviceInfo, QName name) {
-        if (name != null) {
-            Iterator<SchemaInfo> it = serviceInfo.getSchemas().iterator();
-            while (it.hasNext()) {
-                XmlSchema schema = it.next().getSchema();
-                return getXmlSchemaType(schema, name);
-            }
-        }
-        return null;
-    }
 
-    //Change this method to access the XmlSchemaCollection.    
-    private static XmlSchemaType getXmlSchemaType(XmlSchema schema, QName name) {
-        XmlSchemaType result = schema.getTypeByName(name);
-        if (result == null) {
-            Iterator it = schema.getIncludes().getIterator();
-            while (it.hasNext()) {
-                XmlSchemaExternal extSchema = (XmlSchemaExternal) it.next();
-                return getXmlSchemaType(extSchema.getSchema(), name);
-            }
-        }
-        return result;
-    }
 }

Modified: incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java (original)
+++ incubator/yoko/trunk/bindings/src/main/java/org/apache/yoko/bindings/corba/types/CorbaObjectHandler.java Fri Jan 26 10:31:23 2007
@@ -49,10 +49,6 @@
     public QName getName() {
         return name;
     }
-
-    public void setName(QName qname) {
-        name = qname;
-    }
     
     public String getSimpleName() {
         return name.getLocalPart();

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaStaxObjectTest.java Fri Jan 26 10:31:23 2007
@@ -110,6 +110,7 @@
         if (corbaTypes != null) {
             CorbaUtils.createCorbaTypeMap(typeMaps, corbaTypes);
             staxObject.setTypeMaps(typeMaps);
+            staxObject.setServiceInfo(service);
         }
         
     }
@@ -148,7 +149,7 @@
             XMLEventFactory factory = XMLEventFactory.newInstance();
             StartElement startEl = factory.createStartElement(obj.getName(), null, null);
             evtWriter.add(startEl);
-            staxObject.writePrimitiveToStax(obj, evtWriter, factory);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             EndElement endEl = factory.createEndElement(obj.getName(), null);
             evtWriter.add(endEl);
             evtWriter.flush();
@@ -167,9 +168,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler result = (CorbaObjectHandler)staxObject.readPrimitiveFromStax(evtReader, 
-                                                                      obj.getIdlType(), 
-                                                                      obj.getTypeCode());
+        CorbaObjectHandler result = (CorbaObjectHandler) staxObject.readObjectFromStax(evtReader, 
+                                                                                       obj.getIdlType());
         assertNotNull(result);
         
         assertTrue(result instanceof CorbaPrimitiveHandler);
@@ -221,7 +221,7 @@
             XMLEventFactory factory = XMLEventFactory.newInstance();
             StartElement startEl = factory.createStartElement(obj.getName(), null, null);
             evtWriter.add(startEl);
-            staxObject.writeArrayToStax(obj, evtWriter, factory);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             EndElement endEl = factory.createEndElement(obj.getName(), null);
             evtWriter.add(endEl);
             evtWriter.flush();
@@ -240,9 +240,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler result = staxObject.readArrayFromStax(evtReader, 
-                                                                  obj.getIdlType(), 
-                                                                  obj.getTypeCode());
+        CorbaObjectHandler result = staxObject.readObjectFromStax(evtReader, 
+                                                                  obj.getIdlType());
         assertNotNull(result);
         
         assertTrue(result instanceof CorbaArrayHandler);
@@ -292,7 +291,7 @@
         
         try {
             XMLEventFactory factory = XMLEventFactory.newInstance();
-            staxObject.writeEnumToStax(obj, evtWriter, factory);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             evtWriter.flush();
         } catch (XMLStreamException ex) {
             
@@ -309,9 +308,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler resultObj = staxObject.readEnumFromStax(evtReader, 
-                                                                    obj.getIdlType(), 
-                                                                    obj.getTypeCode());
+        CorbaObjectHandler resultObj = staxObject.readObjectFromStax(evtReader, 
+                                                                     obj.getIdlType());
         assertNotNull(resultObj);
         
         assertTrue(resultObj instanceof CorbaEnumHandler);
@@ -351,7 +349,7 @@
         
         try {
             XMLEventFactory factory = XMLEventFactory.newInstance();
-            staxObject.writeFixedToStax(obj, evtWriter, factory);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             evtWriter.flush();
         } catch (XMLStreamException ex) {
             
@@ -368,9 +366,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler resultObj = staxObject.readFixedFromStax(evtReader, 
-                                                                     obj.getIdlType(), 
-                                                                     obj.getTypeCode());
+        CorbaObjectHandler resultObj = staxObject.readObjectFromStax(evtReader, 
+                                                                     obj.getIdlType());
         assertNotNull(resultObj);
         
         assertTrue(resultObj instanceof CorbaFixedHandler);
@@ -421,16 +418,12 @@
         
         try {
             XMLEventFactory factory = XMLEventFactory.newInstance();
-            StartElement startEl = factory.createStartElement(objName, null, null);
-            evtWriter.add(startEl);
-            staxObject.writeSequenceToStax(obj, evtWriter, factory, true);
-            EndElement endEl = factory.createEndElement(obj.getName(), null);
-            evtWriter.add(endEl);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             evtWriter.flush();
         } catch (XMLStreamException ex) {
             
         }
-
+        System.out.println(new String(outStream.toByteArray()));
         ByteArrayInputStream inStream = new ByteArrayInputStream(outStream.toByteArray());        
         XMLEventReader evtReader = null;
         try {            
@@ -442,10 +435,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler result = staxObject.readSequenceFromStax(evtReader, 
-                                                                    obj.getIdlType(), 
-                                                                    obj.getTypeCode(),
-                                                                    true);
+        CorbaObjectHandler result = staxObject.readObjectFromStax(evtReader, 
+                                                                  obj.getIdlType());
         assertNotNull(result);
         
         assertTrue(result instanceof CorbaSequenceHandler);
@@ -519,7 +510,7 @@
         
         try {
             XMLEventFactory factory = XMLEventFactory.newInstance();
-            staxObject.writeStructToStax(obj, evtWriter, factory);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             evtWriter.flush();
         } catch (XMLStreamException ex) {
             
@@ -536,9 +527,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler resultObj = staxObject.readStructFromStax(evtReader, 
-                                                                     obj.getIdlType(), 
-                                                                     obj.getTypeCode());
+        CorbaObjectHandler resultObj = staxObject.readObjectFromStax(evtReader, 
+                                                                     obj.getIdlType());
         assertNotNull(resultObj);
         
         assertTrue(resultObj instanceof CorbaStructHandler);
@@ -616,7 +606,7 @@
         
         try {
             XMLEventFactory factory = XMLEventFactory.newInstance();
-            staxObject.writeUnionToStax(obj, evtWriter, factory);
+            staxObject.writeObjectToStax(obj, evtWriter, factory);
             evtWriter.flush();
         } catch (XMLStreamException ex) {
             
@@ -633,9 +623,8 @@
         }
         assertNotNull(evtReader);
         
-        CorbaObjectHandler resultObj = staxObject.readUnionFromStax(evtReader, 
-                                                                     obj.getIdlType(), 
-                                                                     obj.getTypeCode());
+        CorbaObjectHandler resultObj = staxObject.readObjectFromStax(evtReader, 
+                                                                     obj.getIdlType());
         assertNotNull(resultObj);
         
         assertTrue(resultObj instanceof CorbaUnionHandler);

Modified: incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java (original)
+++ incubator/yoko/trunk/bindings/src/test/java/org/apache/yoko/bindings/corba/CorbaTypeTest.java Fri Jan 26 10:31:23 2007
@@ -89,6 +89,7 @@
     }
 
     public void testSimpleAll() throws Exception {
+        //super.testSimpleAll();
     }
 
     public void testSimpleChoice() throws Exception {

Modified: incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaHelper.java
URL: http://svn.apache.org/viewvc/incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaHelper.java?view=diff&rev=500299&r1=500298&r2=500299
==============================================================================
--- incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaHelper.java (original)
+++ incubator/yoko/trunk/tools/src/main/java/org/apache/yoko/tools/processors/wsdl/WSDLToCorbaHelper.java Fri Jan 26 10:31:23 2007
@@ -358,13 +358,10 @@
         throws Exception {
         CorbaTypeImpl type = null;
         QName seqName = null;
-
         if (schemaTypeName == null) {
-            seqName = createQNameTargetNamespace(defaultName.getLocalPart() + "SequenceStruct");        
+            seqName = createQNameCorbaNamespace(defaultName.getLocalPart() + "SequenceStruct");        
         } else {        
-            seqName = createQName(schemaTypeName.getNamespaceURI(),
-                                  schemaTypeName.getLocalPart() + "SequenceStruct", 
-                                  schemaTypeName.getPrefix());
+            seqName = createQNameCorbaNamespace(schemaTypeName.getLocalPart() + "SequenceStruct");
         }
         
         schemaTypeName = checkPrefix(schemaTypeName);



Mime
View raw message