You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by am...@apache.org on 2007/02/26 14:39:43 UTC

svn commit: r511803 [1/2] - in /webservices/axis2/trunk/java/modules: adb-codegen/ adb-codegen/src/org/apache/axis2/schema/ adb-codegen/src/org/apache/axis2/schema/template/ adb-codegen/src/org/apache/axis2/schema/writer/ adb-codegen/test-resources/tes...

Author: amilas
Date: Mon Feb 26 05:39:42 2007
New Revision: 511803

URL: http://svn.apache.org/viewvc?view=rev&rev=511803
Log:
Changed the WSDL11ToAxisServiceBuilder to support the soap bindings according to the basic profile.
Added the support for choice elements within an sequence.

Added:
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innersequence_choice.xsd
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/
    webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/maven.xml
    webservices/axis2/trunk/java/modules/adb-codegen/pom.xml
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
    webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd
    webservices/axis2/trunk/java/modules/integration/maven.xml
    webservices/axis2/trunk/java/modules/integration/test-resources/rpc/test-rpc-2.wsdl
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
    webservices/axis2/trunk/java/modules/xmlbeans/src/org/apache/axis2/xmlbeans/CodeGenerationUtility.java

Modified: webservices/axis2/trunk/java/modules/adb-codegen/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/maven.xml?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/maven.xml Mon Feb 26 05:39:42 2007
@@ -239,7 +239,16 @@
             <arg file="${testsuite.source.dir}/element_references.xsd"/>
             <arg file="${schema.generated.src.dir}"/>
         </java>
-
+      <!-- ################################################################### -->
+        <!-- All simple derived types xsd -->
+        <ant:echo>Compiling innersequence_choice.xsd</ant:echo>
+        <java classname="org.apache.axis2.schema.XSD2Java" fork="true">
+            <jvmarg line="${maven.junit.jvmargs}"/>
+            <classpath refid="maven.dependency.classpath"/>
+            <classpath location="${compiled.classes.dir}"/>
+            <arg file="${testsuite.source.dir}/innersequence_choice.xsd"/>
+            <arg file="${schema.generated.src.dir}"/>
+        </java>
 
         <!-- ################################################################### -->
         <!-- Compile the generated classes -->

Modified: webservices/axis2/trunk/java/modules/adb-codegen/pom.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/pom.xml?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/pom.xml (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/pom.xml Mon Feb 26 05:39:42 2007
@@ -331,6 +331,16 @@
             <arg file="${testsuite.source.dir}/element_references.xsd"/>
             <arg file="${schema.generated.src.dir}"/>
         </java>
+<!-- ################################################################### -->
+        <!-- All simple derived types xsd -->
+        <ant:echo>Compiling innersequence_choice.xsd</ant:echo>
+        <java classname="org.apache.axis2.schema.XSD2Java" fork="true">
+            <jvmarg line="${maven.junit.jvmargs}"/>
+            <classpath refid="maven.dependency.classpath"/>
+            <classpath location="${compiled.classes.dir}"/>
+            <arg file="${testsuite.source.dir}/innersequence_choice.xsd"/>
+            <arg file="${schema.generated.src.dir}"/>
+        </java>
 
 
 			  </tasks>

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/BeanWriterMetaInfoHolder.java Mon Feb 26 05:39:42 2007
@@ -386,6 +386,18 @@
     }
 
     /**
+     *
+     * @param qName
+     * @return is this a inner choice
+     */
+
+    public boolean getInnerChoiceStatusForQName(QName qName){
+        Integer state = (Integer) specialTypeFlagMap.get(qName);
+        return state != null && getStatus(state.intValue(),
+                SchemaConstants.INNER_CHOICE_ELEMENT);
+    }
+
+    /**
      * Gets whether a given QName refers to Simple Type.
      *
      * @param qName

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java Mon Feb 26 05:39:42 2007
@@ -325,7 +325,7 @@
                     //process simple type
                     processSimpleSchemaType((XmlSchemaSimpleType) schemaType,
                             null,
-                            schema,null);
+                            schema, null);
                 }
             }
         }
@@ -1003,7 +1003,7 @@
                     }
                 } else if (type instanceof XmlSchemaSimpleType) {
                     //process simple type
-                    processSimpleSchemaType((XmlSchemaSimpleType) type, null, parentSchema,null);
+                    processSimpleSchemaType((XmlSchemaSimpleType) type, null, parentSchema, null);
                 }
             }
 
@@ -1184,7 +1184,7 @@
                 }
 
                 // we have to copy the list type data to parent if it is a list
-                if (baseMetaInfoHolder.isList()){
+                if (baseMetaInfoHolder.isList()) {
                     metaInfHolder.setList(true);
                     metaInfHolder.setItemTypeQName(baseMetaInfoHolder.getItemTypeQName());
                     metaInfHolder.setItemTypeClassName(baseMetaInfoHolder.getItemTypeClassName());
@@ -1222,7 +1222,7 @@
                     }
                 } else if (type instanceof XmlSchemaSimpleType) {
                     //process simple type
-                    processSimpleSchemaType((XmlSchemaSimpleType) type, null, parentSchema,null);
+                    processSimpleSchemaType((XmlSchemaSimpleType) type, null, parentSchema, null);
                 }
             }
 
@@ -1264,7 +1264,7 @@
                     }
                 } else if (type instanceof XmlSchemaSimpleType) {
                     //process simple type
-                    processSimpleSchemaType((XmlSchemaSimpleType) type, null, parentSchema,null);
+                    processSimpleSchemaType((XmlSchemaSimpleType) type, null, parentSchema, null);
                 }
             }
             //process restriction base type
@@ -1397,7 +1397,7 @@
                 XmlSchemaPatternFacet pattern = (XmlSchemaPatternFacet) obj;
                 // some patterns contain \ so we have to replace them
                 String patternString = pattern.getValue().toString();
-                metaInfHolder.setPatternFacet(patternString.replaceAll("\\\\","\\\\\\\\"));
+                metaInfHolder.setPatternFacet(patternString.replaceAll("\\\\", "\\\\\\\\"));
             }
 
             else if (obj instanceof XmlSchemaEnumerationFacet) {
@@ -1509,7 +1509,7 @@
                         if (simpleType.getContent() instanceof XmlSchemaSimpleTypeRestriction) {
                             if (!isAlreadyProcessed(schemaTypeName)) {
                                 //process simple type
-                                processSimpleSchemaType(simpleType, null, parentSchema,null);
+                                processSimpleSchemaType(simpleType, null, parentSchema, null);
                             }
                             metainf.registerMapping(att.getQName(),
                                     schemaTypeName,
@@ -1616,10 +1616,15 @@
         Map processedElementTypeMap = new LinkedHashMap();
         List localNillableList = new ArrayList();
 
+        // this list is used to keep the details of the
+        // elements within a choice withing sequence
+        List innerChoiceElementList = new ArrayList();
+
         Map elementOrderMap = new HashMap();
 
+        int sequenceCounter = 0;
         for (int i = 0; i < count; i++) {
-            XmlSchemaObject item = items.getItem(i);
+            XmlSchemaObject item = items.getItem(sequenceCounter);
 
             if (item instanceof XmlSchemaElement) {
                 //recursively process the element
@@ -1631,7 +1636,7 @@
                 if (order) {
                     //we need to keep the order of the elements. So push the elements to another
                     //hashmap with the order number
-                    elementOrderMap.put(xsElt, new Integer(i));
+                    elementOrderMap.put(xsElt, new Integer(sequenceCounter));
                 }
 
                 //handle xsd:any ! We place an OMElement (or an array of OMElements) in the generated class
@@ -1640,16 +1645,42 @@
                 processedElementTypeMap.put(new QName(ANY_ELEMENT_FIELD_NAME), any);
                 //any can also be inside a sequence
                 if (order) {
-                    elementOrderMap.put(any, new Integer(i));
+                    elementOrderMap.put(any, new Integer(sequenceCounter));
                 }
                 //we do not register the array status for the any type
                 processedElementArrayStatusMap.put(any, isArray(any) ? Boolean.TRUE : Boolean.FALSE);
+            } else if (order && (item instanceof XmlSchemaChoice)) {
+
+                // this is a tempory patch for process only inner sequence choices
+                // but we have do this with a proper design
+                XmlSchemaChoice choice = (XmlSchemaChoice) item;
+                XmlSchemaObject choiceChild;
+                XmlSchemaObjectCollection schemaItems = choice.getItems();
+                for (int j = 0; j < schemaItems.getCount(); j++) {
+                   choiceChild = schemaItems.getItem(j);
+                   if (choiceChild instanceof XmlSchemaElement){
+                       // i.e this is an inner choice element
+                       //recursively process the element
+                        XmlSchemaElement xsElt = (XmlSchemaElement) choiceChild;
+
+                        boolean isArray = isArray(xsElt);
+                        processElement(xsElt, processedElementTypeMap, localNillableList, parentSchema); //we know for sure this is not an outer type
+                        processedElementArrayStatusMap.put(xsElt, (isArray) ? Boolean.TRUE : Boolean.FALSE);
+                        if (order) {
+                            //we need to keep the order of the elements. So push the elements to another
+                            //hashmap with the order number
+                            elementOrderMap.put(xsElt, new Integer(sequenceCounter));
+                            sequenceCounter++;
+                        }
+                       innerChoiceElementList.add(xsElt.getQName());
+                   }
+                }
+
             } else {
                 //there may be other types to be handled here. Add them
                 //when we are ready
             }
-
-
+          sequenceCounter++;
         }
 
         // loop through the processed items and add them to the matainf object
@@ -1675,6 +1706,9 @@
                                 ((Boolean) processedElementArrayStatusMap.get(elt)).booleanValue() ?
                                         SchemaConstants.ARRAY_TYPE :
                                         SchemaConstants.ELEMENT_TYPE);
+                        if (innerChoiceElementList.contains(referencedQName)){
+                            metainfHolder.addtStatus(referencedQName,SchemaConstants.INNER_CHOICE_ELEMENT);
+                        }
                     }
                 }
 
@@ -1772,7 +1806,7 @@
     private XmlSchemaType getType(XmlSchema schema, QName schemaTypeName) throws SchemaCompilationException {
         // first check with the current parent schema
         XmlSchemaType typeByName = schema.getTypeByName(schemaTypeName);
-        if (typeByName == null){
+        if (typeByName == null) {
             // try to resolve schema using the target names space
             schema = resolveParentSchema(schemaTypeName, schema);
             typeByName = schema.getTypeByName(schemaTypeName);
@@ -1811,7 +1845,7 @@
 
     private XmlSchemaElement getReferencedElement(XmlSchema parentSchema, QName referencedQName)
             throws SchemaCompilationException {
-        XmlSchema schema = resolveParentSchema(referencedQName,parentSchema);
+        XmlSchema schema = resolveParentSchema(referencedQName, parentSchema);
         XmlSchemaElement refElement = schema.getElementByName(referencedQName);
         if (refElement == null) {
             // The referenced element seems to come from an imported
@@ -1866,11 +1900,10 @@
     }
 
     /**
-     *
      * @param simpleType
      * @param xsElt
      * @param parentSchema
-     * @param qname  - fake Qname to use if the xsElt is null.
+     * @param qname        - fake Qname to use if the xsElt is null.
      * @throws SchemaCompilationException
      */
     private void processSimpleSchemaType(XmlSchemaSimpleType simpleType,
@@ -1893,7 +1926,7 @@
         } else {
 
             QName fakeQname;
-            if (xsElt != null){
+            if (xsElt != null) {
                 fakeQname = new QName(xsElt.getQName().getNamespaceURI(), xsElt.getQName().getLocalPart());
                 // we have to set this otherwise the ours attribute would not set properly if refered to this simple
                 // type from any other element
@@ -1922,7 +1955,7 @@
         if (simpleType.getQName() == null) {
             this.processedAnonymousComplexTypesMap.put(xsElt, metaInfHolder);
             QName fakeQname;
-            if (xsElt != null){
+            if (xsElt != null) {
                 fakeQname = new QName(xsElt.getQName().getNamespaceURI(), xsElt.getQName().getLocalPart());
             } else {
                 fakeQname = qname;
@@ -1970,7 +2003,7 @@
                     XmlSchemaType restrictionBaseType = getType(parentSchema, baseTypeName);
                     if (restrictionBaseType instanceof XmlSchemaSimpleType) {
                         if ((restrictionBaseType != null) && (!isAlreadyProcessed(baseTypeName))) {
-                            processSimpleSchemaType((XmlSchemaSimpleType) restrictionBaseType, null, parentSchema,null);
+                            processSimpleSchemaType((XmlSchemaSimpleType) restrictionBaseType, null, parentSchema, null);
                         }
                         // process restriction
                         processSimpleRestrictionBaseType(parentSimpleTypeQname, restriction.getBaseTypeName(), metaInfHolder, parentSchema);
@@ -1981,7 +2014,7 @@
             } else if (content instanceof XmlSchemaSimpleTypeUnion) {
                 XmlSchemaSimpleTypeUnion simpleTypeUnion = (XmlSchemaSimpleTypeUnion) content;
                 QName[] qnames = simpleTypeUnion.getMemberTypesQNames();
-                if (qnames != null){
+                if (qnames != null) {
                     QName qname;
                     for (int i = 0; i < qnames.length; i++) {
                         qname = qnames[i];
@@ -1992,7 +2025,7 @@
                             if (type instanceof XmlSchemaSimpleType) {
                                 XmlSchemaSimpleType memberSimpleType = (XmlSchemaSimpleType) type;
                                 if (!isAlreadyProcessed(qname)) {
-                                    processSimpleSchemaType(memberSimpleType, null, parentSchema,null);
+                                    processSimpleSchemaType(memberSimpleType, null, parentSchema, null);
                                 }
                                 metaInfHolder.addMemberType(qname, (String) processedTypemap.get(qname));
                             } else {
@@ -2005,19 +2038,19 @@
                     XmlSchemaObject xmlSchemaObject;
                     QName childQname;
                     int i = 1;
-                    for (Iterator iter = xmlSchemaObjectCollection.getIterator();iter.hasNext();){
+                    for (Iterator iter = xmlSchemaObjectCollection.getIterator(); iter.hasNext();) {
                         xmlSchemaObject = (XmlSchemaObject) iter.next();
                         i++;
-                        if (xmlSchemaObject instanceof XmlSchemaSimpleType){
+                        if (xmlSchemaObject instanceof XmlSchemaSimpleType) {
                             XmlSchemaSimpleType unionSimpleType = (XmlSchemaSimpleType) xmlSchemaObject;
                             childQname = unionSimpleType.getQName();
-                            if (childQname == null){
+                            if (childQname == null) {
                                 // we create a fake Qname for all these simple types since most propably they don't have one
-                                childQname = new QName(parentSimpleTypeQname.getNamespaceURI(),parentSimpleTypeQname.getLocalPart() + "_type" + i);
+                                childQname = new QName(parentSimpleTypeQname.getNamespaceURI(), parentSimpleTypeQname.getLocalPart() + "_type" + i);
                             }
                             // this is an inner simple type of the union so it shold not have
                             // processed
-                            processSimpleSchemaType(unionSimpleType,null,parentSchema,childQname);
+                            processSimpleSchemaType(unionSimpleType, null, parentSchema, childQname);
                             metaInfHolder.addMemberType(childQname, (String) processedTypemap.get(childQname));
                         }
 
@@ -2030,25 +2063,25 @@
                 XmlSchemaSimpleTypeList simpleTypeList = (XmlSchemaSimpleTypeList) content;
                 QName itemTypeQName = simpleTypeList.getItemTypeName();
 
-                if (itemTypeQName != null){
-                   if (!isAlreadyProcessed(itemTypeQName)){
-                        XmlSchemaType simpleSchemaType = getType(parentSchema,itemTypeQName);
-                        if (simpleSchemaType instanceof XmlSchemaSimpleType){
-                            processSimpleSchemaType((XmlSchemaSimpleType)simpleSchemaType,null,parentSchema,null);
+                if (itemTypeQName != null) {
+                    if (!isAlreadyProcessed(itemTypeQName)) {
+                        XmlSchemaType simpleSchemaType = getType(parentSchema, itemTypeQName);
+                        if (simpleSchemaType instanceof XmlSchemaSimpleType) {
+                            processSimpleSchemaType((XmlSchemaSimpleType) simpleSchemaType, null, parentSchema, null);
                         }
                     }
                 } else {
                     XmlSchemaSimpleType listSimpleType = simpleTypeList.getItemType();
                     itemTypeQName = listSimpleType.getQName();
-                    if (itemTypeQName == null){
+                    if (itemTypeQName == null) {
                         // we create a fake Qname for all these simple types since most propably they don't have one
-                        itemTypeQName = new QName(parentSimpleTypeQname.getNamespaceURI(),parentSimpleTypeQname.getLocalPart() + "_type0");
+                        itemTypeQName = new QName(parentSimpleTypeQname.getNamespaceURI(), parentSimpleTypeQname.getLocalPart() + "_type0");
                     }
-                    processSimpleSchemaType(listSimpleType,null,parentSchema,itemTypeQName);
+                    processSimpleSchemaType(listSimpleType, null, parentSchema, itemTypeQName);
 
                 }
 
-                String className = findClassName(itemTypeQName,false);
+                String className = findClassName(itemTypeQName, false);
                 metaInfHolder.setList(true);
                 metaInfHolder.setItemTypeQName(itemTypeQName);
                 metaInfHolder.setItemTypeClassName(className);

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaConstants.java Mon Feb 26 05:39:42 2007
@@ -88,6 +88,7 @@
     public static final int BINARY_TYPE = 0x10;
     public static final int OPTIONAL_TYPE = 0x20;
     public static final int SIMPLE_TYPE_OR_CONTENT = 0x40;
+    public static final int INNER_CHOICE_ELEMENT = 0x80;
 
     public static class SchemaPropertyNames{
 

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/template/ADBBeanTemplate.xsl Mon Feb 26 05:39:42 2007
@@ -83,13 +83,15 @@
             </xsl:otherwise>
         </xsl:choose>
 
-        <xsl:if test="$choice">
+        <xsl:if test="$choice or (count(property[@innerchoice='yes']) > 0)">
             /** Whenever a new property is set ensure all others are unset
              *  There can be only one choice and the last one wins
              */
             private void clearAllSettingTrackers() {
             <xsl:for-each select="property">
-                local<xsl:value-of select="@javaname"/>Tracker = false;
+                <xsl:if test="$choice or (@innerchoice='yes')">
+                   local<xsl:value-of select="@javaname"/>Tracker = false;
+                </xsl:if>
            </xsl:for-each>
             }
         </xsl:if>
@@ -182,10 +184,10 @@
                          <!-- call the validator-->
                                 validate<xsl:value-of select="$javaName"/>(param);
 
-                         <xsl:if test="$choice">
+                         <xsl:if test="$choice or (@innerchoice='yes')">
                               clearAllSettingTrackers();
                          </xsl:if>
-                         <xsl:if test="$min=0 or $choice">
+                         <xsl:if test="$min=0 or $choice or (@innerchoice='yes')">
                             <!-- the updating of setting tracker for null values should
                                  happen if the attribute is marked as nillable. Else
                                  the user can set a null value and it is never marked
@@ -300,7 +302,7 @@
                         <xsl:if test="not(enumFacet)">
                         <!-- Generate a tracker only if the min occurs is zero, which means if the user does
                            not bother to set that value, we do not send it -->
-                           <xsl:if test="$min=0 or $choice">
+                           <xsl:if test="$min=0 or $choice or (@innerchoice='yes')">
                            /*  This tracker boolean wil be used to detect whether the user called the set method
                           *   for this attribute. It will be used to determine whether to include this field
                            *   in the serialized XML
@@ -348,10 +350,10 @@
                               <!-- call the validator-->
                                    validate<xsl:value-of select="$javaName"/>(param);
 
-                               <xsl:if test="$choice">
+                               <xsl:if test="$choice or (@innerchoice='yes')">
                                    clearAllSettingTrackers();
                                </xsl:if>
-                               <xsl:if test="$min=0 or $choice">
+                               <xsl:if test="$min=0 or $choice or (@innerchoice='yes')">
                                    <!-- the updating of setting tracker for null values should
                                      happen if the attribute is marked as nillable. Else
                                      the user can set a null value and it is never marked
@@ -402,10 +404,10 @@
                                    <xsl:value-of select="$varName"/> = new <xsl:value-of select="$propertyType"/>{};
                                    }
 
-                            <xsl:if test="$choice">
+                            <xsl:if test="$choice or (@innerchoice='yes')">
                                    clearAllSettingTrackers();
                             </xsl:if>
-                            <xsl:if test="$min=0 or $choice">
+                            <xsl:if test="$min=0 or $choice or (@innerchoice='yes')">
                                  //update the setting tracker
                                 <xsl:value-of select="$settingTracker"/> = true;
                             </xsl:if>
@@ -429,10 +431,10 @@
                                * @param param <xsl:value-of select="$javaName"/>
                                */
                                public void set<xsl:value-of select="$javaName"/>(<xsl:value-of select="$propertyType"/> param){
-                            <xsl:if test="$choice">
+                            <xsl:if test="$choice or (@innerchoice='yes')">
                                 clearAllSettingTrackers();
                             </xsl:if>
-                            <xsl:if test="$min=0 or $choice">
+                            <xsl:if test="$min=0 or $choice or (@innerchoice='yes')">
                                 <xsl:choose>
                                    <xsl:when test="@primitive and not(@array)">
                                        // setting primitive attribute tracker to true
@@ -891,7 +893,7 @@
                     <xsl:variable name="propertyType"><xsl:value-of select="@type"/></xsl:variable>
                     <xsl:variable name="propertyBaseType"><xsl:value-of select="@arrayBaseType"/></xsl:variable>
 
-                    <xsl:if test="$min=0 or $choice"> if (<xsl:value-of select="$settingTracker"/>){</xsl:if>
+                    <xsl:if test="$min=0 or $choice or (@innerchoice='yes')"> if (<xsl:value-of select="$settingTracker"/>){</xsl:if>
                     <xsl:choose>
                         <xsl:when test="@ours and not(@array) and not(@default)">
                             <xsl:choose>
@@ -1452,7 +1454,7 @@
                              </xsl:if>
                         </xsl:otherwise>
                     </xsl:choose>
-                    <xsl:if test="$min=0 or $choice">}</xsl:if>
+                    <xsl:if test="$min=0 or $choice or (@innerchoice='yes')">}</xsl:if>
 
                 </xsl:for-each>
                    <!-- write the end element for the type-->
@@ -3127,7 +3129,7 @@
                                     }
                                 </xsl:if>
                             </xsl:if>
-                            <xsl:if test="$ordered and $min!=0">
+                            <xsl:if test="$ordered and $min!=0 and not(@innerchoice='yes')">
                                 else{
                                     // A start element we are not expecting indicates an invalid parameter was passed
                                     throw new java.lang.RuntimeException("Unexpected subelement " + reader.getLocalName());

Modified: webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/writer/JavaBeanWriter.java Mon Feb 26 05:39:42 2007
@@ -728,6 +728,10 @@
                 XSLTUtils.addAttribute(model, "inherited", "yes", property);
             }
 
+            if (metainf.getInnerChoiceStatusForQName(name)){
+                XSLTUtils.addAttribute(model, "innerchoice", "yes", property);
+            }
+
             if ((parentMetaInf != null) && metainf.isRestriction() && missingQNames.contains(name)) {
                 // this element details should be there with the parent meta Inf
                 addAttributesToProperty(

Modified: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd (original)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/choice.xsd Mon Feb 26 05:39:42 2007
@@ -18,8 +18,7 @@
     <xsd:element name="myRootElem">
         <xsd:complexType>
             <xsd:sequence>
-                <xsd:element name="Child1" type="xsd:int" >
-                </xsd:element>
+                <xsd:element name="Child1" type="xsd:int" ></xsd:element>
                 <xsd:choice>
                     <xsd:element name="SomeChoice1" type="test1:SomeChoice1_Type" nillable="true" maxOccurs="unbounded"/>
                     <xsd:element name="SomeChoice2" type="test1:SomeChoice2_Type" nillable="true" maxOccurs="unbounded">

Added: webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innersequence_choice.xsd
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innersequence_choice.xsd?view=auto&rev=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innersequence_choice.xsd (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test-resources/testsuite/innersequence_choice.xsd Mon Feb 26 05:39:42 2007
@@ -0,0 +1,48 @@
+<schema elementFormDefault="qualified"
+        xmlns:xs="http://www.w3.org/2001/XMLSchema"
+        xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+        xmlns="http://www.w3.org/2001/XMLSchema"
+        xmlns:tns="org.apache.axis2.test"
+        xmlns:test1="org.apache.axis2.test"
+        targetNamespace="org.apache.axis2.test">
+
+    <xs:element name="TestInnerSequence1">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="sequence1" type="xs:string"/>
+                <xs:element name="sequence2" type="xs:int"/>
+                <xs:choice>
+                    <xs:element name="choice1" type="xs:string"/>
+                    <xs:element name="choice2" type="xs:int"/>
+                </xs:choice>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="TestInnerSequence2">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="sequence1" type="xs:string"/>
+                <xs:element name="sequence2" type="xs:int"/>
+                <xs:choice>
+                    <xs:element name="choice1" type="xs:string" maxOccurs="unbounded"/>
+                    <xs:element name="choice2" type="xs:int" maxOccurs="unbounded"/>
+                </xs:choice>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+    <xs:element name="TestInnerSequence3">
+        <xs:complexType>
+            <xs:sequence>
+                <xs:element name="sequence1" type="xs:string"/>
+                <xs:element name="sequence2" type="xs:int"/>
+                <xs:choice>
+                    <xs:element name="choice1" type="xs:string" maxOccurs="unbounded" nillable="true"/>
+                    <xs:element name="choice2" type="xs:int" maxOccurs="unbounded" nillable="true"/>
+                </xs:choice>
+            </xs:sequence>
+        </xs:complexType>
+    </xs:element>
+
+</schema>
\ No newline at end of file

Added: webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java?view=auto&rev=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java (added)
+++ webservices/axis2/trunk/java/modules/adb-codegen/test/org/apache/axis2/schema/innerChoice/InnerChoiceTest.java Mon Feb 26 05:39:42 2007
@@ -0,0 +1,179 @@
+/*
+ * Copyright 2004,2005 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.axis2.schema.innerChoice;
+
+import junit.framework.TestCase;
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.util.StAXUtils;
+import test.axis2.apache.org.TestInnerSequence1;
+import test.axis2.apache.org.TestInnerSequence2;
+import test.axis2.apache.org.TestInnerSequence3;
+
+import javax.xml.stream.XMLStreamReader;
+import java.io.ByteArrayInputStream;
+
+public class InnerChoiceTest extends TestCase {
+
+    public void testInnerChoice1() {
+        TestInnerSequence1 testSequence = new TestInnerSequence1();
+        testSequence.setSequence1("test sequence");
+        testSequence.setSequence2(3);
+        testSequence.setChoice1("test choice");
+        testSequence.setChoice2(5);
+
+        OMElement omElement = testSequence.getOMElement(TestInnerSequence1.MY_QNAME,
+                OMAbstractFactory.getSOAP12Factory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OMelement ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerSequence1 result = TestInnerSequence1.Factory.parse(xmlReader);
+            assertEquals(result.getSequence1(), "test sequence");
+            assertEquals(result.getSequence2(), 3);
+            assertEquals(result.getChoice2(), 5);
+        } catch (Exception e) {
+            fail();
+        }
+    }
+
+    public void testInnerChoice21() {
+        TestInnerSequence2 testSequence = new TestInnerSequence2();
+        testSequence.setSequence1("sequence");
+        testSequence.setSequence2(3);
+        testSequence.setChoice1(new String[]{"choice1", "choice2"});
+
+        OMElement omElement = testSequence.getOMElement(TestInnerSequence2.MY_QNAME,
+                OMAbstractFactory.getSOAP12Factory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OMelement ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerSequence2 result = TestInnerSequence2.Factory.parse(xmlReader);
+            assertEquals(result.getSequence1(), "sequence");
+            assertEquals(result.getSequence2(), 3);
+            assertTrue(isEqual(result.getChoice1(), new String[]{"choice1", "choice2"}));
+        } catch (Exception e) {
+            fail();
+        }
+    }
+
+    public void testInnerChoice22() {
+        TestInnerSequence2 testSequence = new TestInnerSequence2();
+        testSequence.setSequence1("sequence");
+        testSequence.setSequence2(3);
+        testSequence.setChoice2(new int[]{2, 4});
+
+        OMElement omElement = testSequence.getOMElement(TestInnerSequence2.MY_QNAME,
+                OMAbstractFactory.getSOAP12Factory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OMelement ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerSequence2 result = TestInnerSequence2.Factory.parse(xmlReader);
+            assertEquals(result.getSequence1(), "sequence");
+            assertEquals(result.getSequence2(), 3);
+            assertTrue(isEqual(result.getChoice2(), new int[]{2, 4}));
+        } catch (Exception e) {
+            fail();
+        }
+    }
+
+    public void testInnerChoice31() {
+        TestInnerSequence3 testSequence = new TestInnerSequence3();
+        testSequence.setSequence1("sequence");
+        testSequence.setSequence2(3);
+        testSequence.setChoice1(new String[]{"choice1",null, "choice2"});
+
+        OMElement omElement = testSequence.getOMElement(TestInnerSequence3.MY_QNAME,
+                OMAbstractFactory.getSOAP12Factory());
+        try {
+            String omElementString = omElement.toStringWithConsume();
+            System.out.println("OMelement ==> " + omElementString);
+            XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+            TestInnerSequence3 result = TestInnerSequence3.Factory.parse(xmlReader);
+            assertEquals(result.getSequence1(), "sequence");
+            assertEquals(result.getSequence2(), 3);
+            assertTrue(isEqual(result.getChoice1(), new String[]{"choice1",null, "choice2"}));
+        } catch (Exception e) {
+            fail();
+        }
+    }
+
+    public void testInnerChoice32() {
+            TestInnerSequence3 testSequence = new TestInnerSequence3();
+            testSequence.setSequence1("sequence");
+            testSequence.setSequence2(3);
+            testSequence.setChoice2(new int[]{2,Integer.MIN_VALUE,6});
+
+            OMElement omElement = testSequence.getOMElement(TestInnerSequence3.MY_QNAME,
+                    OMAbstractFactory.getSOAP12Factory());
+            try {
+                String omElementString = omElement.toStringWithConsume();
+                System.out.println("OMelement ==> " + omElementString);
+                XMLStreamReader xmlReader = StAXUtils.createXMLStreamReader(new ByteArrayInputStream(omElementString.getBytes()));
+                TestInnerSequence3 result = TestInnerSequence3.Factory.parse(xmlReader);
+                assertEquals(result.getSequence1(), "sequence");
+                assertEquals(result.getSequence2(), 3);
+                assertTrue(isEqual(result.getChoice2(), new int[]{2,Integer.MIN_VALUE,6}));
+            } catch (Exception e) {
+                fail();
+            }
+        }
+
+
+    private boolean isEqual(String[] test1, String[] test2) {
+        boolean isEqual = true;
+        if (test1.length != test2.length) {
+            isEqual = false;
+        } else {
+            for (int i = 0; i < test1.length; i++) {
+                if (test1[i] != null) {
+                    if (!test1[i].equals(test2[i])) {
+                        isEqual = false;
+                        break;
+                    }
+                } else {
+                    if (test2[i] != null) {
+                        isEqual = false;
+                        break;
+                    }
+                }
+
+            }
+        }
+
+        return isEqual;
+    }
+
+    private boolean isEqual(int[] test1, int[] test2) {
+        boolean isEqual = true;
+        if (test1.length != test2.length) {
+            isEqual = false;
+        } else {
+            for (int i = 0; i < test1.length; i++) {
+                if (test1[i] != test2[i]) {
+                    isEqual = false;
+                    break;
+                }
+            }
+        }
+
+        return isEqual;
+    }
+
+
+}

Modified: webservices/axis2/trunk/java/modules/integration/maven.xml
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/maven.xml?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Mon Feb 26 05:39:42 2007
@@ -122,7 +122,7 @@
 			  <ant:echo>Running codegen RPC WSDLs - take 3</ant:echo>
 		  <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
 			<classpath refid="maven.dependency.classpath"/>
-			<arg line="-o target/rpc-test3 -uri test-resources/rpc/test-rpc-2.wsdl -uw -d xmlbeans"/>
+			<arg line="-o target/rpc-test3 -uri test-resources/rpc/test-rpc-2.wsdl -uw"/>
 		   </java>
 		  <ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="target/rpc-test3"
 							 target="jar.client"/>
@@ -130,7 +130,7 @@
 			   <ant:echo>Running codegen RPC WSDLs - take 4</ant:echo>
 		  <java classname="org.apache.axis2.wsdl.WSDL2Java" fork="true">
 			<classpath refid="maven.dependency.classpath"/>
-			<arg line="-o target/rpc-test4 -uri test-resources/rpc/test-rpc-2.wsdl -uw -d xmlbeans -ss -sd"/>
+			<arg line="-o target/rpc-test4 -uri test-resources/rpc/test-rpc-2.wsdl -uw -ss -sd"/>
 		   </java>
 		  <ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="target/rpc-test4"
 							 target="jar.server"/>

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/rpc/test-rpc-2.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/rpc/test-rpc-2.wsdl?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/rpc/test-rpc-2.wsdl (original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/rpc/test-rpc-2.wsdl Mon Feb 26 05:39:42 2007
@@ -1,34 +1,38 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:types="http://www.example.com/types" xmlns:y="http://www.example.com" targetNamespace="http://www.example.com">
-	<types></types>
-	<message name="requestMessage">
-		<part name="part1" type="xs:string"/>
-		<part name="part2" type="xs:int"/>
-	</message>
-	<message name="responseMessage">
-		<part name="part1" type="xs:string"/>
-	</message>
-	<portType name="echoPortType">
-		<operation name="echo">
-			<input message="y:requestMessage"/>
-			<output message="y:responseMessage"/>
-		</operation>
-	</portType>
-	<binding name="echoBinding" type="y:echoPortType">
-		<soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
-		<operation name="echo">
-			<soap:operation soapAction="echo"/>
-			<input>
-				<soap:body use="literal"/>
-			</input>
-			<output>
-				<soap:body use="literal"/>
-			</output>
-		</operation>
-	</binding>
-	<service name="serviceName">
-		<port binding="y:echoBinding" name="httpPort">
-			<soap:address location="http://localhost:8080/axis2/services/echo"/>
-		</port>
-	</service>
+<definitions xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
+             xmlns:http="http://schemas.xmlsoap.org/wsdl/http/" xmlns:xs="http://www.w3.org/2001/XMLSchema"
+             xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+             xmlns:mime="http://schemas.xmlsoap.org/wsdl/mime/" xmlns:types="http://www.example.com/types"
+             xmlns:y="http://www.example.com" targetNamespace="http://www.example.com">
+    <types></types>
+    <message name="requestMessage">
+        <part name="part1" type="xs:string"/>
+        <part name="part2" type="xs:int"/>
+    </message>
+    <message name="responseMessage">
+        <part name="part1" type="xs:string"/>
+    </message>
+    <portType name="echoPortType">
+        <operation name="echo">
+            <input message="y:requestMessage"/>
+            <output message="y:responseMessage"/>
+        </operation>
+    </portType>
+    <binding name="echoBinding" type="y:echoPortType">
+        <soap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http"/>
+        <operation name="echo">
+            <soap:operation soapAction="echo"/>
+            <input>
+                <soap:body use="literal"/>
+            </input>
+            <output>
+                <soap:body use="literal"/>
+            </output>
+        </operation>
+    </binding>
+    <service name="serviceName">
+        <port binding="y:echoBinding" name="httpPort">
+            <soap:address location="http://localhost:8080/axis2/services/echo"/>
+        </port>
+    </service>
 </definitions>

Modified: webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java?view=diff&rev=511803&r1=511802&r2=511803
==============================================================================
--- webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java (original)
+++ webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java Mon Feb 26 05:39:42 2007
@@ -1,5 +1,12 @@
 package org.apache.axis2.description;
 
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
 import com.ibm.wsdl.util.xml.DOM2Writer;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.AddressingConstants;
@@ -123,6 +130,8 @@
 
     public static final String DOCUMENT_STYLE = "document";
 
+    public static final String ENCODED_USE = "encoded";
+
     /**
      * Keeps a list of processable operations initiate to an empty list
      */
@@ -227,7 +236,7 @@
             axisService.setTargetNamespace(wsdl4jDefinition.getTargetNamespace());
             axisService.setNameSpacesMap(new NamespaceMap(wsdl4jDefinition.getNamespaces()));
             Service wsdl4jService = findService(wsdl4jDefinition);
-            Binding binding = findBinding(wsdl4jDefinition,wsdl4jService);
+            Binding binding = findBinding(wsdl4jDefinition, wsdl4jService);
 
             if (binding.getPortType() == null) {
                 throw new AxisFault("There is no port type associated with the binding");
@@ -307,7 +316,7 @@
             port = (Port) iterator.next();
             // we process the port only if it has the same port type as the selected binding
             currentBinding = wsdl4jDefinition.getBinding(port.getBinding().getQName());
-            if (currentBinding.getPortType().getQName().equals(binding.getPortType().getQName())){
+            if (currentBinding.getPortType().getQName().equals(binding.getPortType().getQName())) {
                 axisEndpoint = new AxisEndpoint();
                 axisEndpoint.setName(port.getName());
 
@@ -321,7 +330,7 @@
                     populateEndpoint(axisEndpoint, port, false);
                 }
                 axisService.addEndpoint(port.getName(), axisEndpoint);
-                }
+            }
 
         }
 
@@ -378,7 +387,7 @@
         }
 
         // this is used only in codegen to preserve operation order
-        if (isCodegen){
+        if (isCodegen) {
             axisService.setOperationsNameList(operationNames);
         }
 
@@ -426,15 +435,14 @@
 
                 AxisBindingMessage axisBindingInMessage = new AxisBindingMessage();
                 copyExtensibleElements(wsdl4jBindingInput.getExtensibilityElements(), wsdl4jDefinition,
-                                axisBindingInMessage, BINDING_OPERATION_INPUT);
+                        axisBindingInMessage, BINDING_OPERATION_INPUT);
 
                 AxisMessage axisInMessage =
                         axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
 
-                if (isSetMessageQNames){
-                     addQNameReference(axisInMessage, wsdl4jBindingOperation.getOperation(),
-                        wsdl4jBindingInput, wrappableOperations.contains(
-                        wsdl4jBindingOperation.getOperation()));
+                if (isSetMessageQNames) {
+                    addQNameReference(axisInMessage, wsdl4jBindingOperation.getOperation(),
+                            wsdl4jBindingInput, wrappableOperations.contains(wsdl4jBindingOperation));
                 }
 
                 axisBindingInMessage.setAxisMessage(axisInMessage);
@@ -452,12 +460,11 @@
                         axisOperation.getMessage(WSDLConstants.MESSAGE_LABEL_OUT_VALUE);
 
                 copyExtensibleElements(wsdl4jBindingOutput.getExtensibilityElements(), wsdl4jDefinition,
-                                axisBindingOutMessage, BINDING_OPERATION_OUTPUT);
+                        axisBindingOutMessage, BINDING_OPERATION_OUTPUT);
 
-                if (isSetMessageQNames){
-                     addQNameReference(axisOutMessage, wsdl4jBindingOperation.getOperation(),
-                        wsdl4jBindingOutput, wrappableOperations.contains(
-                        wsdl4jBindingOperation.getOperation()));
+                if (isSetMessageQNames) {
+                    addQNameReference(axisOutMessage, wsdl4jBindingOperation.getOperation(),
+                            wsdl4jBindingOutput, wrappableOperations.contains(wsdl4jBindingOperation));
                 }
 
 
@@ -487,8 +494,8 @@
                 axisBindingFaultMessage.setParent(axisBindingOperation);
 
                 axisBindingOperation.addFault(axisBindingFaultMessage);
-                if (isSetMessageQNames){
-                   addQNameReference(faultMessage, wsdl4jFault.getMessage());
+                if (isSetMessageQNames) {
+                    addQNameReference(faultMessage, wsdl4jFault.getMessage());
                 }
             }
             axisBinding.addChild(axisBindingOperation.getName(), axisBindingOperation);
@@ -558,16 +565,17 @@
     }
 
     /**
-     *  return the service to process
-     *  if user has specified we check whether it exists
-     *  else pick a random service and throws an exception if not found any thing
+     * return the service to process
+     * if user has specified we check whether it exists
+     * else pick a random service and throws an exception if not found any thing
+     *
      *
      * @param definition
-     * @return   service to process
+     * @return service to process
      * @throws AxisFault
      */
 
-    private Service findService(Definition definition) throws AxisFault{
+    private Service findService(Definition definition) throws AxisFault {
         Map services = definition.getServices();
         Service service = null;
         if (serviceName != null) {
@@ -579,14 +587,14 @@
             }
         } else {
             if (services.size() > 0) {
-                for(Iterator iter = services.values().iterator(); iter.hasNext();){
+                for (Iterator iter = services.values().iterator(); iter.hasNext();) {
                     service = (Service) iter.next();
-                    if (service.getPorts().size() > 0){
+                    if (service.getPorts().size() > 0) {
                         //i.e we have found a service with ports
                         break;
                     }
                 }
-                if ((service == null) || (service.getPorts().size() == 0)){
+                if ((service == null) || (service.getPorts().size() == 0)) {
                     throw new AxisFault("there is no service with ports to pick");
                 }
 
@@ -606,7 +614,7 @@
      * @param service service can not be null
      * @throws AxisFault
      */
-    private Binding findBinding(Definition dif,Service service) throws AxisFault {
+    private Binding findBinding(Definition dif, Service service) throws AxisFault {
 
         Binding binding = null;
         Port port = null;
@@ -721,7 +729,7 @@
      * @param inMessage
      * @param wsdl4jOperation
      * @param bindingInput
-     * @param isWrapped
+     * @param isWrapped       - basically whether the operation is soap/rpc or not
      */
     private void addQNameReference(AxisMessage inMessage,
                                    Operation wsdl4jOperation, BindingInput bindingInput,
@@ -730,9 +738,14 @@
         List extensibilityElements = bindingInput.getExtensibilityElements();
         Message wsdl4jMessage = wsdl4jOperation.getInput().getMessage();
 
-        addQNameReference(inMessage, wsdl4jOperation, isWrapped, extensibilityElements, wsdl4jMessage);
+        addQNameReference(inMessage,
+                wsdl4jOperation,
+                isWrapped,
+                extensibilityElements,
+                wsdl4jMessage,
+                wsdl4jOperation.getName());
     }
-    
+
     /**
      * Add the QName for the binding output
      *
@@ -751,82 +764,85 @@
             }
             Message wsdl4jMessage = wsdl4jOperation.getOutput().getMessage();
 
-            addQNameReference(outMessage, wsdl4jOperation, isWrapped, extensibilityElements, wsdl4jMessage);
+            addQNameReference(outMessage,
+                    wsdl4jOperation,
+                    isWrapped,
+                    extensibilityElements,
+                    wsdl4jMessage,
+                    wsdl4jOperation.getName() + WRAPPED_OUTPUTNAME_SUFFIX);
         }
     }
 
-    private void addQNameReference(AxisMessage message, Operation wsdl4jOperation, boolean isWrapped, List extensibilityElements, Message wsdl4jMessage) {
-        for (int i = 0; i < extensibilityElements.size(); i++) {
-            ExtensibilityElement extElement = (ExtensibilityElement) extensibilityElements.get(i);
-
-            List bindingPartsList = null;
-            
-            // SOAP 1.1 body element found!
-            if (extElement instanceof SOAPBody) {
-                SOAPBody soapBody = (SOAPBody) extElement;
-                bindingPartsList = soapBody.getParts();
-                
-            } else if (extElement instanceof SOAP12Body) {
-                SOAP12Body soapBody = (SOAP12Body) extElement;
-                bindingPartsList = soapBody.getParts();
-            }
-            
-            if (bindingPartsList != null && !bindingPartsList.isEmpty()) {
-                // we can process a single part only
-                if (bindingPartsList.size() > 1) {
-                    // do something here - perhaps throw and exception
+    private void addQNameReference(AxisMessage message,
+                                   Operation wsdl4jOperation,
+                                   boolean isWrapped,
+                                   List extensibilityElements,
+                                   Message wsdl4jMessage,
+                                   String rpcOperationName) {
+        if (isWrapped) {
+            // we have already validated and process the qname references
+            // so set it here
+            // The schema for this should be already made ! Find the
+            // QName from
+            // the list and add it - the name for this is just the
+            message.setElementQName((QName) resolvedRpcWrappedElementMap
+                    .get(rpcOperationName));
+        } else {
+            // now we are sure this is an document literal type element
+            List bindingPartsList = getPartsListFromSoapBody(extensibilityElements);
+            if (bindingPartsList == null) {
+                // i.e user has not given any part list so we go to message and pick the firest part if
+                // available
+                if ((wsdl4jMessage.getParts() != null) && (wsdl4jMessage.getParts().size() > 0)) {
+                    if (wsdl4jMessage.getParts().size() == 1) {
+                        Part part = (Part) wsdl4jMessage.getParts().values().iterator().next();
+                        QName elementName = part.getElementName();
+                        if (elementName != null) {
+                            message.setElementQName(elementName);
+                        } else {
+                            throw new WSDLProcessingException("No element type is defined for message " +
+                                    wsdl4jMessage.getQName().getLocalPart());
+                        }
+                    } else {
+                        // user has specified more than one parts with out specifing a part in
+                        // soap body
+                        throw new WSDLProcessingException("More than one part for message " +
+                                wsdl4jMessage.getQName().getLocalPart());
+                    }
                 } else {
-                    // find the part from the relevant message
-                    Part wsdl4jMessagePart = wsdl4jMessage
-                            .getPart((String) bindingPartsList.get(0));
-                    // the part name better be there - if not throw an exception
-                    if (wsdl4jMessagePart == null) {
-                        throw new WSDLProcessingException("Missing part named \""
-                                + bindingPartsList.get(0) + "\"");
-                    }
-                    QName name = wsdl4jMessagePart.getElementName();
-                    if (name == null) {
-                        name = wsdl4jMessagePart.getTypeName();
-                    }
-                    if (name == null) {
-                        throw new WSDLProcessingException(
-                                "Element reference / Type name  missing for "
-                                        + bindingPartsList.get(0) + "!");
-                    }
-                    message.setElementQName(wsdl4jMessagePart.getElementName());
-                }
-                // there are no parts named in the binding - process the
-                // items normally
-                // by looking at the single message part - or the wrapped
-                // items if wrapped by us
+                    // this is allowed in the spec in this case element qname is null and nothing is send
+                    // in the soap body
+                    message.setElementQName(null);
+                }
             } else {
-                // for the wrapped types we need to find this from the
-                // wrapper schema map
-                if (isWrapped) {
-                    // The schema for this should be already made ! Find the
-                    // QName from
-                    // the list and add it - the name for this is just the
-                    message
-                            .setElementQName((QName) resolvedRpcWrappedElementMap
-                                    .get(wsdl4jOperation.getName()));
-                } else if (wsdl4jMessage != null) {
-                    // pick the first part from the list and take that as
-                    // the relevant part
-                    // it is somewhat questionnable whether the first part
-                    // gets picked
-                    // but we'll have to take a chance here
-                    Map wsdl4jPartsMap = wsdl4jMessage.getParts();
-                    if (!wsdl4jPartsMap.isEmpty()) {
-                        Part wsdl4jPart = (Part) wsdl4jPartsMap.values()
-                                .toArray()[0];
-                        if (wsdl4jPart.getElementName() != null) {
-                            message.setElementQName(wsdl4jPart
-                                    .getElementName());
+                if (bindingPartsList.size() == 0) {
+                    // we donot have to set the element qname
+                    message.setElementQName(null);
+                } else if (bindingPartsList.size() == 1) {
+                    Part part = wsdl4jMessage.getPart((String) bindingPartsList.get(0));
+                    if (part != null) {
+                        QName elementName = part.getElementName();
+                        if (elementName != null) {
+                            message.setElementQName(elementName);
+                        } else {
+                            throw new WSDLProcessingException("No element type is defined for message" +
+                                    wsdl4jMessage.getQName().getLocalPart());
                         }
+                    } else {
+                        throw new WSDLProcessingException("Missing part named "
+                                + bindingPartsList.get(0) + " ");
                     }
+
+                } else {
+                    // i.e more than one part specified in this case we have
+                    // to send an exception
+                    throw new WSDLProcessingException("More than one element part is not allwed in document literal " +
+                            " type binding operation " + wsdl4jOperation.getName());
                 }
             }
+
         }
+
     }
 
     /**
@@ -1090,12 +1106,11 @@
      *
      * @param wsdl4jBinding
      */
-    private Element[] generateWrapperSchema(Map schemaMap, Binding wsdl4jBinding) {
+    private Element[] generateWrapperSchema(Map schemaMap, Binding wsdl4jBinding){
 
         List schemaElementList = new ArrayList();
         // target namespace for this should be the namespace URI for
         // the porttype
-        PortType portType = wsdl4jBinding.getPortType();
         String porttypeNamespaceURI = wsdl4jBinding.getPortType().getQName().getNamespaceURI();
 
         // //////////////////////////////////////////////////////////////////////
@@ -1107,8 +1122,12 @@
         // list, in which case we'll generate a schema per porttype
         // //////////////////////////////////////////////////////////////////////
 
+        //find wrappable operations return only the operations in rpc style.
+        // i.e if the binding is any thing else than the soap it returns an empty list
+
+        List wrappableBindingOperationsList = findWrappableBindingOperations(wsdl4jBinding);
         Element schemaElement = createSchemaForPorttype(porttypeNamespaceURI,
-                findWrappableOperations(wsdl4jBinding), schemaMap);
+                wrappableBindingOperationsList, schemaMap);
 
         if (schemaElement != null) {
             schemaElementList.add(schemaElement);
@@ -1138,7 +1157,7 @@
         Map messageQnameToMessageMap = new HashMap();
         Map operationToInputMessageMap = new HashMap();
         Map operationToOutputMessageMap = new HashMap();
-        Map faultyOperationsMap = new HashMap();
+
         // this contains the required namespace imports. the key in this
         // map would be the namaspace URI
         Map namespaceImportsMap = new HashMap();
@@ -1156,10 +1175,10 @@
         // //////////////////////////////////////////////////////////////////////////////////////////////////
 
         // we really need to do this for a single porttype!
-        Operation op;
+        BindingOperation op;
         for (int k = 0; k < operationListToProcess.size(); k++) {
-            op = (Operation) operationListToProcess.get(k);
-            Input input = op.getInput();
+            op = (BindingOperation) operationListToProcess.get(k);
+            Input input = op.getOperation().getInput();
             Message message;
             if (input != null) {
                 message = input.getMessage();
@@ -1167,26 +1186,15 @@
                 operationToInputMessageMap.put(op, message);
             }
 
-            Output output = op.getOutput();
+            Output output = op.getOperation().getOutput();
             if (output != null) {
                 message = output.getMessage();
                 messageQnameToMessageMap.put(message.getQName(), message);
                 operationToOutputMessageMap.put(op, message);
             }
 
-            Map faultMap = op.getFaults();
-            if (faultMap != null && faultMap.size() > 0) {
-                Iterator keys = faultMap.keySet().iterator();
-                while (keys.hasNext()) {
-                    Object key = keys.next();
-                    Fault fault = (Fault) faultMap.get(key);
-                    if (fault != null) {
-                        message = fault.getMessage();
-                        messageQnameToMessageMap.put(message.getQName(), message);
-                        faultyOperationsMap.put(key, message);
-                    }
-                }
-            }
+            // we do not want to process fault messages since they can only be used as document type
+            // see basic profile 4.4.2
         }
 
         // /////////////////////////////////////////////////////////////////////////////////////////
@@ -1216,115 +1224,109 @@
         Message wsdl4jMessage;
         // DOM document that will be the ultimate creator
         Document document = getDOMDocumentBuilder().newDocument();
-        for (int i = 0; i < keys.length; i++) {
-            wsdl4jMessage = (Message) messageQnameToMessageMap.get(keys[i]);
-            // No need to check the wrappable,
-
-            // This message is wrappabel. However we need to see whether the
-            // message is already
-            // resolved!
-            if (!resolvedMessageQnames.contains(wsdl4jMessage.getQName())) {
-                // This message has not been touched before!. So we can go ahead
-                // now
-                Map parts = wsdl4jMessage.getParts();
-                Element newComplexType = getNewComplextType(document,
-                        xsdPrefix,
-                        parts.values().iterator(),
-                        namespaceImportsMap,
-                        namespacePrefixMap);
-                // add this newly created complextype to the list
-                complexTypeElementsMap.put(wsdl4jMessage.getQName(),
-                        newComplexType);
-                resolvedMessageQnames.add(wsdl4jMessage.getQName());
-            }
-
-        }
 
         Element elementDeclaration;
 
         //loop through the input op map and generate the elements
-        Operation operation;
+        BindingOperation operation;
         for (Iterator operationsIter = operationToInputMessageMap.keySet().iterator();
-             operationsIter.hasNext();){
-            operation = (Operation) operationsIter.next();
+             operationsIter.hasNext();) {
+            operation = (BindingOperation) operationsIter.next();
             elementDeclaration = document.createElementNS(
                     XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
                     + XML_SCHEMA_ELEMENT_LOCAL_NAME);
             elementDeclaration.setAttribute(XSD_NAME, operation.getName());
-            List parameterOrder = operation.getParameterOrdering();
+
+            //when creating the inner complex type we have to find the parts list from the binding input
+            BindingInput bindingInput = operation.getBindingInput();
             Message message = (Message) operationToInputMessageMap.get(operation);
 
-            Node newComplexType;
-            if ((parameterOrder != null) && (parameterOrder.size() != 0)){
-                // create new complex element according to the parameter order given
-                newComplexType = getNewComplextType(document,
+            if (bindingInput != null) {
+
+                Iterator partsIterator;
+                // first see the body parts list
+                List bodyPartsList = getPartsListFromSoapBody(bindingInput.getExtensibilityElements());
+                if (bodyPartsList != null) {
+                    partsIterator = message.getOrderedParts(bodyPartsList).iterator();
+                } else {
+                    // then see the parameter order
+                    List parameterOrder = operation.getOperation().getParameterOrdering();
+                    if (parameterOrder != null) {
+                        partsIterator = message.getOrderedParts(parameterOrder).iterator();
+                    } else {
+                        // finally get the message part list
+                        partsIterator = message.getParts().values().iterator();
+                    }
+
+                }
+
+                Node newComplexType = getNewComplextType(document,
                         xsdPrefix,
-                        message.getOrderedParts(parameterOrder).iterator(),
+                        partsIterator,
                         namespaceImportsMap,
                         namespacePrefixMap);
 
+                elementDeclaration.appendChild(newComplexType);
+                elementElementsList.add(elementDeclaration);
+                resolvedRpcWrappedElementMap.put(operation.getName(), new QName(
+                        namespaceURI, operation.getName(), AXIS2WRAPPED));
+
             } else {
-                newComplexType = ((Element) complexTypeElementsMap.get(message.getQName())).cloneNode(true);
+                throw new WSDLProcessingException("No binding input is defiend for binding operation ==> "
+                        + operation.getName());
             }
 
-            elementDeclaration.appendChild(newComplexType);
-            elementElementsList.add(elementDeclaration);
-            resolvedRpcWrappedElementMap.put(operation.getName(), new QName(
-                    namespaceURI, operation.getName(), AXIS2WRAPPED));
-
         }
 
         // loop through the output to map and generate the elements
         for (Iterator operationsIterator = operationToOutputMessageMap.keySet().iterator();
-                operationsIterator.hasNext();){
-            operation = (Operation) operationsIterator.next();
+             operationsIterator.hasNext();) {
+            operation = (BindingOperation) operationsIterator.next();
             String baseoutputOpName = operation.getName();
+            // see basic profile 4.7.19
             String outputOpName = baseoutputOpName + WRAPPED_OUTPUTNAME_SUFFIX;
             elementDeclaration = document.createElementNS(
                     XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
                     + XML_SCHEMA_ELEMENT_LOCAL_NAME);
             elementDeclaration.setAttribute(XSD_NAME, outputOpName);
+
+            BindingOutput bindingOutput = operation.getBindingOutput();
             Message message = (Message) operationToOutputMessageMap.get(operation);
-            List parameterOrder = operation.getParameterOrdering();
 
-            Node newComplexType;
-            if ((parameterOrder != null) && (parameterOrder.size() != 0)){
-                // create new complex element according to the parameter order given
-                newComplexType = getNewComplextType(document,
+            if (bindingOutput != null) {
+                Iterator partsIterator;
+                // first see the body parts list
+                List bodyPartsList = getPartsListFromSoapBody(bindingOutput.getExtensibilityElements());
+                if (bodyPartsList != null) {
+                    bodyPartsList.add("result");
+                    partsIterator = message.getOrderedParts(bodyPartsList).iterator();
+                } else {
+                    // then see the parameter order
+                    List parameterOrder = operation.getOperation().getParameterOrdering();
+                    if (parameterOrder != null) {
+                        parameterOrder.add("result");
+                        partsIterator = message.getOrderedParts(parameterOrder).iterator();
+                    } else {
+                        // finally get the message part list
+                        partsIterator = message.getParts().values().iterator();
+                    }
+
+                }
+
+                Node newComplexType = getNewComplextType(document,
                         xsdPrefix,
-                        message.getOrderedParts(parameterOrder).iterator(),
+                        partsIterator,
                         namespaceImportsMap,
                         namespacePrefixMap);
+                elementDeclaration.appendChild(newComplexType);
+                elementElementsList.add(elementDeclaration);
+                resolvedRpcWrappedElementMap.put(outputOpName, new QName(namespaceURI, outputOpName, AXIS2WRAPPED));
 
             } else {
-                newComplexType = ((Element) complexTypeElementsMap.get(message.getQName())).cloneNode(true);
+                throw new WSDLProcessingException("No binding out put is defined for binding operation ==>" +
+                        operation.getName());
             }
 
-            elementDeclaration.appendChild(newComplexType);
-            elementElementsList.add(elementDeclaration);
-            resolvedRpcWrappedElementMap.put(outputOpName, new QName(namespaceURI, outputOpName, AXIS2WRAPPED));
-
-        }
-
-
-        // loop through the faultoutput op map and generate the elements
-        String[] faultyOperationtNames = (String[]) faultyOperationsMap
-                .keySet().toArray(new String[faultyOperationsMap.size()]);
-        for (int j = 0; j < faultyOperationtNames.length; j++) {
-
-            String baseFaultOpName = faultyOperationtNames[j];
-            elementDeclaration = document.createElementNS(
-                    XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-                    + XML_SCHEMA_ELEMENT_LOCAL_NAME);
-            elementDeclaration.setAttribute(XSD_NAME, baseFaultOpName);
-
-            QName typeQName = ((Message) faultyOperationsMap
-                    .get(baseFaultOpName)).getQName();
-            elementDeclaration.appendChild(((Element) complexTypeElementsMap
-                    .get(typeQName)).cloneNode(true));
-            elementElementsList.add(elementDeclaration);
-            resolvedRpcWrappedElementMap.put(baseFaultOpName, new QName(
-                    namespaceURI, baseFaultOpName, AXIS2WRAPPED));
         }
 
         // /////////////////////////////////////////////////////////////////////
@@ -1424,8 +1426,33 @@
         }
     }
 
+    private List getPartsListFromSoapBody(List extensibilityElements) {
+        List partsList = null;
+        ExtensibilityElement extElement;
+        for (Iterator iter = extensibilityElements.iterator(); iter.hasNext();) {
+            extElement = (ExtensibilityElement) iter.next();
+            // SOAP 1.1 body element found!
+            if (extElement instanceof SOAPBody) {
+                SOAPBody soapBody = (SOAPBody) extElement;
+                if ((soapBody.getUse() != null) && (soapBody.getUse().equals(ENCODED_USE))) {
+                    throw new WSDLProcessingException("Encoded use is not supported");
+                }
+                partsList = soapBody.getParts();
+            } else if (extElement instanceof SOAP12Body) {
+                SOAP12Body soapBody = (SOAP12Body) extElement;
+                if ((soapBody.getUse() != null) && (soapBody.getUse().equals(ENCODED_USE))) {
+                    throw new WSDLProcessingException("Encoded use is not supported");
+                }
+                partsList = soapBody.getParts();
+            }
+        }
+        return partsList;
+    }
+
     /**
      * creates a new shema complex element according to the elements sequence difined
+     * this parts list is always for a message refering from the
+     * soap rpc type operation
      *
      * @param document
      * @param xsdPrefix
@@ -1439,7 +1466,7 @@
                                        String xsdPrefix,
                                        Iterator partsIterator,
                                        Map namespaceImportsMap,
-                                       Map namespacePrefixMap) {
+                                       Map namespacePrefixMap){
         // add the complex type
         Element newComplexType = document.createElementNS(
                 XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
@@ -1455,63 +1482,57 @@
             part = (Part) partsIterator.next();
             // the part name
             String elementName = part.getName();
-            boolean isTyped = true;
+
             // the type name
-            QName schemaTypeName;
-            if (part.getTypeName() != null) {
-                schemaTypeName = part.getTypeName();
-            } else if (part.getElementName() != null) {
-                schemaTypeName = part.getElementName();
-                isTyped = false;
-            } else {
-                throw new RuntimeException(" Unqualified Message part!");
-            }
+            QName schemaTypeName = part.getTypeName();
 
-            child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI,
-                    xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+            if (schemaTypeName != null) {
 
-            String prefix;
-            if (XMLSCHEMA_NAMESPACE_URI.equals(schemaTypeName
-                    .getNamespaceURI())) {
-                prefix = xsdPrefix;
-            } else {
-                // this schema is a third party one. So we need to have
-                // an import statement in our generated schema
-                String uri = schemaTypeName.getNamespaceURI();
-                if (!namespaceImportsMap.containsKey(uri)) {
-                    // create Element for namespace import
-                    Element namespaceImport = document.createElementNS(
-                            XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
-                            + XML_SCHEMA_IMPORT_LOCAL_NAME);
-                    namespaceImport.setAttribute(NAMESPACE_URI, uri);
-                    // add this to the map
-                    namespaceImportsMap.put(uri, namespaceImport);
-                    // we also need to associate this uri with a prefix
-                    // and include that prefix
-                    // in the schema's namspace declarations. So add
-                    // theis particular namespace to the
-                    // prefix map as well
-                    prefix = getTemporaryNamespacePrefix();
-                    namespacePrefixMap.put(uri, prefix);
+                child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI,
+                        xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+
+                String prefix;
+                if (XMLSCHEMA_NAMESPACE_URI.equals(schemaTypeName.getNamespaceURI())) {
+                    prefix = xsdPrefix;
                 } else {
-                    // this URI should be already in the namspace prefix
-                    // map
-                    prefix = (String) namespacePrefixMap.get(uri);
+                    // this schema is a third party one. So we need to have
+                    // an import statement in our generated schema
+                    String uri = schemaTypeName.getNamespaceURI();
+                    if (!namespaceImportsMap.containsKey(uri)) {
+                        // create Element for namespace import
+                        Element namespaceImport = document.createElementNS(
+                                XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
+                                + XML_SCHEMA_IMPORT_LOCAL_NAME);
+                        namespaceImport.setAttribute(NAMESPACE_URI, uri);
+                        // add this to the map
+                        namespaceImportsMap.put(uri, namespaceImport);
+                        // we also need to associate this uri with a prefix
+                        // and include that prefix
+                        // in the schema's namspace declarations. So add
+                        // theis particular namespace to the
+                        // prefix map as well
+                        prefix = getTemporaryNamespacePrefix();
+                        namespacePrefixMap.put(uri, prefix);
+                    } else {
+                        // this URI should be already in the namspace prefix
+                        // map
+                        prefix = (String) namespacePrefixMap.get(uri);
+                    }
+
                 }
 
-            }
-            // If it's from a type the element we need to add a name and
-            // the type
-            // if not it's the element reference
-            if (isTyped) {
                 child.setAttribute(XSD_NAME, elementName);
-                child.setAttribute(XSD_TYPE, prefix + ":"
-                        + schemaTypeName.getLocalPart());
+                child.setAttribute(XSD_TYPE, prefix + ":" + schemaTypeName.getLocalPart());
+
+
+                cmplxTypeSequence.appendChild(child);
+
             } else {
-                child.setAttribute(XSD_REF, prefix + ":"
-                        + schemaTypeName.getLocalPart());
+                // see the basic profile 4.4.1 for rpc-literal messages parts can have only types
+                throw new WSDLProcessingException("RPC-literal type message part " +
+                        part.getName() + "should have a type attribute ");
             }
-            cmplxTypeSequence.appendChild(child);
+
         }
         newComplexType.appendChild(cmplxTypeSequence);
         return newComplexType;
@@ -1682,16 +1703,16 @@
                 SOAP12Address soapAddress = (SOAP12Address) wsdl4jExtensibilityElement;
                 SoapAddress address = new SoapAddress();
                 address.setLocation(soapAddress.getLocationURI());
-                if (description instanceof AxisEndpoint){
-                    ((AxisEndpoint)description).setProperty(WSDL2Constants.ATTR_WSOAP_ADDRESS,address);
+                if (description instanceof AxisEndpoint) {
+                    ((AxisEndpoint) description).setProperty(WSDL2Constants.ATTR_WSOAP_ADDRESS, address);
                 }
 
             } else if (wsdl4jExtensibilityElement instanceof SOAPAddress) {
                 SOAPAddress soapAddress = (SOAPAddress) wsdl4jExtensibilityElement;
                 SoapAddress address = new SoapAddress();
                 address.setLocation(soapAddress.getLocationURI());
-                if (description instanceof AxisEndpoint){
-                    ((AxisEndpoint)description).setProperty(WSDL2Constants.ATTR_WSOAP_ADDRESS,address);
+                if (description instanceof AxisEndpoint) {
+                    ((AxisEndpoint) description).setProperty(WSDL2Constants.ATTR_WSOAP_ADDRESS, address);
                 }
 
             } else if (wsdl4jExtensibilityElement instanceof Schema) {
@@ -1765,7 +1786,8 @@
                                 + soapHeader.getPart()
                                 + " not found in the WSDL ");
                     }
-
+                    // see basic profile 4.4.2 Bindings and Faults header, fault and headerfaults
+                    // can only have elements
                     headerMessage.setElement(msgPart.getElementName());
                 }
 
@@ -1775,11 +1797,11 @@
                 if (description instanceof AxisBindingMessage) {
                     AxisBindingMessage bindingMessage = (AxisBindingMessage) description;
                     List soapHeaders = (List) bindingMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER);
-                    if (soapHeaders == null){
+                    if (soapHeaders == null) {
                         soapHeaders = new ArrayList();
-                        bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER,soapHeaders);
+                        bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, soapHeaders);
                     }
-                   soapHeaders.add(headerMessage);
+                    soapHeaders.add(headerMessage);
                 }
 
             } else if (wsdl4jExtensibilityElement instanceof SOAPHeader) {
@@ -1818,11 +1840,11 @@
                 if (description instanceof AxisBindingMessage) {
                     AxisBindingMessage bindingMessage = (AxisBindingMessage) description;
                     List soapHeaders = (List) bindingMessage.getProperty(WSDL2Constants.ATTR_WSOAP_HEADER);
-                    if (soapHeaders == null){
+                    if (soapHeaders == null) {
                         soapHeaders = new ArrayList();
-                        bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER,soapHeaders);
+                        bindingMessage.setProperty(WSDL2Constants.ATTR_WSOAP_HEADER, soapHeaders);
                     }
-                   soapHeaders.add(headerMessage);
+                    soapHeaders.add(headerMessage);
                 }
             } else if (wsdl4jExtensibilityElement instanceof SOAPBinding) {
 
@@ -1860,7 +1882,7 @@
             }
         }
     }
-    
+
     private int getPolicyAttachmentPoint(AxisDescription description,
             String originOfExtensibilityElements) {
         int result = -1; // Attachment Point Not Identified
@@ -1883,9 +1905,10 @@
             // wsdl:binding -> wsdl:operation
             } else {
                 result = PolicyInclude.BINDING_POLICY;
-            } 
+            }
         } else {
             // wsdl:portType -> wsdl:operation -> wsdl:input
+
             if (PORT_TYPE_OPERATION_INPUT.equals(originOfExtensibilityElements)) {
                 result = PolicyInclude.INPUT_POLICY;
             // wsdl:binding -> wsdl:operation -> wsdl:input
@@ -1908,13 +1931,13 @@
         }
         return result;
     }
-    
+
     /**
      * Look for the wrappable operations depending on the style
      *
      * @param binding
      */
-    private List findWrappableOperations(Binding binding) {
+    private List findWrappableBindingOperations(Binding binding) {
         // first find the global style declaration.
         // for a SOAP binding this can be only rpc or document
         // as per the WSDL spec (section 3.4) the default style is document
@@ -1934,6 +1957,16 @@
                 }
 
                 break;
+            } else if (extElements.get(i) instanceof SOAP12Binding) {
+                // we have a global SOAP binding!
+                isSOAPBinding = true;
+                SOAP12Binding soapBinding = (SOAP12Binding) extElements.get(i);
+                if (RPC_STYLE.equals(soapBinding.getStyle())) {
+                    // set the global style to rpc
+                    isRPC = true;
+                }
+
+                break;
             }
         }
 
@@ -1960,11 +1993,11 @@
                 // use the global style to determine whether to put this one or
                 // not
                 if (isRPC) {
-                    returnList.add(bindingOp.getOperation());
+                    returnList.add(bindingOp);
                 }
             } else if (RPC_STYLE.equals(style)) {
                 // add to the list
-                returnList.add(bindingOp.getOperation());
+                returnList.add(bindingOp);
             }
             // if not RPC we just leave it - default is doc
 



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org