axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ami...@apache.org
Subject svn commit: r512599 - in /webservices/axis2/trunk/java/modules: adb-codegen/src/org/apache/axis2/schema/ codegen/src/org/apache/axis2/wsdl/codegen/emitter/ integration/ integration/test-resources/wsdl/ kernel/src/org/apache/axis2/description/
Date Wed, 28 Feb 2007 04:02:55 GMT
Author: amilas
Date: Tue Feb 27 20:02:55 2007
New Revision: 512599

URL: http://svn.apache.org/viewvc?view=rev&rev=512599
Log:
Change the namespace handling when processing the rpc wsdls
Fixed the partName problem in codegen

Modified:
    webservices/axis2/trunk/java/modules/adb-codegen/src/org/apache/axis2/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
    webservices/axis2/trunk/java/modules/integration/maven.xml
    webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/DocumentUnwrappingTest.wsdl
    webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/RPCUnwrappingTest.wsdl
    webservices/axis2/trunk/java/modules/kernel/src/org/apache/axis2/description/WSDL11ToAxisServiceBuilder.java

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=512599&r1=512598&r2=512599
==============================================================================
--- 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
Tue Feb 27 20:02:55 2007
@@ -1624,7 +1624,7 @@
 
         int sequenceCounter = 0;
         for (int i = 0; i < count; i++) {
-            XmlSchemaObject item = items.getItem(sequenceCounter);
+            XmlSchemaObject item = items.getItem(i);
 
             if (item instanceof XmlSchemaElement) {
                 //recursively process the element
@@ -1845,37 +1845,41 @@
 
     private XmlSchemaElement getReferencedElement(XmlSchema parentSchema, QName referencedQName)
             throws SchemaCompilationException {
-        XmlSchema schema = resolveParentSchema(referencedQName, parentSchema);
-        XmlSchemaElement refElement = schema.getElementByName(referencedQName);
-        if (refElement == null) {
-            // The referenced element seems to come from an imported
-            // schema.
-            XmlSchemaObjectCollection includes = schema.getIncludes();
-            if (includes != null) {
-                Iterator tempIterator = includes.getIterator();
-                while (tempIterator.hasNext()) {
-                    Object o = tempIterator.next();
-                    XmlSchema inclSchema = null;
-                    if (o instanceof XmlSchemaImport) {
-                        inclSchema = ((XmlSchemaImport) o).getSchema();
-                        if (inclSchema == null) {
-                            inclSchema = (XmlSchema) loadedSchemaMap.get(((XmlSchemaImport)
o).getNamespace());
+        XmlSchemaElement refElement = parentSchema.getElementByName(referencedQName);
+        if (refElement == null){
+            XmlSchema schema = resolveParentSchema(referencedQName, parentSchema);
+            refElement = schema.getElementByName(referencedQName);
+            if (refElement == null) {
+                // The referenced element seems to come from an imported
+                // schema.
+                XmlSchemaObjectCollection includes = schema.getIncludes();
+                if (includes != null) {
+                    Iterator tempIterator = includes.getIterator();
+                    while (tempIterator.hasNext()) {
+                        Object o = tempIterator.next();
+                        XmlSchema inclSchema = null;
+                        if (o instanceof XmlSchemaImport) {
+                            inclSchema = ((XmlSchemaImport) o).getSchema();
+                            if (inclSchema == null) {
+                                inclSchema = (XmlSchema) loadedSchemaMap.get(((XmlSchemaImport)
o).getNamespace());
+                            }
+                        }
+                        if (o instanceof XmlSchemaInclude) {
+                            inclSchema = ((XmlSchemaInclude) o).getSchema();
+                        }
+                        // get the element from the included schema
+                        if (inclSchema != null) {
+                            refElement = inclSchema.getElementByName(referencedQName);
+                        }
+                        if (refElement != null) {
+                            // we found the referenced element an can break the loop
+                            break;
                         }
-                    }
-                    if (o instanceof XmlSchemaInclude) {
-                        inclSchema = ((XmlSchemaInclude) o).getSchema();
-                    }
-                    // get the element from the included schema
-                    if (inclSchema != null) {
-                        refElement = inclSchema.getElementByName(referencedQName);
-                    }
-                    if (refElement != null) {
-                        // we found the referenced element an can break the loop
-                        break;
                     }
                 }
             }
         }
+
         return refElement;
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java?view=diff&rev=512599&r1=512598&r2=512599
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/AxisServiceBasedMultiLanguageEmitter.java
Tue Feb 27 20:02:55 2007
@@ -2675,9 +2675,13 @@
             paramElement.appendChild(qNameElement);
         }
         if (partName!= null){
-            addAttribute(doc,"partname",
-                    JavaUtils.capitalizeFirstChar(partName),
-                    paramElement);
+            String javaName = null;
+            if (JavaUtils.isJavaKeyword(partName)){
+                javaName = JavaUtils.makeNonJavaKeyword(partName);
+            } else {
+                javaName = JavaUtils.capitalizeFirstChar(JavaUtils.xmlNameToJava(partName));
+            }
+            addAttribute(doc,"partname",javaName,paramElement);
         }
 
         if (isPrimitive) {

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=512599&r1=512598&r2=512599
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/maven.xml (original)
+++ webservices/axis2/trunk/java/modules/integration/maven.xml Tue Feb 27 20:02:55 2007
@@ -39,7 +39,7 @@
             <jvmarg line="${maven.junit.jvmargs}"/>
             <classpath refid="maven.dependency.classpath"/>
             <classpath location="${compiled.classes.dir}"/>
-            <arg line="-o target/wsdl/documentunwrapping -ss -sd -ssi -u -t -g -uw -uri
test-resources/wsdl/DocumentUnwrappingTest.wsdl"/>
+            <arg line="-o target/wsdl/documentunwrapping -ss -sd -ssi -u  -g -uw -uri
test-resources/wsdl/DocumentUnwrappingTest.wsdl"/>
         </java>
         <ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="target/wsdl/documentunwrapping"/>
 
@@ -49,7 +49,7 @@
             <jvmarg line="${maven.junit.jvmargs}"/>
             <classpath refid="maven.dependency.classpath"/>
             <classpath location="${compiled.classes.dir}"/>
-            <arg line="-o target/wsdl/rpcunwrapping -ss -sd -ssi -u -t -g -uw -uri test-resources/wsdl/RPCUnwrappingTest.wsdl"/>
+            <arg line="-o target/wsdl/rpcunwrapping -ss -sd -ssi -u  -g -uw -uri test-resources/wsdl/RPCUnwrappingTest.wsdl"/>
         </java>
         <ant:ant antfile="build.xml" inheritall="true" inheritrefs="true" dir="target/wsdl/rpcunwrapping"/>
 

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/DocumentUnwrappingTest.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/DocumentUnwrappingTest.wsdl?view=diff&rev=512599&r1=512598&r2=512599
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/DocumentUnwrappingTest.wsdl
(original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/DocumentUnwrappingTest.wsdl
Tue Feb 27 20:02:55 2007
@@ -19,7 +19,7 @@
             <xsd:element name="Response1">
                 <xsd:complexType>
                     <xsd:sequence>
-                        <xsd:element name="param1" type="xsd:string"/>
+                        <xsd:element name="return" type="xsd:string"/>
                     </xsd:sequence>
                 </xsd:complexType>
             </xsd:element>

Modified: webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/RPCUnwrappingTest.wsdl
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/RPCUnwrappingTest.wsdl?view=diff&rev=512599&r1=512598&r2=512599
==============================================================================
--- webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/RPCUnwrappingTest.wsdl
(original)
+++ webservices/axis2/trunk/java/modules/integration/test-resources/wsdl/RPCUnwrappingTest.wsdl
Tue Feb 27 20:02:55 2007
@@ -98,19 +98,19 @@
         <wsdl:operation name="Operation1">
             <soap:operation soapAction="http://www.example.org/wsdltest/Operation1"/>
             <wsdl:input>
-                <soap:body use="literal"/>
+                <soap:body use="literal" namespace="http://axis2.org/test1"/>
             </wsdl:input>
             <wsdl:output>
-                <soap:body use="literal"/>
+                <soap:body use="literal" namespace="http://axis2.org/test2"/>
             </wsdl:output>
         </wsdl:operation>
         <wsdl:operation name="Operation2">
             <soap:operation soapAction="http://www.example.org/wsdltest/Operation2"/>
             <wsdl:input>
-                <soap:body use="literal"/>
+                <soap:body use="literal" namespace="http://axis2.org/test1"/>
             </wsdl:input>
             <wsdl:output>
-                <soap:body use="literal"/>
+                <soap:body use="literal" namespace="http://axis2.org/test2"/>
             </wsdl:output>
         </wsdl:operation>
         <wsdl:operation name="Operation3">

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=512599&r1=512598&r2=512599
==============================================================================
--- 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
Tue Feb 27 20:02:55 2007
@@ -928,7 +928,7 @@
      *
      * @param wsdl4jOperation
      * @param dif
-     * @throws Exception
+     * @throws AxisFault
      */
     private AxisOperation populateOperations(Operation wsdl4jOperation,
                                              PortType wsdl4jPortType, Definition dif) throws
AxisFault {
@@ -1128,12 +1128,12 @@
         // 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,
+
+        // this method returns all the new schemas created when processing the rpc messages
+        Map newSchemaMap = createSchemaForPorttype(porttypeNamespaceURI,
                 wrappableBindingOperationsList, schemaMap);
 
-        if (schemaElement != null) {
-            schemaElementList.add(schemaElement);
-        }
+            schemaElementList.addAll(newSchemaMap.values());
         return (Element[]) schemaElementList
                 .toArray(new Element[schemaElementList.size()]);
     }
@@ -1141,16 +1141,20 @@
     /**
      * Create a schema by looking at the port type
      *
-     * @param namespaceURI
+     * @param namespaceURI - namespace of the porttype uri we use this only if a user has
not specified
+     * a namespace in soap:body
      * @return null if there is no element
      */
-    private Element createSchemaForPorttype(String namespaceURI,
+    private Map createSchemaForPorttype(String namespaceURI,
                                             List operationListToProcess, Map existingSchemaMap)
{
+
+        // this map is used to keep the newly added schemas
+        Map newSchemaMap = new HashMap();
         // first of all look at the operations list
         // we can return immediately if we get the operations list
         // as empty
         if (operationListToProcess.isEmpty()) {
-            return null;
+            return newSchemaMap;
         }
 
         // loop through the messages. We'll populate thins map with the relevant
@@ -1162,14 +1166,9 @@
 
         // this contains the required namespace imports. the key in this
         // map would be the namaspace URI
-        Map namespaceImportsMap = new HashMap();
-        // generated complextypes. Keep in the list for writing later
-        // the key for the complexType map is the message QName
-        Map complexTypeElementsMap = new HashMap();
-        // generated Elements. Kep in the list for later writing
-        List elementElementsList = new ArrayList();
+        Map namespaceImportsMap = null;
         // list namespace prefix map. This map will include uri -> prefix
-        Map namespacePrefixMap = new HashMap();
+        Map namespacePrefixMap = null;
 
         // //////////////////////////////////////////////////////////////////////////////////////////////////
         // First thing is to populate the message map with the messages to
@@ -1199,31 +1198,8 @@
             // see basic profile 4.4.2
         }
 
-        // /////////////////////////////////////////////////////////////////////////////////////////
-        // check whether there are messages that are wrappable. If there are no
-        // messages that are wrappable we'll
-        // just return null and endup this process. However we need to take the
-        // force flag into account here
-        // /////////////////////////////////////////////////////////////////////////////////////////
-
-        QName[] keys;
-
-        // just take all the messages and wrap them, we've already selected
-        // the relevant messages by looking at the SOAP binding
-
-        keys = (QName[]) messageQnameToMessageMap.keySet().toArray(
-                new QName[messageQnameToMessageMap.size()]);
-
-        // /////////////////////////////////////////////////////////////////////////////////////////
-        // Now we have the message list to process - Process the whole list of
-        // messages at once
-        // since we need to generate one single schema
-        // /////////////////////////////////////////////////////////////////////////////////////////
-
-        List resolvedMessageQnames = new ArrayList();
         // find the xsd prefix
         String xsdPrefix = findSchemaPrefix();
-        Message wsdl4jMessage;
         // DOM document that will be the ultimate creator
         Document document = getDOMDocumentBuilder().newDocument();
 
@@ -1231,8 +1207,8 @@
 
         //loop through the input op map and generate the elements
         BindingOperation operation;
-        for (Iterator operationsIter = operationToInputMessageMap.keySet().iterator();
-             operationsIter.hasNext();) {
+        for (Iterator operationsIter = operationToInputMessageMap.keySet().iterator(); operationsIter.hasNext();)
{
+
             operation = (BindingOperation) operationsIter.next();
             elementDeclaration = document.createElementNS(
                     XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
@@ -1262,6 +1238,9 @@
 
                 }
 
+                namespaceImportsMap = new HashMap();
+                namespacePrefixMap = new HashMap();
+
                 Node newComplexType = getNewComplextType(document,
                         xsdPrefix,
                         partsIterator,
@@ -1269,9 +1248,36 @@
                         namespacePrefixMap);
 
                 elementDeclaration.appendChild(newComplexType);
-                elementElementsList.add(elementDeclaration);
+                String bodyNamespace = getNamespaceFromSoapBody(bindingInput.getExtensibilityElements());
+                String namespaceToUse = bodyNamespace != null? bodyNamespace: namespaceURI;
+
+                if (existingSchemaMap.containsKey(namespaceToUse)){
+                    // i.e this namespace is already exists with the original wsdl schemas
+                    addElementToAnExistingSchema((Element)existingSchemaMap.get(namespaceToUse),
+                                                elementDeclaration,
+                                                namespacePrefixMap,
+                                                namespaceImportsMap,
+                                                namespaceToUse);
+                } else if (newSchemaMap.containsKey(namespaceToUse)){
+                   // i.e this namespace is with a newly created scheam
+                    addElementToAnExistingSchema((Element)newSchemaMap.get(namespaceToUse),
+                                                elementDeclaration,
+                                                namespacePrefixMap,
+                                                namespaceImportsMap,
+                                                namespaceToUse);
+                } else {
+                    // i.e this element namespace has not found yet so
+                    // we have to create new schema for it
+                    Element newSchema = createNewSchemaWithElemet(elementDeclaration,
+                            namespacePrefixMap,
+                            namespaceImportsMap,
+                            namespaceToUse,
+                            document,
+                            xsdPrefix);
+                    newSchemaMap.put(namespaceToUse,newSchema);
+                }
                 resolvedRpcWrappedElementMap.put(operation.getName(), new QName(
-                        namespaceURI, operation.getName(), AXIS2WRAPPED));
+                        namespaceToUse, operation.getName(), AXIS2WRAPPED));
 
             } else {
                 throw new WSDLProcessingException("No binding input is defiend for binding
operation ==> "
@@ -1315,71 +1321,98 @@
 
                 }
 
+                // we have to initialize the hash maps always since we add the elements onece
we
+                // generate it
+                namespacePrefixMap = new HashMap();
+                namespaceImportsMap = new HashMap();
+
                 Node newComplexType = getNewComplextType(document,
                         xsdPrefix,
                         partsIterator,
                         namespaceImportsMap,
                         namespacePrefixMap);
                 elementDeclaration.appendChild(newComplexType);
-                elementElementsList.add(elementDeclaration);
-                resolvedRpcWrappedElementMap.put(outputOpName, new QName(namespaceURI, outputOpName,
AXIS2WRAPPED));
+
+                String bodyNamespace = getNamespaceFromSoapBody(bindingOutput.getExtensibilityElements());
+                String namespaceToUse = bodyNamespace != null? bodyNamespace: namespaceURI;
+
+                if (existingSchemaMap.containsKey(namespaceToUse)){
+                    // i.e this namespace is already exists with the original wsdl schemas
+                    addElementToAnExistingSchema((Element)existingSchemaMap.get(namespaceToUse),
+                                                elementDeclaration,
+                                                namespacePrefixMap,
+                                                namespaceImportsMap,
+                                                namespaceToUse);
+                } else if (newSchemaMap.containsKey(namespaceToUse)){
+                   // i.e this namespace is with a newly created scheam
+                    addElementToAnExistingSchema((Element)newSchemaMap.get(namespaceToUse),
+                                                elementDeclaration,
+                                                namespacePrefixMap,
+                                                namespaceImportsMap,
+                                                namespaceToUse);
+                } else {
+                    // i.e this element namespace has not found yet so
+                    // we have to create new schema for it
+                    Element newSchema = createNewSchemaWithElemet(elementDeclaration,
+                            namespacePrefixMap,
+                            namespaceImportsMap,
+                            namespaceToUse,
+                            document,
+                            xsdPrefix);
+                    newSchemaMap.put(namespaceToUse,newSchema);
+                }
+                resolvedRpcWrappedElementMap.put(outputOpName, new QName(
+                        namespaceToUse, outputOpName, AXIS2WRAPPED));
 
             } else {
                 throw new WSDLProcessingException("No binding out put is defined for binding
operation ==>" +
                         operation.getName());
             }
-
         }
 
-        // /////////////////////////////////////////////////////////////////////
-        //
-        // Now we are done with processing the messages and generating the right
-        // schema object model
-        // time to write out the schema
-        //
-        // There is a catch here - when the target namespace of the generated
-        // schema is equivalent to one of the existing schemas we'll have to
-        // insert the elements there rather than creating a new Schema element
-        // //////////////////////////////////////////////////////////////////////
-        //
-        if (existingSchemaMap.containsKey(namespaceURI)) {
-            // get the relevant schema element
-            Element schemaElement = (Element) existingSchemaMap
-                    .get(namespaceURI);
-            Document ownerDocument = schemaElement.getOwnerDocument();
-
-            // loop through the namespace declarations first and add them
-            String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap
-                    .keySet().toArray(new String[namespacePrefixMap.size()]);
-            for (int i = 0; i < nameSpaceDeclarationArray.length; i++) {
-                String s = nameSpaceDeclarationArray[i];
-                checkAndAddNamespaceDeclarations(s, namespacePrefixMap,
-                        schemaElement);
-            }
+            return newSchemaMap;
+    }
 
-            // add imports - check whether it is the targetnamespace before
-            // adding
-            Element[] namespaceImports = (Element[]) namespaceImportsMap
-                    .values().toArray(new Element[namespaceImportsMap.size()]);
-            for (int i = 0; i < namespaceImports.length; i++) {
-                if (!namespaceURI.equals(namespaceImports[i]
-                        .getAttribute(NAMESPACE_URI))) {
-                    schemaElement.appendChild(ownerDocument.importNode(
-                            namespaceImports[i], true));
-                }
-            }
+    private void addElementToAnExistingSchema(Element schemaElement,
+                                              Element newElement,
+                                              Map namespacePrefixMap,
+                                              Map namespaceImportsMap,
+                                              String targetNamespace){
+
+        Document ownerDocument = schemaElement.getOwnerDocument();
+
+        // loop through the namespace declarations first and add them
+        String[] nameSpaceDeclarationArray = (String[]) namespacePrefixMap
+                .keySet().toArray(new String[namespacePrefixMap.size()]);
+        for (int i = 0; i < nameSpaceDeclarationArray.length; i++) {
+            String s = nameSpaceDeclarationArray[i];
+            checkAndAddNamespaceDeclarations(s, namespacePrefixMap,
+                    schemaElement);
+        }
 
-            Element[] elementDeclarations = (Element[]) elementElementsList
-                    .toArray(new Element[elementElementsList.size()]);
-            for (int i = 0; i < elementDeclarations.length; i++) {
+        // add imports - check whether it is the targetnamespace before
+        // adding
+        Element[] namespaceImports = (Element[]) namespaceImportsMap
+                .values().toArray(new Element[namespaceImportsMap.size()]);
+        for (int i = 0; i < namespaceImports.length; i++) {
+            if (!targetNamespace.equals(namespaceImports[i]
+                    .getAttribute(NAMESPACE_URI))) {
                 schemaElement.appendChild(ownerDocument.importNode(
-                        elementDeclarations[i], true));
+                        namespaceImports[i], true));
             }
+        }
+
+        schemaElement.appendChild(ownerDocument.importNode(newElement, true));
+
+    }
+
+    private Element createNewSchemaWithElemet(Element newElement,
+                                              Map namespacePrefixMap,
+                                              Map namespaceImportsMap,
+                                              String targetNamespace,
+                                              Document document,
+                                              String xsdPrefix){
 
-            // don't return anything!!
-            return null;
-        } else {
-            // there is no element in the
             Element schemaElement = document.createElementNS(
                     XMLSCHEMA_NAMESPACE_URI, xsdPrefix + ":"
                     + XML_SCHEMA_LOCAL_NAME);
@@ -1394,19 +1427,16 @@
                                 + namespacePrefixMap.get(s).toString(), s);
             }
 
-            if (schemaElement.getAttributeNS(XML_NAMESPACE_URI, xsdPrefix)
-                    .length() == 0) {
+            if (schemaElement.getAttributeNS(XML_NAMESPACE_URI, xsdPrefix).length() == 0)
{
                 schemaElement.setAttributeNS(XML_NAMESPACE_URI,
                         NAMESPACE_DECLARATION_PREFIX + xsdPrefix,
                         XMLSCHEMA_NAMESPACE_URI);
             }
 
             // add the targetNamespace
-            schemaElement.setAttributeNS(XML_NAMESPACE_URI, XMLNS_AXIS2WRAPPED,
-                    namespaceURI);
-            schemaElement.setAttribute(XSD_TARGETNAMESPACE, namespaceURI);
-            schemaElement.setAttribute(XSD_ELEMENT_FORM_DEFAULT,
-                    XSD_UNQUALIFIED);
+            schemaElement.setAttributeNS(XML_NAMESPACE_URI, XMLNS_AXIS2WRAPPED,targetNamespace);
+            schemaElement.setAttribute(XSD_TARGETNAMESPACE, targetNamespace);
+            schemaElement.setAttribute(XSD_ELEMENT_FORM_DEFAULT, XSD_UNQUALIFIED);
 
             // add imports
             Element[] namespaceImports = (Element[]) namespaceImportsMap
@@ -1416,16 +1446,8 @@
 
             }
 
-            // add element declarations
-            Element[] elementDeclarations = (Element[]) elementElementsList
-                    .toArray(new Element[elementElementsList.size()]);
-            for (int i = 0; i < elementDeclarations.length; i++) {
-                schemaElement.appendChild(elementDeclarations[i]);
-
-            }
-
+            schemaElement.appendChild(newElement);
             return schemaElement;
-        }
     }
 
     private List getPartsListFromSoapBody(List extensibilityElements) {
@@ -1451,6 +1473,24 @@
         return partsList;
     }
 
+    private String getNamespaceFromSoapBody(List extensibilityElements){
+
+        ExtensibilityElement extElement;
+        String namespace = null;
+        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;
+                namespace = soapBody.getNamespaceURI();
+            } else if (extElement instanceof SOAP12Body) {
+                SOAP12Body soapBody = (SOAP12Body) extElement;
+                namespace = soapBody.getNamespaceURI();
+            }
+        }
+        return namespace;
+    }
+
     /**
      * creates a new shema complex element according to the elements sequence difined
      * this parts list is always for a message refering from the
@@ -1492,6 +1532,8 @@
 
                 child = document.createElementNS(XMLSCHEMA_NAMESPACE_URI,
                         xsdPrefix + ":" + XML_SCHEMA_ELEMENT_LOCAL_NAME);
+                // always child attribute should be in no namespace
+                child.setAttribute("form","unqualified");
 
                 String prefix;
                 if (XMLSCHEMA_NAMESPACE_URI.equals(schemaTypeName.getNamespaceURI())) {
@@ -2014,7 +2056,7 @@
      * Guess the MEP based on the order of messages
      *
      * @param operation
-     * @throws Exception
+     * @throws AxisFault
      */
     private String getMEP(Operation operation) throws AxisFault {
         OperationType operationType = operation.getStyle();



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


Mime
View raw message