axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aj...@apache.org
Subject svn commit: r328780 - in /webservices/axis2/trunk/java/modules: codegen/src/org/apache/axis2/databinding/schema/ codegen/src/org/apache/axis2/databinding/schema/template/ codegen/src/org/apache/axis2/databinding/schema/util/ codegen/src/org/apache/axis...
Date Thu, 27 Oct 2005 03:55:52 GMT
Author: ajith
Date: Wed Oct 26 20:55:13 2005
New Revision: 328780

URL: http://svn.apache.org/viewcvs?rev=328780&view=rev
Log:
1. Fixed the WSDLpump to make the DOM elements namespace aware. The reason why XMLSchema was
failing is that the created DOM elements were not namespace aware
2.Updated the bean template/BeanTemplate.xsl to put the new ELEMENT_TEXT
3. Added a new attribute to the XML Model fed to the templates. This is to find whether the
typemapped class is the default.
4.Made some optimizations and bug fixes to the StaxWrapper

Now we can generate code for doc/lit and rpc/lit (wrapped). However we do have some limitations
in our schema compiler. 
 I. We do not process extensions
 II. We do not process restrictions

Modified:
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/DefaultTypeMapper.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
    webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
    webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
    webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/SchemaCompiler.java
Wed Oct 26 20:55:13 2005
@@ -138,7 +138,7 @@
                 //this is a named type
                 QName qName = schemaType.getQName();
                 //find the class name
-                String className = findClassName(schemaType,isArray(xsElt));
+                String className = findClassName(qName,isArray(xsElt));
                 metainf.registerMapping(xsElt.getQName(),
                         qName,
                         className);
@@ -183,25 +183,21 @@
         }
 
         XmlSchemaType schemaType = xsElt.getSchemaType();
-
         if (schemaType!=null){
             processSchema(xsElt,schemaType);
-
             //at this time it is not wise to directly write the class for the element
             //so we push the complete element to an arraylist and let the process
             //pass through. We'll be iterating through the elements writing them
             //later
-
-            if (!isOuter){
-                String className = findClassName(schemaType,isArray);
-                this.processedElementMap.put(xsElt.getQName(),className);
-            }
-            this.processedElementList.add(xsElt.getQName());
-
-        }else{
-            //what do we do when the schematype is missing ??
-
         }
+        
+        //There can be instances where the SchemaType is null but the schemaTypeName is not
+        //this specifically happens with xsd:anyType.
+        if (!isOuter){
+            String className = findClassName(xsElt.getSchemaTypeName(),isArray);
+            this.processedElementMap.put(xsElt.getQName(),className);
+        }
+        this.processedElementList.add(xsElt.getQName());
 
     }
 
@@ -210,9 +206,8 @@
      * @param schemaType
      * @return
      */
-    private String findClassName(XmlSchemaType schemaType,boolean isArray) {
+    private String findClassName(QName qName,boolean isArray) {
         //find the class name
-        QName qName = schemaType.getQName();
         String className;
         if (processedTypemap.containsKey(qName)) {
             className = (String)processedTypemap.get(qName);
@@ -442,7 +437,7 @@
             metainfHolder.addMinOccurs(qName,elt.getMinOccurs());
             //we need the order to be preserved. So record the order also
             if (order){
-              //record the order in the metainf holder
+                //record the order in the metainf holder
                 Integer integer = (Integer) elementOrderMap.get(elt);
                 metainfHolder.registerQNameIndex(qName,
                         integer.intValue());

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/template/BeanTemplate.xsl
Wed Oct 26 20:55:13 2005
@@ -90,6 +90,9 @@
                 <xsl:when test="@any">
                             new javax.xml.namespace.QName("<xsl:value-of select="$propertyName"/>"),<xsl:value-of
select="$varName"/>
                 </xsl:when>
+                <xsl:when test="@array">
+                            "<xsl:value-of select="$propertyName"/>",<xsl:value-of
select="$varName"/>
+                </xsl:when>
                 <xsl:otherwise>
                             "<xsl:value-of select="$propertyName"/>",org.apache.axis2.databinding.schema.util.ConverterUtil.convertToString(<xsl:value-of
select="$varName"/>)
                 </xsl:otherwise>
@@ -129,7 +132,8 @@
                 <xsl:variable name="varName">local<xsl:value-of select="@javaname"/></xsl:variable>
             return org.apache.axis2.databinding.utils.ADBPullParser.createPullParser(MY_QNAME,
                   new Object[]{
-                   "<xsl:value-of select="$propertyName"/>",org.apache.axis2.databinding.schema.util.ConverterUtil.convertToString(<xsl:value-of
select="$varName"/>)
+                   org.apache.axis2.databinding.utils.ADBPullParser.ELEMENT_TEXT,
+                   org.apache.axis2.databinding.schema.util.ConverterUtil.convertToString(<xsl:value-of
select="$varName"/>)
                  },
                   new Object[]{});
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/schema/util/ConverterUtil.java
Wed Oct 26 20:55:13 2005
@@ -84,6 +84,9 @@
         return Boolean.getBoolean(s);
     }
 
+    public static boolean convertToanyType(String s){
+        return Boolean.getBoolean(s);
+    }
 
     /* primitive types to Object conversion methods */
     public static Object convertToObject(String i){

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/databinding/utils/ADBPullParser.java
Wed Oct 26 20:55:13 2005
@@ -154,7 +154,7 @@
      *                                                                                  
                                                                                         
                          pull parser for that java bean.
      *                   <p/>
      *                   <p/>
-     *                                                                                  
                                                                                         
                                            This is the how the parsed array should look like
+     *                                                                                  
                                                                                         
                                            This is the how the passed array should look like
      *                                                                                  
                                                                                         
                                                              Key             Value
      *                                                                                  
                                                                                         
                                                              String              String
      *                                                                                  
                                                                                         
                                                              QName               ADBBean,
OMElement, Bean

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/codegen-config.properties
Wed Oct 26 20:55:13 2005
@@ -3,7 +3,7 @@
 #######################################################################################################################
 # Extensions - The extensions are comma seperated
 # these are loaded in their lexical order
-codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
+codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.XMLBeansExtension,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
 #codegen.extension=org.apache.axis2.wsdl.codegen.extension.AxisBindingBuilder,org.apache.axis2.wsdl.codegen.extension.WSDLValidatorExtension,org.apache.axis2.wsdl.codegen.extension.PackageFinder,org.apache.axis2.wsdl.codegen.extension.SimpleDBExtension,org.apache.axis2.wsdl.codegen.extension.DefaultDatabindingExtension
 # The third party schemas to be loaded. e.g. The Xmime extension
 # Note - these will be loaded from the org.apache.axis2.wsdl.codegen.schema package.
@@ -44,6 +44,9 @@
 java.message.receiver.template=org.apache.axis2.wsdl.codegen.writer.MessageReceiverWriter,/org/apache/axis2/wsdl/template/java/MessageReceiverTemplate.xsl
 java.dbsupporter.xmlbeans.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/XMLBeansSupporterTemplate.xsl
 java.dbsupporter.jaxb.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/XMLBeansSupporterTemplate.xsl
+########### Change the name in the following one
+java.dbsupporter.adb.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
+###########
 java.dbsupporter.default.template=org.apache.axis2.wsdl.codegen.writer.DatabindingSupportClassWriter,/org/apache/axis2/wsdl/template/java/DefaultDataBindingSupporterTemplate.xsl
 # file extension for generated files from this language
 java.filename.extension=java

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/emitter/MultiLanguageClientEmitter.java
Wed Oct 26 20:55:13 2005
@@ -79,6 +79,7 @@
      */
     public void setMapper(TypeMapper mapper) {
         this.mapper = mapper;
+       
     }
 
     /**
@@ -581,11 +582,17 @@
                     "name",
                     this.mapper.getParameterName(inputMessage.getElement()),
                     param);
+
             //todo modify the code here to unwrap if requested
             String typeMapping = this.mapper.getTypeMapping(
                     inputMessage.getElement());
-            String typeMappingStr = typeMapping == null ? "org.apache.axis2.om.OMElement"
: typeMapping;
-            addAttribute(doc, "type", typeMappingStr, param);
+            addAttribute(doc, "type", typeMapping == null ? "" : typeMapping, param);
+
+            //add an extra attribute to say whether the type mapping is the default
+            if (TypeMapper.DEFAULT_CLASS_NAME.equals(typeMapping)){
+                addAttribute(doc,"default","yes",param);
+            }
+
             //add this as a body parameter
             addAttribute(doc,"location","body",param);
             Iterator iter = inputMessage.getExtensibilityAttributes().iterator();
@@ -644,6 +651,10 @@
         }
         addAttribute(doc,"name",parameterName,param);
         addAttribute(doc,"type", typeMappingStr, param);
+        //add an extra attribute to say whether the type mapping is the default
+        if (TypeMapper.DEFAULT_CLASS_NAME.equals(typeMappingStr)){
+            addAttribute(doc,"default","yes",param);
+        }
         //add this as a body parameter
         addAttribute(doc,"location","body",param);
 
@@ -986,6 +997,7 @@
         //this step is needed to remove repetitions
         Map parameterMap = new HashMap();
         Element inputParamElement = getInputParamElement(doc, operation);
+
         if (inputParamElement!=null){
             parameterMap.put(inputParamElement.getAttribute("type"),inputParamElement);
         }
@@ -1027,9 +1039,7 @@
         }
 
         doc.appendChild(rootElement);
-        ///////////////////////////////////////////////////
-        //System.out.println("rootElement = " + rootElement);
-        ///////////////////////////////////////////////////
+
         return doc;
     }
 

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/codegen/extension/SimpleDBExtension.java
Wed Oct 26 20:55:13 2005
@@ -47,7 +47,7 @@
     }
 
     public void engage() {
-            //test the databinding type. If not just fall through
+        //test the databinding type. If not just fall through
         if (configuration.getDatabindingType() != XSLTConstants.DataBindingTypes.ADB) {
             return;
         }
@@ -65,10 +65,11 @@
             List typesArray = typesList.getExtensibilityElements();
             WSDLExtensibilityElement extensiblityElt = null;
             Vector xmlSchemaTypeVector = new Vector();
+            XmlSchemaCollection schemaColl = new XmlSchemaCollection();
             for (int i = 0; i < typesArray.size(); i++) {
                 extensiblityElt = (WSDLExtensibilityElement) typesArray.get(i);
 
-                XmlSchemaCollection schemaColl = new XmlSchemaCollection();
+
                 //add the namespace map here. it is absolutely needed
                 Map nsMap = configuration.getWom().getNamespaces();
                 Iterator keys = nsMap.keySet().iterator();
@@ -85,8 +86,10 @@
                     //compile these schemas
                     while (!importedSchemaStack.isEmpty()) {
                         Element el = (Element)importedSchemaStack.pop();
-                        XmlSchema thisSchema = schemaColl.read(el);
-                        xmlSchemaTypeVector.add(thisSchema);
+                        if (el!=null){
+                            XmlSchema thisSchema = schemaColl.read(el);
+                            xmlSchemaTypeVector.add(thisSchema);
+                        }
                     }
                 }
             }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/DefaultTypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/DefaultTypeMapper.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/DefaultTypeMapper.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/DefaultTypeMapper.java
Wed Oct 26 20:55:13 2005
@@ -17,15 +17,10 @@
 
 package org.apache.axis2.wsdl.databinding;
 
-import javax.xml.namespace.QName;
 
 public class DefaultTypeMapper extends TypeMappingAdapter {
 
     public DefaultTypeMapper() {
-    }
-
-    public String getParameterName(QName qname) {
-        return "omElement";
     }
 
 }

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMapper.java
Wed Oct 26 20:55:13 2005
@@ -16,9 +16,15 @@
 
 package org.apache.axis2.wsdl.databinding;
 
+import org.apache.axis2.om.OMElement;
+
 import javax.xml.namespace.QName;
 
 public interface TypeMapper {
+
+    // Default class name is the
+    public static final String DEFAULT_CLASS_NAME = OMElement.class.getName();
+
     /**
      * Get the type mapping class
      *

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/databinding/TypeMappingAdapter.java
Wed Oct 26 20:55:13 2005
@@ -27,17 +27,19 @@
     protected int counter = 0;
     //Upper limit for the paramete count
     protected static final int UPPER_PARAM_LIMIT = 1000;
+    private static final String PARAMETER_NAME_SUFFIX = "param";
 
     /**
      * @see TypeMapper#getTypeMapping(javax.xml.namespace.QName)
      */
     public String getTypeMapping(QName qname) {
+       
         if ((qname != null)) {
             Object o = map.get(qname);
             if (o != null) {
                 return (String) o;
             } else {
-                return "org.apache.axis2.om.OMElement";
+                return DEFAULT_CLASS_NAME;
             }
         }
 
@@ -51,7 +53,7 @@
         if (counter == UPPER_PARAM_LIMIT) {
             counter = 0;
         }
-        return "param" + counter++;
+        return PARAMETER_NAME_SUFFIX + counter++;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
(original)
+++ webservices/axis2/trunk/java/modules/codegen/src/org/apache/axis2/wsdl/template/java/ADBSupporterTemplate.xsl
Wed Oct 26 20:55:13 2005
@@ -18,70 +18,69 @@
         </xsl:if>
 
         <xsl:for-each select="param">
-            <xsl:if test="@type!=''">
+            <xsl:choose>
+                <xsl:when test="@default">
+                      <!-- The  fact is that default is the OMElement -->
                 public  static org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/>
param){
-                    if (param instanceof  org.apache.axis2.databinding.ADBBean){
+                           return param;
+                }
+                </xsl:when>
+                 <xsl:when test="@type!=''">
+                 public  static org.apache.axis2.om.OMElement  toOM(<xsl:value-of select="@type"/>
param){
+                     if (param instanceof  org.apache.axis2.databinding.ADBBean){
                         org.apache.axis2.om.impl.llom.builder.StAXOMBuilder builder = new
org.apache.axis2.om.impl.llom.builder.StAXOMBuilder
-                            (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), param.getPullParser(null));
//todo need to change this
+                            (org.apache.axis2.om.OMAbstractFactory.getOMFactory(), ((org.apache.axis2.databinding.ADBBean)param).getPullParser(null));
//todo need to change this
                         return builder.getDocumentElement();
-                    }else{
+                     }else{
                         //handle the other types of beans here. Perhaps the reflective builder
is
                         //a good choice here
-                    }
+                     }
                     return null;
                 }
-            </xsl:if>
-        </xsl:for-each>
+                </xsl:when>
+                <xsl:otherwise>
+                    //we don't need to generate code for this!
+                </xsl:otherwise>
+            </xsl:choose>
+           </xsl:for-each>
 
         public static java.lang.Object fromOM(org.apache.axis2.om.OMElement param,
                 java.lang.Class type){
 
         try{
-            <xsl:for-each select="param">
-                <xsl:if test="@type!=''">
-                    if (<xsl:value-of select="@type"/>.class.equals(type)){
-                       java.lang.reflect.Method parseMethod = <xsl:value-of select="@type"/>.class.getMethod("parse",new
Class[]{javax.xml.stream.XMLStreamReader.class});
-                       java.lang.Object obj=null;
-                       if (parseMethod!=null){
-                         obj = parseMethod.invoke(null,new java.lang.Object[]{param.getXMLStreamReader()});
-                       }else{
-                         //oops! we don't know how to deal with this. Perhaps the reflective
one is a good choice here
-                       }
-                       return obj;
-                    }
-                </xsl:if>
-            </xsl:for-each>
-        }catch(java.lang.Exception e){
-            throw new RuntimeException("Data binding error",e);
-        }
-            return null;
-        }
 
-        //Generates an empty object for testing
-        // Caution - need some manual editing to work properly
-        public static java.lang.Object getTestObject(java.lang.Class type){
-        try{
-        <xsl:for-each select="param">
-            <xsl:if test="@type!=''">
+        <xsl:if test="param[@default]">
+             if (<xsl:value-of select="param[@default]/@type"/>.class.equals(type)){
+                  return param;
+             }
+        </xsl:if>
+
+        <xsl:for-each select="param[not(@default)]">
+            <xsl:choose>
+            <xsl:when test="@type!=''">
                 if (<xsl:value-of select="@type"/>.class.equals(type)){
-                    <xsl:value-of select="@type"/> emptyObject= new <xsl:value-of
select="@type"/>();
-                    ////////////////////////////////////////////////
-                    // TODO
-                    // Fill in the empty object with necessaey values. Empty XMLBeans objects
do not generate proper events
-                    ////////////////////////////////////////////////
-                    return emptyObject;
+                <!-- Assume it's an ADBBean -->
+                java.lang.reflect.Method parseMethod = <xsl:value-of select="@type"/>.class.getMethod("parse",new
Class[]{javax.xml.stream.XMLStreamReader.class});
+                java.lang.Object obj=null;
+                if (parseMethod!=null){
+                obj = parseMethod.invoke(null,new java.lang.Object[]{param.getXMLStreamReader()});
+                }else{
+                //oops! we don't know how to deal with this. Perhaps the reflective one is
a good choice here
+                }
+                return obj;
                 }
-            </xsl:if>
+            </xsl:when>
+            <xsl:otherwise>
+                //we don't need to generate code for this!
+            </xsl:otherwise>
+            </xsl:choose>
         </xsl:for-each>
         }catch(java.lang.Exception e){
-            throw new RuntimeException("Test object creation failure",e);
+            throw new RuntimeException("Data binding error",e);
         }
             return null;
         }
-        }
-    </xsl:template>
-
-    <xsl:template match="param">
 
+  }
     </xsl:template>
 </xsl:stylesheet>

Modified: webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
(original)
+++ webservices/axis2/trunk/java/modules/wsdl/src/org/apache/axis2/wsdl/builder/wsdl4j/WSDLPump.java
Wed Oct 26 20:55:13 2005
@@ -391,12 +391,15 @@
         wsdlOperation.setName(new QName(nameSpaceOfTheOperation,
                 wsdl4jOperation.getName()));
 
-        //This code make no attempt to make use of the special xs:Token
-        //defined in the WSDL 2.0. eg like #any, #none
+        // This code make no attempt to make use of the special xs:Token
+        // defined in the WSDL 2.0. eg like #any, #none
         // Create the Input Message and add
         Input wsdl4jInputMessage = wsdl4jOperation.getInput();
-        String wrappedInputName = wsdlOperation.getName().getLocalPart();
-        String wrappedOutputName = wrappedInputName + "Response";
+        QName wrappedInputName = wsdlOperation.getName();
+        QName wrappedOutputName = new QName(
+                               wrappedInputName.getNamespaceURI(),
+                               wrappedInputName.getLocalPart()+ "Response",
+                               wrappedInputName.getPrefix());
 
         if (null != wsdl4jInputMessage) {
             MessageReference wsdlInputMessage = this.wsdlComponentFactory
@@ -461,7 +464,7 @@
             if (null != faultMessage) {
                 faultReference.setRef(
                         this.generateReferenceQname(
-                                faultMessage.getQName().getLocalPart(),
+                                faultMessage.getQName(),
                                 faultMessage,findWrapppable(faultMessage)));
             }
             wsdlOperation.addOutFault(faultReference);
@@ -482,7 +485,7 @@
      * @param wsdl4jMessage
      * @return
      */
-    private QName generateReferenceQname(String outerName,Message wsdl4jMessage,boolean isWrappable)
{
+    private QName generateReferenceQname(QName outerName,Message wsdl4jMessage,boolean isWrappable)
{
         QName referenceQName = null;
         //find the xsd prefix
         String xsdPrefix = findSchemaPrefix();
@@ -538,12 +541,7 @@
 
 
                 //add a schema DOM element
-                DocumentBuilder documentBuilder;
-                try {
-                    documentBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
-                } catch (ParserConfigurationException e) {
-                    throw new RuntimeException(e);
-                }
+                DocumentBuilder documentBuilder = getDOMDocumentBuilder();
                 Document newDoc = documentBuilder.newDocument();
                 schemaElement = newDoc.createElementNS(XMLSCHEMA_NAMESPACE_URI, xsdPrefix
+ ":"+XML_SCHEMA_LOCAL_NAME);
                 schemaExtensibilityElement.setElement(schemaElement);
@@ -558,13 +556,12 @@
                 if (targetNamespaceUri.trim().equals("")){
                     targetNamespaceUri = getTemporaryNamespaceUri();
                 }
+                //the DOMlevel2 documentation states that namespaces need to
+                //declared like this
+                schemaElement.setAttributeNS("http://www.w3.org/2000/xmlns/",
+                                              XMLNS_AXIS2WRAPPED,
+                                              targetNamespaceUri);
 
-                // Note - The DOM level2 API does not support getting a local name from Attrib
Node!!
-                // And XmlSchema fails miserably with this "xmlns:" attribs so to avoid the
problem
-                //i have no choice but to remove the NS declarations!
-
-                 schemaElement.setAttribute(XMLNS_AXIS2WRAPPED,
-                 targetNamespaceUri);
                 schemaElement.setAttribute(XSD_TARGETNAMESPACE,targetNamespaceUri);
                 //schemaElement.setAttribute("xmlns:"+XMLSCHEMA_NAMESPACE_PREFIX,XMLSCHEMA_NAMESPACE_URI);
 
@@ -622,7 +619,7 @@
 
                 Element newElement = doc.createElementNS(XMLSCHEMA_NAMESPACE_URI, xsdPrefix
+ ":"+ XML_SCHEMA_ELEMENT_LOCAL_NAME);
                 newElement.setAttribute(WSDLPump.XSD_NAME,
-                        outerName);
+                        outerName.getLocalPart());
                 newElement.setAttribute(WSDLPump.XSD_TYPE,
                         AXIS2WRAPPED +":"+//whats the prefix to put here!!!
                         wsdl4jMessage.getQName().getLocalPart());
@@ -632,7 +629,7 @@
                 //of the newly created Element as the messageReference's name.
                 //coincidentally it'll be the messages QName!
 
-                referenceQName = wsdl4jMessage.getQName();
+                referenceQName = outerName;
 
                 //Add this message as a resolved message, so that incase some other
                 //operation refer to the same message the if above will take a hit
@@ -658,6 +655,18 @@
         }
 
         return referenceQName;
+    }
+
+    private DocumentBuilder getDOMDocumentBuilder() {
+        DocumentBuilder documentBuilder;
+        try {
+            DocumentBuilderFactory documentBuilderFactory = DocumentBuilderFactory.newInstance();
+            documentBuilderFactory.setNamespaceAware(true);
+            documentBuilder = documentBuilderFactory.newDocumentBuilder();
+        } catch (ParserConfigurationException e) {
+            throw new RuntimeException(e);
+        }
+        return documentBuilder;
     }
 
     /**

Modified: webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java?rev=328780&r1=328779&r2=328780&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
(original)
+++ webservices/axis2/trunk/java/modules/xml/src/org/apache/axis2/om/impl/llom/OMStAXWrapper.java
Wed Oct 26 20:55:13 2005
@@ -808,9 +808,9 @@
             }
         } else {
             if (currentNode.getType() == OMNode.ELEMENT_NODE) {
-
-                // todo complete this
-                return null;
+                returnText = ((OMElement)currentNode).getText();
+            }else if (currentNode.getType() == OMNode.TEXT_NODE){
+                 returnText = ((OMText)currentNode).getText();
             }
         }
         return returnText;



Mime
View raw message