axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r489565 [1/2] - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl: symbolTable/ wsdl2ws/ wsdl2ws/c/ wsdl2ws/c/literal/ wsdl2ws/cpp/ wsdl2ws/cpp/literal/ wsdl2ws/info/
Date Fri, 22 Dec 2006 06:35:37 GMT
Author: nadiramra
Date: Thu Dec 21 22:35:36 2006
New Revision: 489565

URL: http://svn.apache.org/viewvc?view=rev&rev=489565
Log:
AXISCPP-898 simple problem with simpleTypes.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParamCPPFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/info/Type.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CElementDecl.java Thu Dec 21 22:35:36 2006
@@ -17,8 +17,6 @@
 
 package org.apache.axis.wsdl.symbolTable;
 
-import java.util.Vector;
-
 import javax.xml.namespace.QName;
 
 /**
@@ -65,12 +63,6 @@
     //This specifies whether the element must be namespace qualified or not in the SOAP message.
     private boolean nsQualified = false;
     
-    // vvv FJP - 17667
-    private boolean restriction = false;
-    private String  restrictionBase = null;
-    private Vector  restrictionPattern = null;
-    private Vector  restrictionEnumeration = null;
-    // ^^^ FJP - 17667
     
     /** Field documentation */
     private String documentation;
@@ -232,62 +224,4 @@
         this.documentation = documentation;
     }
 
-    // vvv FJP - 17667
-    /**
-     * @return Returns the restriction.
-     */
-    public boolean isRestriction()
-    {
-        return restriction;
-    }
-    /**
-     * @param restriction The restriction to set.
-     */
-    public void setRestriction(boolean restriction)
-    {
-        this.restriction = restriction;
-    }
-    /**
-     * @return Returns the restrictionBase.
-     */
-    public String getRestrictionBase()
-    {
-        return restrictionBase;
-    }
-    /**
-     * @param restrictionBase The restrictionBase to set.
-     */
-    public void setRestrictionBase(String restrictionBase)
-    {
-        this.restrictionBase = restrictionBase;
-    }
-    /**
-     * @return Returns the restrictionEnumeration.
-     */
-    public Vector getRestrictionEnumeration()
-    {
-        return restrictionEnumeration;
-    }
-    /**
-     * @param restrictionEnumeration The restrictionEnumeration to set.
-     */
-    public void setRestrictionEnumeration(Vector restrictionEnumeration)
-    {
-        this.restrictionEnumeration = restrictionEnumeration;
-    }
-    /**
-     * @return Returns the restrictionPattern.
-     */
-    public Vector getRestrictionPattern()
-    {
-        return restrictionPattern;
-    }
-    /**
-     * @param restrictionPattern The restrictionPattern to set.
-     */
-    public void setRestrictionPattern(Vector restrictionPattern)
-    {
-        this.restrictionPattern = restrictionPattern;
-    }
-    // ^^^ FJP - 17667
 }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/symbolTable/CSchemaUtils.java Thu Dec 21 22:35:36 2006
@@ -30,7 +30,6 @@
 import org.apache.axis.wsdl.wsdl2ws.info.ElementInfo;
 import org.w3c.dom.DOMException;
 import org.w3c.dom.Element;
-import org.w3c.dom.NamedNodeMap;
 import org.w3c.dom.Node;
 import org.w3c.dom.NodeList;
 
@@ -202,7 +201,9 @@
      * @param symbolTable 
      * @return 
      */
-    public static Vector getContainedElementDeclarations( Node node, SymbolTable symbolTable)
+    public static Vector getContainedElementDeclarations(
+        Node node,
+        SymbolTable symbolTable)
     {
 
         if (node == null)
@@ -339,19 +340,30 @@
                 {
                     if (subNodeKind.getLocalPart().equals("sequence"))
                     {
-                        v.addAll( processSequenceNode(children.item(j), symbolTable));
+                        v.addAll(
+                            processSequenceNode(children.item(j), symbolTable));
                     }
-                    else if (subNodeKind.getLocalPart().equals("all"))
+                    else
+                        if (subNodeKind.getLocalPart().equals("all"))
                         {
-                        v.addAll( processAllNode(children.item(j), symbolTable));
+                            v.addAll(
+                                processAllNode(children.item(j), symbolTable));
                         }
-                    else if (subNodeKind.getLocalPart().equals("choice"))
+                        else
+                            if (subNodeKind.getLocalPart().equals("choice"))
                             {
-                        v.addAll( processChoiceNode( children.item(j), symbolTable));
+                                v.addAll(
+                                    processChoiceNode(
+                                        children.item(j),
+                                        symbolTable));
                             }
-                    else if (subNodeKind.getLocalPart().equals("group"))
+                            else
+                                if (subNodeKind.getLocalPart().equals("group"))
                                 {
-                        v.addAll( processGroupNode( children.item(j), symbolTable));
+                                    v.addAll(
+                                        processGroupNode(
+                                            children.item(j),
+                                            symbolTable));
                                 }
                 }
             }
@@ -2158,56 +2170,6 @@
         }
     }
 
-    // vvv FJP - 17667
-    private static void addRestrictionsToVector( Vector v, Node child, SymbolTable symbolTable, String base, String restType)
-    {
-        CElementDecl elem = new CElementDecl();
-        Vector       vr = null;
-        
-        NamedNodeMap nodeAttribs = child.getAttributes();
-
-        if( nodeAttribs != null)
-        {
-            for( int i = 0; i < nodeAttribs.getLength(); i++)
-            {
-                if( vr == null)
-                {
-                    vr = new Vector();
-                }
-                
-                if( nodeAttribs.item(i).getLocalName().equals( "name"))
-                {
-                    vr.add( nodeAttribs.item(i).getNodeValue());
-                }
-                else if( nodeAttribs.item(i).getLocalName().equals( "type"))
-                {
-                    vr.add( nodeAttribs.item(i).getNodeValue());
-                }
-                else if( nodeAttribs.item(i).getLocalName().equals( "value"))
-                {
-                    vr.add( nodeAttribs.item(i).getNodeValue());
-                }
-            }
-        }
-        
-        elem.setRestriction( true);
-        elem.setRestrictionBase( base);
-        
-        if( restType.equals( "pattern"))
-        {
-            elem.setRestrictionPattern( vr);
-        }
-        else
-        {
-            elem.setRestrictionEnumeration( vr);
-        }
-        
-        elem.setName( VALUE_QNAME);
-        
-        v.add( elem);
-    }
-    // ^^^ FJP - 17667
-
     /**
      * Return the attribute names and types if any in the node
      * The even indices are the attribute types (TypeEntry) and
@@ -2228,8 +2190,11 @@
      * @param symbolTable 
      * @return 
      */
-    public static Vector getContainedAttributeTypes( Node node, SymbolTable symbolTable)
+    public static Vector getContainedAttributeTypes(
+        Node node,
+        SymbolTable symbolTable)
     {
+
         Vector v = null; // return value
 
         if (node == null)
@@ -2322,75 +2287,15 @@
                 }
                 else
                 {
+
                     // we have an attribute
                     addAttributeToVector(v, child, symbolTable);
                 }
             }
         }
 
-// vvv FJP - 17667 - Code added
-// Expecting a schema simpleType
-        if (isXSDNode(node, "simpleType"))
-        {
-            // Under the simpleType there could be a restriction
-            NodeList children = node.getChildNodes();
-            Node     content = null;
-            String 	 base = null;
-            String   restType = null;
-
-            for (int j = 0; j < children.getLength(); j++)
-            {
-                Node kid = children.item(j);
-
-                if( isXSDNode(kid, "restriction"))
-                {
-                    content = kid;
-                    
-                    NamedNodeMap nnm = kid.getAttributes();
-
-                    for( int k = 0; k < nnm.getLength(); k++)
-                    {
-                        Node an = nnm.item( k);
-                        
-                        if( an.getLocalName().equals( "base"))
-                        {
-                            base = an.getNodeValue();
-                            
-                            break;
-                        }
-                    }
-                    break;
-                }
-            }
-
-            // Check for extensions or restrictions
-            if (content != null)
-            {
-                children = content.getChildNodes();
-
-                for (int j = 0; j < children.getLength(); j++)
-                {
-                    Node kid = children.item(j);
-
-                    if (isXSDNode(kid, "pattern")
-                        || isXSDNode(kid, "enumeration"))
-                    {
-                        restType = kid.getLocalName();
-
-    	                if (v == null)
-    	                {
-    	                    v = new Vector();
-    	                }
-    	
-                        addRestrictionsToVector( v, kid, symbolTable, base, restType);
-                    }
-                }
-            }
-        }
-
         return v;
     }
-    // ^^^ FJP - 17667
 
     // list of all of the XSD types in Schema 2001
 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.java Thu Dec 21 22:35:36 2006
@@ -39,6 +39,7 @@
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
 import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
+import org.apache.axis.wsdl.symbolTable.CSchemaUtils;
 
 public class CUtils 
 {
@@ -825,14 +826,25 @@
     public static boolean isPointerType(String name)
     {
         Object o = isPointerBasedType.get(name);
-        boolean    b = false;
         
         if( o != null)
-            b = ((Boolean) isPointerBasedType.get(name)).booleanValue();
+            return ((Boolean)o).booleanValue();
         
-        return b;
+        return false;
     }
-    
+    public static boolean isPointerType(QName name)
+    {
+        Object o;
+        if (cpp)
+            o = qname2classmapCpp.get(name);
+        else
+            o = qname2classmapC.get(name);
+        
+        if (o != null)
+            return isPointerType((String)o);
+
+        return false;
+    }    
     public static boolean isAnyType(QName name)
     {
             return name.equals(anyTypeQname);
@@ -871,6 +883,7 @@
             
             return methodname;
         }
+
         return null;    
     }
     
@@ -894,9 +907,10 @@
             val = qname2classmapCpp.get(qname);
         else
             val = qname2classmapC.get(qname);
-        if (val != null)
-            return (String) val;
-        val = schemaDefinedSimpleTypesMap.get(qname);
+        
+        if (val == null)
+            val = schemaDefinedSimpleTypesMap.get(qname);
+        
         if (val != null)
             return (String) val;
         return null;
@@ -928,10 +942,7 @@
         else
             enumName = (String)basicType2EnumMapC.get(stype);
         
-        if(enumName != null)
-            return enumName;
-
-        return null;    
+        return enumName;   
     }
     public static String getCmplxArrayNameforType(QName qname)
     {
@@ -953,7 +964,7 @@
         else if (!cpp && type2BasicArrayNameC.containsKey(stype))
             return (String)type2BasicArrayNameC.get(stype);
         else
-            return "";
+            return stype + "_Array";
     }
     
     /**
@@ -961,11 +972,13 @@
      * a Vector is returned which contains the base type and the values (enumerations etc).
      * The first element in the vector is the base type (an TypeEntry).
      * Subsequent elements are QNames.
+     * NEEDS WORK - CURRENTLY THE ONLY THING WE DO IS GENERATE ENUMERATOR CONSTANTS AND CREATE
+     * AN EMPTY RESTRICTOR FUNCTION WHEN DOING CODE GENERATION STEP.
      */
-    public static Vector getRestrictionBaseAndValues(Node node, SymbolTable symbolTable) 
+    public static void setRestrictionBaseAndValues(Type typedata, Node node, SymbolTable symbolTable) 
     {
         if (node == null)
-            return null;
+            return;
 
         // If the node kind is an element, dive into it.
         QName nodeKind = Utils.getNodeQName(node);
@@ -1006,28 +1019,169 @@
                     Constants.isSchemaXSD(restrictionKind.getNamespaceURI()))
                     restrictionNode = children.item(j);
             }
+            
+            // If no restriction node, just return
+            if (restrictionNode == null)
+                return;
 
             // The restriction node indicates the type being restricted
             // (the base attribute contains this type).
-            // The base type must be a simple type, and not boolean
-            TypeEntry baseEType = null;
-            if (restrictionNode != null) 
+            QName baseType = Utils.getTypeQName(restrictionNode, new BooleanHolder(), false);
+            TypeEntry baseEType = symbolTable.getType(baseType);
+            
+            if (baseEType != null) 
             {
-                QName baseType = Utils.getTypeQName(restrictionNode, new BooleanHolder(), false);
-                baseEType = symbolTable.getType(baseType);
-                if (baseEType != null) 
+                QName  typedataQName     = typedata.getName();
+                String typedataLocalpart = typedataQName.getLocalPart();
+                String baseTypeLocalpart = baseEType.getQName().getLocalPart();
+                
+                QName  typedataQNameSanitized     = null;
+                String typedataLocalpartSanitized = null;
+                String baseTypeLocalpartSanitized = null;
+                
+                Boolean isPointer   = null;
+                String methodSuffix = null;
+                
+                String primitiveXSDType          = null;
+                String initValueForType          = null;
+                String classForPrimitiveType     = null;
+                
+                if (TypeMap.isAnonymousType(typedataLocalpart))
                 {
-                    String javaName = TypeMap.getBasicTypeClass4qname(baseEType.getQName());
-                    //String javaName = baseEType.getName();
-                    if (javaName == null || javaName.equals("boolean") ||
-                            ! SchemaUtils.isSimpleSchemaType(baseEType.getQName())) 
-                        baseEType = null;
+                    typedataQNameSanitized     = new QName(typedataQName.getNamespaceURI(), sanitiseClassName(typedataLocalpart));
+                    typedataLocalpartSanitized = sanitiseClassName(typedataLocalpart);
                 }
-            }
+                
+                if (TypeMap.isAnonymousType(baseTypeLocalpart))
+                    baseTypeLocalpartSanitized = sanitiseClassName(baseTypeLocalpart);
+                
+                String class4qname          = null;
+                String class4qnameSanitized = null;
+                
+                String javaName = TypeMap.getBasicTypeClass4qname(baseEType.getQName());
+                boolean isBaseTypePrimitive = javaName != null;
+                
+                QName primitiveBaseTypeQName = null;
+                
+                if (javaName == null)
+                {
+                    // No mapping - ensure that the base type is simple - if it is, then this 
+                    // must be a user-defined simple type that is based on another user-defined
+                    // simple type.
+                    if (!baseEType.isSimpleType()
+                            && !SchemaUtils.isSimpleSchemaType(baseEType.getQName())) 
+                        return;
+
+                    // Get the primitive base type
+                    TypeEntry primitiveBaseType = CSchemaUtils.getBaseType(baseEType, symbolTable);
+                    primitiveBaseTypeQName      = primitiveBaseType.getQName();
+                }
+                else if (javaName.equals("boolean"))
+                    return;
+                else
+                    primitiveBaseTypeQName = baseEType.getQName();
+                
+                classForPrimitiveType = getclass4qname(primitiveBaseTypeQName);
+                initValueForType      = getInitValue(classForPrimitiveType);
+                
+                // Set the base type for Type
+                typedata.setBaseType(primitiveBaseTypeQName);
+                
+                // We will map the user-defined type to the user-defined type, so set
+                // mapping for the type.
+                class4qname          = typedataLocalpart;
+                class4qnameSanitized = typedataLocalpartSanitized;
+                
+                // Update some commonly-used mapping tables to reflect the user-defined
+                // simple type. If anonymous type, we need to update mapping tables twice: once
+                // with the anonymous names, and once with the sanitized names. 
+                
+                isPointer = new Boolean(isPointerType(primitiveBaseTypeQName));
+                primitiveXSDType = getXSDTypeForBasicType(classForPrimitiveType);
 
-            // Process the enumeration elements underneath the restriction node
-            if (baseEType != null && restrictionNode != null) 
-            {
+                if (!isBaseTypePrimitive)
+                {
+                    typedata.setRestrictionBaseType(baseTypeLocalpart);
+                    isPointerBasedType.put(baseTypeLocalpart, isPointer);
+                }
+                isPointerBasedType.put(typedataLocalpart, isPointer);                    
+
+                if (cpp)
+                {
+                    methodSuffix = (String)type2getValueMethodNameCpp.get(classForPrimitiveType);
+                    
+                    qname2classmapCpp.put(typedataQName, class4qname);
+                    basicType2EnumMapCpp.put(typedataLocalpart, primitiveXSDType);
+                    if (initValueForType != null)
+                        initValuesCpp.put(typedataLocalpart, initValueForType);
+                    type2getValueMethodNameCpp.put(typedataLocalpart, methodSuffix);
+                    
+                    if (!isBaseTypePrimitive)
+                    {
+                        basicType2EnumMapCpp.put(baseTypeLocalpart, primitiveXSDType);
+                        if (initValueForType != null)
+                            initValuesCpp.put(baseTypeLocalpart, initValueForType);
+                        type2getValueMethodNameCpp.put(baseTypeLocalpart, methodSuffix);
+                    }
+
+                    if (typedataQNameSanitized != null)
+                    {
+                        isPointerBasedType.put(typedataLocalpartSanitized, isPointer); 
+                        qname2classmapCpp.put(typedataQNameSanitized, class4qnameSanitized);
+                        basicType2EnumMapCpp.put(typedataLocalpartSanitized, primitiveXSDType);
+                        if (initValueForType != null)
+                            initValuesCpp.put(typedataLocalpartSanitized, initValueForType);
+                        type2getValueMethodNameCpp.put(typedataLocalpartSanitized, methodSuffix);
+                    }
+                    
+                    if (baseTypeLocalpartSanitized != null)
+                    {
+                        isPointerBasedType.put(baseTypeLocalpartSanitized, isPointer);
+                        basicType2EnumMapCpp.put(baseTypeLocalpartSanitized, primitiveXSDType);
+                        if (initValueForType != null)
+                            initValuesCpp.put(baseTypeLocalpartSanitized, initValueForType);
+                        type2getValueMethodNameCpp.put(baseTypeLocalpartSanitized, methodSuffix);
+                    }
+                }
+                else
+                {
+                    methodSuffix = (String)type2getValueMethodNameC.get(classForPrimitiveType);
+                    
+                    qname2classmapC.put(typedataQName, class4qname);
+                    basicType2EnumMapC.put(typedataLocalpart, primitiveXSDType);
+                    if (initValueForType != null)
+                        initValuesC.put(typedataLocalpart, initValueForType);
+                    type2getValueMethodNameC.put(typedataLocalpart, methodSuffix);
+                    
+                    if (!isBaseTypePrimitive)
+                    {
+                        basicType2EnumMapC.put(baseTypeLocalpart, primitiveXSDType);
+                        if (initValueForType != null)
+                            initValuesC.put(baseTypeLocalpart, initValueForType);
+                        type2getValueMethodNameC.put(baseTypeLocalpart, methodSuffix);
+                    }
+
+                    if (typedataQNameSanitized != null)
+                    {
+                        isPointerBasedType.put(typedataLocalpartSanitized, isPointer); 
+                        qname2classmapC.put(typedataQNameSanitized, class4qnameSanitized);
+                        basicType2EnumMapC.put(typedataLocalpartSanitized, primitiveXSDType);
+                        if (initValueForType != null)
+                            initValuesC.put(typedataLocalpartSanitized, initValueForType);
+                        type2getValueMethodNameC.put(typedataLocalpartSanitized, methodSuffix);
+                    }
+                    
+                    if (baseTypeLocalpartSanitized != null)
+                    {
+                        isPointerBasedType.put(baseTypeLocalpartSanitized, isPointer);
+                        basicType2EnumMapC.put(baseTypeLocalpartSanitized, primitiveXSDType);
+                        if (initValueForType != null)
+                            initValuesC.put(baseTypeLocalpartSanitized, initValueForType);
+                        type2getValueMethodNameC.put(baseTypeLocalpartSanitized, methodSuffix);
+                    }
+                }                
+                
+                // Process the enumeration elements underneath the restriction node
                 Vector v = new Vector();                
                 NodeList enums = restrictionNode.getChildNodes();
                 for (int i=0; i < enums.getLength(); i++) 
@@ -1037,21 +1191,25 @@
                     {
                         Node enumNode = enums.item(i);
                         String value = Utils.getAttribute(enumNode, "value");
-
-                        // HACK wollsch
+    
                         if (value.indexOf(':')>0)                                                        
                                 value=value.substring(value.indexOf(':')+1,value.length());
                         v.add(new QName(value, enumKind.getLocalPart()));
                     }
                 }
                 
-                // is this really an enumeration?
                 // The first element in the vector is a TypeEntry.
                 v.add(0,baseEType);
-                return v;
+                typedata.setRestrictiondata(v);
+                typedata.setRestriction(true);
+                
+                // Add schema-defined simple type to mapping table - TODO: not sure we need this anymore.
+                CUtils.addSchemaDefinedSimpleType(typedataQName, class4qname);
+                if (typedataQNameSanitized != null)
+                    CUtils.addSchemaDefinedSimpleType(typedataQNameSanitized, class4qnameSanitized);
             }
         }
-        return null;
+        return;
     }    
     
     public static String sanitiseClassName( String name)
@@ -1072,11 +1230,11 @@
         
         return sanitisedName;
     }
-
+    
     public static String sanitiseAttributeName( String classname, String name)
     {
         String sanitisedName = sanitiseClassName( name);
-
+        
         if( classname.equals( sanitisedName))
             sanitisedName += "_";
         
@@ -1161,58 +1319,5 @@
         
         return sNew;
     }
-    // vvv FJP - 17667
-    public static Type findBaseTypeOfRestriction( Type type, WebServiceContext wscontext)
-    {
-        // FJP - Find base type of the restricted type.
-        Type   restType = type;
-        String restBaseType = null;
-        int    restBaseCount = 10;
-        String restBaseClass = null;
-        
-        while( restType != null && restBaseClass == null && restBaseCount > 0)
-        {
-            restBaseType = restType.getRestrictionBase();
-            restBaseType = restBaseType.substring( restBaseType.indexOf( ":") + 1);
-            restBaseCount--;
-            // Is the restBaseType as base type?
-            restBaseClass = CUtils.getclass4qname( new QName( WrapperConstants.SOAPENC_NAMESPACE, restBaseType));
-
-            while( restBaseClass == null && restType != null)
-            {
-                // Find the type in the type list.
-                Iterator theBaseTypes = wscontext.getTypemap().getTypes().iterator();
-                
-                restType = null;
-                
-                while( theBaseTypes.hasNext())
-                {
-                    Type aType = (Type) theBaseTypes.next();
-                    
-                    if( aType.getName().getLocalPart().equals( restBaseType))
-                    {
-                        restType = aType;
-                        restBaseType = restType.getRestrictionBase();
-                        restBaseType = restBaseType.substring( restBaseType.indexOf( ":") + 1);
-                        restBaseClass = CUtils.getclass4qname( new QName( WrapperConstants.SOAPENC_NAMESPACE, restBaseType));
-                        break;
-                    }
-                }
-            }
-        }
-
-        return restType;
-    }
-    // ^^^ FJP - 17667
-
-    // vvv FJP - 17667
-    public static String getBaseTypeOfRestrictionAsString( Type type)
-    {
-        String restBaseType = type.getRestrictionBase();
-        restBaseType = restBaseType.substring( restBaseType.indexOf( ":") + 1);
-        
-        return CUtils.getclass4qname( new QName( WrapperConstants.SOAPENC_NAMESPACE, restBaseType));
-    }
-    // ^^^ FJP - 17667
 }
 

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/WSDL2Ws.java Thu Dec 21 22:35:36 2006
@@ -822,7 +822,6 @@
 
         Node node = type.getNode();
 
-        Vector restrictdata = null;
         if (type.isSimpleType())
         {
             //check for extended types
@@ -841,39 +840,17 @@
                             + type.getQName().getLocalPart() + "=====\n");
             }
             else
-            {
-                //types declared as simpleType
-                restrictdata = CUtils.getRestrictionBaseAndValues(node, symbolTable);
-                if (restrictdata != null)
-                    typedata.setRestrictiondata(restrictdata);
-            }
+                CUtils.setRestrictionBaseAndValues(typedata, node, symbolTable);
             
             // There can be attributes in this extended basic type
             Vector attributes = CSchemaUtils.getContainedAttributeTypes(type.getNode(), symbolTable);
             if (attributes != null)
-            {
-                if( attributes.get(0).getClass() == CElementDecl.class)
-	                for (int j = 0; j < attributes.size(); j++)
-	                {
-	                    CElementDecl ed = (CElementDecl) attributes.get(j);
-	                    
-	                    if( ed.isRestriction())
-	                    {
-	                        typedata.setRestriction( true);
-	                        typedata.setRestrictionBase( ed.getRestrictionBase());
-	                        typedata.setRestrictionEnumeration( ed.getRestrictionEnumeration());
-	                        typedata.setRestrictionPattern( ed.getRestrictionPattern());
-	                    }
-	                }
-                else
-                    for (int j = 0; j < attributes.size(); j += 2)
-                    {
-                        newSecondaryType = createTypeInfo(((TypeEntry) attributes.get(j)).getQName(), targetLanguage);
-                        typedata.addRelatedType(newSecondaryType);
-                        typedata.setTypeForAttributeName(
-                            ((QName) attributes.get(j + 1)).getLocalPart(), newSecondaryType);
-                    }
-            }
+                for (int j = 0; j < attributes.size(); j += 2)
+                {
+                    newSecondaryType = createTypeInfo(((TypeEntry) attributes.get(j)).getQName(), targetLanguage);
+                    typedata.addRelatedType(newSecondaryType);
+                    typedata.setTypeForAttributeName(((QName) attributes.get(j + 1)).getLocalPart(), newSecondaryType);
+                }
         }
         else if (type instanceof CollectionType)
         {
@@ -969,22 +946,6 @@
                                                     true,
                                                     targetLanguage);
                             }
-                            // vvv FJP - 17667
-                            // FJP - Check if element is an extension or restriction
-                            else if( elem.isRestriction())
-                            { // 8 
-                                typedata.setRestriction( true);
-                                typedata.setRestrictionBase( elem.getRestrictionBase());
-                                typedata.setRestrictionEnumeration(elem.getRestrictionEnumeration());
-                                typedata.setRestrictionPattern( elem.getRestrictionPattern());
-
-                                eleinfo = new ElementInfo( elem.getName(),
-                                        				   new Type( CUtils.anyTypeQname,
-                                        				           	 CUtils.anyTypeQname.getLocalPart(),
-                                        				           	 true,
-                                        				           	 targetLanguage));
-                            } // 8
-                            // ^^^ FJP - 17667
                             else
                             {
                                 QName typeName = elem.getType().getQName();

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java Thu Dec 21 22:35:36 2006
@@ -39,11 +39,6 @@
 
 public class BeanParamWriter extends ParamCFileWriter
 {
-    /**
-     * @param wscontext
-     * @param type
-     * @throws WrapperFault
-     */
     public BeanParamWriter(WebServiceContext wscontext, Type type)
         throws WrapperFault
     {
@@ -149,21 +144,14 @@
                     soapTagName = soapTagName.substring(1, soapTagName.length());
 
                 Type type = attribs[i].getType();
-                boolean isPointerType = false;
                 String basicType = null;
                 
                 if (!attribs[i].isSimpleType() && type.isSimpleType())
-                {
-                    basicType = CUtils.getclass4qname(attribs[i].getType().getBaseType());
-                    isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
-                }
+                    basicType = CUtils.getclass4qname(type.getBaseType());
                 else
-                {
                     basicType = attribs[i].getTypeName();
-                    isPointerType = CUtils.isPointerType(attribs[i].getTypeName());
-                }
                 
-                if (isPointerType)
+                if (CUtils.isPointerType(basicType))
                 {
                     writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n");
                     writer.write("\t\taxiscSoapSerializerSerializeAsAttribute(pSZ,\""
@@ -180,17 +168,6 @@
                             + "), "
                             + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName()) + ");\n");
                 }
-                
-                if (!attribs[i].isOptional())
-                {
-                    /* This avoid segmentation fault at runtime */
-                    /*
-                     * writer.write("\telse\n");
-                     * writer.write("\t\tAXISTRACE1(\"The mandatory attribute
-                     * "+attribs[i].getParamName()+" is not set\",
-                     * CRITICAL);\n");
-                     */
-                }
             }
         }
         
@@ -404,7 +381,6 @@
 
     /**
      * @throws IOException
-     * @throws WrapperFault
      */
     private void writeDeSerializeGlobalMethod() throws IOException, WrapperFault
     {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ParmHeaderFileWriter.java Thu Dec 21 22:35:36 2006
@@ -27,9 +27,9 @@
 import java.io.File;
 import java.io.FileWriter;
 import java.io.IOException;
+import java.util.HashSet;
 import java.util.Iterator;
 import java.util.Vector;
-import java.util.HashSet;
 
 import javax.xml.namespace.QName;
 
@@ -38,25 +38,16 @@
 import org.apache.axis.wsdl.wsdl2ws.ParamWriter;
 import org.apache.axis.wsdl.wsdl2ws.WSDL2Ws;
 import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
-import org.apache.axis.wsdl.wsdl2ws.WrapperUtils;
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 
 public class ParmHeaderFileWriter extends ParamWriter
 {
-    /**
-     * @param wscontext
-     * @param type
-     * @throws WrapperFault
-     */
     public ParmHeaderFileWriter(WebServiceContext wscontext, Type type) throws WrapperFault
     {
         super(wscontext, type);
     }
 
-    /* (non-Javadoc)
-     * @see org.apache.axis.wsdl.wsdl2ws.SourceWriter#writeSource()
-     */
     public void writeSource() throws WrapperFault
     {
         try
@@ -69,7 +60,7 @@
             this.writer.write("#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
             
             if (type.isSimpleType())
-                writeSimpleTypeWithEnumerations();
+                writeSimpleTypeWithRestrictions();
             else
             {
                 writePreprocessorStatements();
@@ -110,7 +101,7 @@
     /**
      * @throws WrapperFault
      */
-    protected void writeSimpleTypeWithEnumerations() throws WrapperFault
+    protected void writeSimpleTypeWithRestrictions() throws WrapperFault
     {
         try
         {
@@ -125,9 +116,24 @@
             if (!CUtils.isSimpleType(baseType))
                 return;
             
+            String baseTypeName = CUtils.getclass4qname(baseType);
+            String langTypeName;
+            
+            // User defined simple type based on another user-defined simple type
+            String  restrictionBaseType = type.getRestrictionBaseType();
+            if (null != restrictionBaseType )
+            {  
+                langTypeName = CUtils.sanitiseClassName(restrictionBaseType);               
+                writer.write( "#include \"" + langTypeName + ".hpp\"\n\n");
+            }
+            else
+                langTypeName = baseTypeName;
+            
+
+
             writer.write("\n");
             writer.write("/* ********************************************************************* */\n");
-            writer.write("/* --- Simple types and enumerations                                 --- */\n");
+            writer.write("/* --- Simple types and restrictions                                 --- */\n");
             writer.write("/* ********************************************************************* */\n");
             writer.write("\n");  
             
@@ -146,11 +152,10 @@
                     break;
             }
             
-            String langTypeName = CUtils.getclass4qname(baseType);
             writer.write("typedef ");
-            if (CUtils.isPointerType(CUtils.getclass4qname(baseType)) 
-                    || "xsdc__base64Binary".equals(CUtils.getclass4qname(baseType)) 
-                    || "xsdc__hexBinary".equals(CUtils.getclass4qname(baseType)))
+            if (CUtils.isPointerType(baseTypeName) 
+                    || "xsdc__base64Binary".equals(baseTypeName) 
+                    || "xsdc__hexBinary".equals(baseTypeName))
             {
                 writer.write(langTypeName + " " + classname + ";\n");
                 writer.write("typedef " + langTypeName + "_Array " + classname + "_Array;\n");
@@ -182,11 +187,14 @@
             } 
             else if ("int".equals(baseType.getLocalPart()))
             {
+                writer.write(langTypeName + " " + classname + ";\n");
+                writer.write("typedef " + langTypeName + "_Array " + classname + "_Array;\n");
+            
                 if (restrictionData.size() > 1)
                 {
                     //there are enumerations or min/maxInclusive
                     boolean isEnum = false;
-                    boolean hasRestrictionItems = false;
+
                     for (int i = 1; i < restrictionData.size(); i++)
                     {
                         QName value = (QName) restrictionData.elementAt(i);
@@ -196,7 +204,7 @@
                             if (i > 1)
                                 writer.write(", ");
                             else
-                                writer.write(" enum { ");
+                                writer.write("typedef enum { ");
 
                             writer.write("ENUM" + classname.toUpperCase() + "_"
                                     + value.getNamespaceURI() + "="
@@ -204,36 +212,25 @@
                         } 
                         else if ("minInclusive".equals(value.getLocalPart()))
                         {
-                            hasRestrictionItems = true;
-                            if (i <= 1)
-                                writer.write(langTypeName + " " + classname + ";\n");
-                            
                             writer.write("static const int " + classname
                                     + "_MinInclusive = " + value.getNamespaceURI() + ";\n");
                         } 
                         else if ("maxInclusive".equals(value.getLocalPart()))
                         {
-                            hasRestrictionItems = true;
-                            if (i <= 1)
-                                writer.write(langTypeName + " " + classname + ";\n");
-
                             writer.write("static const int " + classname
                                     + "_MaxInclusive = " + value.getNamespaceURI() + ";\n");
                         }
                     }
                     
                     if (isEnum)
-                        writer.write("} " + classname + ";\n");
-                    else if (!hasRestrictionItems)
-                        writer.write(langTypeName + " " + classname + ";\n");
+                        writer.write("} " + classname + "_Enum;\n");
                 } 
-                else
-                    writer.write(langTypeName + " " + classname + ";\n");
             } 
             else
             {
                 writer.write(langTypeName + " " + classname + ";\n");
-                writer.write("\n");
+                writer.write("typedef " + langTypeName + "_Array " + classname + "_Array;\n");
+                
                 for (int i = 1; i < restrictionData.size(); i++)
                 {
                     QName value = (QName) restrictionData.elementAt(i);
@@ -255,10 +252,6 @@
         }
     }
     
-    
-    /* (non-Javadoc)
-     * @see org.apache.axis.wsdl.wsdl2ws.BasicFileWriter#writeAttributes()
-     */
     protected void writeAttributes() throws WrapperFault
     {
         int anyCounter = 0;
@@ -466,13 +459,28 @@
             HashSet typeSet = new HashSet();
             for (int i = 0; i < attribs.length; i++)
             {
-                if ((attribs[i].isArray()) && 
-                        !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
-                    typeSet.add(attribs[i].getTypeName() + "_Array");
+                String basicType = attribs[i].getTypeName();
+                Type theType = attribs[i].getType();
 
-                if (!(attribs[i].isSimpleType() || attribs[i].isAnyType()))
-                    typeSet.add(attribs[i].getTypeName());
+                if (theType.isRestriction() && !CUtils.isSimpleType(basicType))
+                    typeSet.add(basicType);
+                else if (!attribs[i].isSimpleType())
+                {
+                    if ((attribs[i].isArray()) && !theType.isSimpleType())
+                        typeSet.add(basicType + "_Array");
+    
+                    if (!attribs[i].isAnyType())
+                        typeSet.add(basicType);
+                }
             }
+            
+            if (extensionBaseAttrib != null 
+                    && getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib) != null)
+            {
+                String extBaseType = getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib);
+                if (!CUtils.isSimpleType(extBaseType))
+                    typeSet.add(extBaseType);
+            }            
             
             Iterator itr = typeSet.iterator();
             if (itr.hasNext())

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubHeaderWriter.java Thu Dec 21 22:35:36 2006
@@ -20,10 +20,10 @@
  * @author Susantha Kumara(susantha@opensource.lk, skumara@virtusa.com)
  */
 package org.apache.axis.wsdl.wsdl2ws.c.literal;
+
 import java.io.IOException;
-import java.util.Iterator;
 import java.util.HashSet;
-import java.util.Vector;
+import java.util.Iterator;
 
 import org.apache.axis.wsdl.wsdl2ws.CUtils;
 import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
@@ -36,10 +36,6 @@
 public class ClientStubHeaderWriter
     extends org.apache.axis.wsdl.wsdl2ws.c.ClientStubHeaderWriter
 {
-    /**
-     * @param wscontext
-     * @throws WrapperFault
-     */
     public ClientStubHeaderWriter(WebServiceContext wscontext)
         throws WrapperFault
     {
@@ -179,9 +175,7 @@
         }
     }
 
-    /*
-     * (non-Javadoc)
-     * 
+    /* (non-Javadoc)
      * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
      */
     protected void writePreprocessorStatements() throws WrapperFault
@@ -201,7 +195,7 @@
             
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
-            Vector typeSet = new Vector();
+            HashSet typeSet = new HashSet();
             HashSet removeSet = new HashSet();
 
             while (types.hasNext())
@@ -218,6 +212,9 @@
                 if (atype.getBaseType() != null)
                     if (atype.getBaseType().getLocalPart().equals("string"))
                         removeSet.add(atype.getLanguageSpecificName() + "_Array");
+
+                if (atype.isRestriction())
+                    removeSet.add(atype.getLanguageSpecificName()  + "_Array");
 
                 typeSet.add(atype.getLanguageSpecificName());
             }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java Thu Dec 21 22:35:36 2006
@@ -35,15 +35,12 @@
 import java.io.IOException;
 import java.util.HashSet;
 import java.util.Iterator;
-import java.util.Vector;
 
 import javax.xml.namespace.QName;
 
 import org.apache.axis.wsdl.symbolTable.TypeEntry;
 import org.apache.axis.wsdl.wsdl2ws.CUtils;
-import org.apache.axis.wsdl.wsdl2ws.WrapperConstants;
 import org.apache.axis.wsdl.wsdl2ws.WrapperFault;
-import org.apache.axis.wsdl.wsdl2ws.info.AttributeInfo;
 import org.apache.axis.wsdl.wsdl2ws.info.Type;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 
@@ -101,7 +98,7 @@
         {
             for (int i = 0; i < attribs.length; i++)
             {
-                attribs[i].setParamName( CUtils.sanitiseAttributeName( classname, attribs[i].getParamName()));
+                attribs[i].setParamName( CUtils.sanitiseAttributeName(classname, attribs[i].getParamName()));
 
                 String methodName = attribs[i].getParamNameWithoutSymbols();
                 String parameterName = methodName;
@@ -260,25 +257,6 @@
                         methodName = methodName + Integer.toString(anyCounter);
                     }
 
-                    Type attributeType = attribs[i].getType();
-                    boolean isPointerType = false;
-                    
-                    if( attributeType.isRestriction())
-                    {
-                        // Find the base type of the restriction.
-                        attributeType = CUtils.findBaseTypeOfRestriction( attributeType, wscontext);
-                        
-                        String attributeTypeAsString = CUtils.getBaseTypeOfRestrictionAsString( attributeType); 
-                        
-                        if( CUtils.isPointerType( attributeTypeAsString))
-                        {
-                            int pointerOffset = properParamName.indexOf("*");
-                            
-                            if( pointerOffset > 0)
-                                properParamName = properParamName.substring( 0, pointerOffset);
-                        }
-                    }
-                        
                     writer.write("\n"
                             + properParamName + " " + classname + "::get" + methodName
                             + "()\n{\n");
@@ -293,15 +271,16 @@
                             + "void " + classname + "::set"
                             + methodName + "(" + properParamName + " InValue");
                     
-                    isPointerType = false;
+                    Type attributeType = attribs[i].getType();
                     
+                    boolean isPointerType = false;
                     if (attributeType.isSimpleType())
                         isPointerType = CUtils.isPointerType(CUtils.getclass4qname(attributeType.getBaseType())); 
                     else
                         isPointerType = CUtils.isPointerType(getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]));
                     
-                    if((attribs[i].isSimpleType() || attributeType.isSimpleType()) &&
-                       (isPointerType || attribs[i].getAllElement() || attribs[i].getChoiceElement()))
+                    if((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) 
+                            && (isPointerType || attribs[i].getAllElement() || attribs[i].getChoiceElement()))
                         writer.write(", bool deep");
                     
                     writer.write(")\n{\n");
@@ -452,119 +431,36 @@
         writer.write( "\t}\n\n");
         
         writer.write("\t/* If there are any attributes serialize them. If there aren't then close the tag */\n");
-        // vvv FJP - 17667
         for (int i = 0; i < attributeParamCount; i++)
         {
-            AttributeInfo ai = attribs[i];
-            Type          type = ai.getType();
-            boolean       repeat = false;
-            int           countdown = 5;
-            
-            do
+            if (attribs[i].isArray() || !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
             {
-                repeat = false;
-                
-                if( type.isRestriction())
-                {
-                    writer.write("\t// A restricted type (base=" + type.getRestrictionBase() + ") has been found.  The following restrictions need to be applied:-\n");
-    
-                    Vector vre = type.getRestrictionEnumeration();
-                    Vector vrp = type.getRestrictionPattern();
-    
-                    if( vre != null)
-                    {
-                        writer.write("\t//\t Enumeration:\n");
-                        
-                        for( int j = 0; j < vre.size(); j++)
-                            writer.write("\t//\t\t " + vre.get( j) + "\n");
+                throw new WrapperFault("Error : an attribute is not basic type");
             }
-                    
-                    if( vrp != null)
-                    {
-                        writer.write("\t//\t Pattern:\n");
-                        
-                        for( int j = 0; j < vrp.size(); j++)
-                            writer.write("\t//\t\t " + vrp.get( j) + "\n");
-                    }
-                
-                    // Locate base type for restricted type
-                    String base = type.getRestrictionBase();
-                    String baseType = null;
-                    
-                    base = base.substring( base.indexOf( ":") + 1);
-                    baseType = CUtils.getclass4qname( new QName( WrapperConstants.SCHEMA_NAMESPACE, base));
-                    
-                    if( baseType == null)
-                    {
-                        Iterator itmt = wscontext.getTypemap().getTypes().iterator();
-                    
-                        while( itmt.hasNext())
-                        {
-                            Type t = (Type) itmt.next();
-                            
-                            if( t.getName().getLocalPart().equals( base))
-                            {
-                                type = t;
-                                repeat = true;
-                                countdown--;
-                                break;
-                            }
-                        }
-                    }
             else
             {
-                        baseType = baseType.substring( baseType.lastIndexOf( "_") + 1);
-                        
-                        type.setBaseType( new QName( WrapperConstants.SCHEMA_NAMESPACE, baseType));
-                        
-                        ai.setType( type);
-                    }
-                }
-            
-                if ((ai.isArray() || !(ai.isSimpleType() || ai.getType().isSimpleType())) && !repeat)
-                {
-                        throw new WrapperFault("Error : an attribute is not basic type");
-                }
-
-            } while( repeat && countdown > 0);
-            // ^^^ FJP - 17667
-            
-            //Samisa
                 //remove _Ref sufix and _ prefix in SOAP tag name
-            String soapTagName = ai.getParamName();
+                String soapTagName = attribs[i].getParamName();
                 if (soapTagName.lastIndexOf("_Ref") > -1)
                     soapTagName = soapTagName.substring(0, soapTagName.lastIndexOf("_Ref"));
                 
                 if (soapTagName.charAt(0) == '_')
                     soapTagName = soapTagName.substring(1, soapTagName.length());
 
-            //end remove _Ref sufix and _ prefix in SOAP tag name
-            boolean isPointerType = false;
+                Type type = attribs[i].getType();
                 String basicType = null;
                 
-            if (!ai.isSimpleType() && type.isSimpleType())
-            {
+                if (!attribs[i].isSimpleType() && type.isSimpleType())
                     basicType = CUtils.getclass4qname(type.getBaseType());
-
-                String    class4QName = CUtils.getclass4qname(type.getBaseType());
-                
-                isPointerType = CUtils.isPointerType( class4QName); 
-            }
                 else
+                    basicType = attribs[i].getTypeName();
+
+                if (CUtils.isPointerType(basicType))
                 {
-                basicType = ai.getTypeName();
-                isPointerType = CUtils.isPointerType(ai.getTypeName());
-                }
-                
-            if (isPointerType)
-                {
-                writer.write("\tif (0 != param->"
-                        + ai.getParamNameAsMember() + ")\n");
+                    writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n");
                     writer.write("\t\tpSZ->serializeAsAttribute(\""
-                        + soapTagName
-                        + "\", 0, (void*)(param->"
-                        + ai.getParamNameAsMember()
-                        + "), "
+                            + soapTagName + "\", 0, (void*)(param->"
+                            + attribs[i].getParamNameAsMember() + "), "
                             + CUtils.getXSDTypeForBasicType(basicType) + ");\n");
                 }
                 else
@@ -576,18 +472,8 @@
                             + "), "
                             + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName()) + ");\n");
                 }
-                
-                if (!attribs[i].isOptional())
-                {
-                    /* This avoid segmentation fault at runtime */
-                    /*
-                     * writer.write("\telse\n");
-                     * writer.write("\t\tAXISTRACE1(\"The mandatory attribute
-                     * "+attribs[i].getParamName()+" is not set\",
-                     * CRITICAL);\n");
-                     */
-                }
             }
+        }
         
         if (type.isFault())
         {
@@ -961,7 +847,7 @@
             else if (attribs[i].isArray())
             {
                 arrayCount++;
-                //if Array
+                
                 if (attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())
                 {
                     String baseTypeName = null;
@@ -1520,7 +1406,7 @@
         {            
             writer.write("int Check_Restrictions_" + classname + "(" + classname + " value)\n");
             
-            //TODO write code to check the restrictions.  FJP - Begun, but untested.
+            //TODO write code to check the restrictions. 
             
             writer.write("{\n");
             

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubHeaderWriter.java Thu Dec 21 22:35:36 2006
@@ -192,6 +192,8 @@
 
     /* (non-Javadoc)
      * @see org.apache.axis.wsdl.wsdl2ws.cpp.HeaderFileWriter#writePreprocssorStatements()
+     * TODO: Not sure why this method should not be the same as the one in literal/ directory - 
+     *       that is, move the one in literal dir here and remove it from literal/ClientStubHeaderWriter.java
      */
     protected void writePreprocessorStatements() throws WrapperFault
     {
@@ -201,10 +203,14 @@
             writer.write("#include <axis/OtherFaultException.hpp>\n");
             writer.write("#include <axis/ISoapAttachment.hpp>\n");
             writer.write("#include <axis/ISoapFault.hpp>\n");
+            writer.write("\n");
             writer.write("AXIS_CPP_NAMESPACE_USE\n");
+            writer.write("\n");
+            
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
             HashSet typeSet = new HashSet();
+            HashSet removeSet = new HashSet();
             String typeName = null;
             
             while (types.hasNext())
@@ -216,7 +222,14 @@
                 typeName = WrapperUtils.getLanguageTypeName4Type(atype);
                 if (null != typeName)
                     typeSet.add(typeName);
+          
+                if (atype.isRestriction())
+                    removeSet.add(atype.getLanguageSpecificName()  + "_Array");                
             }
+            
+            Iterator ritr = removeSet.iterator();
+            while (ritr.hasNext())
+                typeSet.remove(ritr.next());
             
             Iterator itr = typeSet.iterator();
             while (itr.hasNext())

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java Thu Dec 21 22:35:36 2006
@@ -294,11 +294,21 @@
 
                 writer.write("\tRet = NULL;\n");
             }
-            else if ("xsd__base64Binary".equals(outparamTypeName) 
-                        || "xsd__hexBinary".equals(outparamTypeName))
-                writer.write(outparamTypeName + "\tRet;\n");
             else
-                writer.write(outparamTypeName + "\tRet = " + CUtils.getInitValue(outparamTypeName) + ";\n");
+            {
+                String initValue = CUtils.getInitValue (outparamTypeName);
+                if (initValue != null)
+                    writer.write (outparamTypeName + " Ret = " + initValue + ";\n");
+                else if (outparamTypeName.equals ("xsd__dateTime")
+                            || outparamTypeName.equals ("xsd__date")
+                            || outparamTypeName.equals ("xsd__time"))
+                {
+                    writer.write (outparamTypeName + " Ret;\n");
+                    writer.write ("\tmemset(&Ret,0,sizeof(" + outparamTypeName + "));\n");
+                }
+                else
+                    writer.write (outparamTypeName + " Ret;\n");
+            }
         }
 
         //writer.write("\tchar* cFaultcode;\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParamCPPFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParamCPPFileWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParamCPPFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParamCPPFileWriter.java Thu Dec 21 22:35:36 2006
@@ -60,10 +60,6 @@
             
             if (type.isSimpleType())
                 writeRestrictionCheckerFunction();
-            else if( type.isRestriction())    // vvv FJP - 17667
-            {
-                writer.write( "\n// Type consists of purely 'restriction' information.\n// Currently no code has been written, but some may be required to check the restriction.\n\n");
-            } // ^^^ FJP - 17667              
             else
             {
                 writeGlobalCodes();

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java Thu Dec 21 22:35:36 2006
@@ -62,53 +62,20 @@
                     + getFileType().toUpperCase() + "_H__INCLUDED_\n\n");
 
             if (type.isSimpleType())
-            {
-                writeSimpleTypeWithEnumerations();
-            }
+                writeSimpleTypeWithRestrictions();
             else
-                {
-                classname = CUtils.sanitiseClassName( classname);
-
-                // vvv FJP - 17667
-                // Check that type is not a restriction
-                if( type.isRestriction())
-                {
-                    String	baseType = type.getRestrictionBase();
-
-                    baseType = baseType.substring( baseType.indexOf( ":") + 1);
-                    writer.write( "#include \"" + baseType + ".hpp\"\n\n");
-                    writer.write( "// " + classname + " is a restricted type (base=" + baseType + ").\n// The following restrictions need to be applied:-\n");
-
-                    Vector vre = type.getRestrictionEnumeration();
-                    Vector vrp = type.getRestrictionPattern();
-
-                    if( vre != null)
-                    {
-                        writer.write("//\t Enumeration:\n");
-                        
-                        for( int j = 0; j < vre.size(); j++)
-                        {
-                            writer.write("//\t\t " + vre.get( j) + "\n");
-                        }
-                    }
-                    
-                    if( vrp != null)
-                    {
-                        writer.write("//\t Pattern:\n");
-                        
-                        for( int j = 0; j < vrp.size(); j++)
-                        {
-                            writer.write("//\t\t " + vrp.get( j) + "\n");
-                        }
-                    }
-                    
-                    writer.write( "\ntypedef " + baseType + " " + classname + ";\n\n");                    
-                }
-                // ^^^ FJP - 17667
-                else
             {
                 writePreprocessorStatements();
 
+                writer.write("\n");
+                writer.write("/* ********************************************************************* */\n");
+                writer.write("/* --- Custom type                                                   --- */\n");
+                writer.write("/* ********************************************************************* */\n");
+                writer.write("\n");                
+                
+                
+                classname = CUtils.sanitiseClassName( classname);
+                
                 this.writer.write("class STORAGE_CLASS_INFO " + classname);
                 if (this.type.isFault())
                     this.writer.write(" : public SoapFaultException");
@@ -122,8 +89,7 @@
                 
                 writeFunctionPrototypes();
             }
-            }
-            
+            this.writer.write("\n");
             this.writer.write("#endif /* !defined(__" + classname.toUpperCase()
                     + "_" + getFileType().toUpperCase() + "_H__INCLUDED_)*/\n");
             writer.flush();
@@ -159,21 +125,11 @@
                 
                 if (type.isSimpleType())
                     isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
-				else if( type.isRestriction()) // vvv FJP - 17667
-			    {
-			        // Find base type of the restricted type.
-			        type = CUtils.findBaseTypeOfRestriction( type, wscontext);
-			        String restBaseClass = CUtils.getBaseTypeOfRestrictionAsString( type);
-
-			        if( type == null)
-			            System.out.println( "Warning - Could not find root base class of " + type.getName().getLocalPart());
-			        else if( restBaseClass != null)
-				        isPointerType = CUtils.isPointerType( restBaseClass);
-			    } // ^^^ FJP - 17667
                 else
                     isPointerType = CUtils.isPointerType(getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]));
 
-        	    if ((attribs[i].isSimpleType() || type.isSimpleType())
+                if ((attribs[i].isSimpleType() 
+                        || attribs[i].getType().isSimpleType()) 
                         && !attribs[i].isArray() 
                         && (isElementNillable(i) 
                                 || isElementOptional(i) 
@@ -196,14 +152,13 @@
         }
     }
 
-    protected void writeSimpleTypeWithEnumerations() throws WrapperFault
+    protected void writeSimpleTypeWithRestrictions() throws WrapperFault
     {
         try
         {
             writer.write("#include <axis/AxisUserAPI.hpp>\n");
             writer.write("#include <axis/AxisUserAPIArrays.hpp>\n");
-            writer.write("AXIS_CPP_NAMESPACE_USE \n\n");
-
+            
             Vector restrictionData = type.getEnumerationdata();
             if (restrictionData == null)
                 return;
@@ -211,11 +166,26 @@
             TypeEntry baseEType = (TypeEntry) restrictionData.firstElement();
             QName baseType = baseEType.getQName();
             if (!CUtils.isSimpleType(baseType))
-                return;
+                return;   
+            
+            String baseTypeName = CUtils.getclass4qname(baseType);
+            String langTypeName;
+            
+            // User defined simple type based on another user-defined simple type
+            String  restrictionBaseType = type.getRestrictionBaseType();
+            if (null != restrictionBaseType )
+            {  
+                langTypeName = CUtils.sanitiseClassName(restrictionBaseType);               
+                writer.write( "#include \"" + langTypeName + ".hpp\"\n\n");
+            }
+            else
+                langTypeName = baseTypeName;
+            
+            writer.write("AXIS_CPP_NAMESPACE_USE \n\n");
 
             writer.write("\n");
             writer.write("/* ********************************************************************* */\n");
-            writer.write("/* --- Simple types and enumerations                                 --- */\n");
+            writer.write("/* --- Simple types and restrictions                                 --- */\n");
             writer.write("/* ********************************************************************* */\n");
             writer.write("\n");  
 
@@ -234,14 +204,14 @@
                     break;
             }            
             
-            String langTypeName = CUtils.getclass4qname(baseType);
             writer.write("typedef ");
-            if (CUtils.isPointerType(CUtils.getclass4qname(baseType)) 
-                    || "xsd__base64Binary".equals(CUtils.getclass4qname(baseType)) 
-                    || "xsd__hexBinary".equals(CUtils.getclass4qname(baseType)))
+            if (CUtils.isPointerType(baseTypeName) 
+                    || "xsd__base64Binary".equals(baseTypeName) 
+                    || "xsd__hexBinary".equals(baseTypeName))
             {
                 writer.write(langTypeName + " " + classname + ";\n");
                 writer.write("typedef " + langTypeName + "_Array " + classname + "_Array;\n");
+                writer.write("\n");
                 
                 for (int i = 1; i < restrictionData.size(); i++)
                 {
@@ -269,11 +239,14 @@
             } 
             else if ("int".equals(baseType.getLocalPart()))
             {
+                writer.write(langTypeName + " " + classname + ";\n");
+                writer.write("typedef " + langTypeName + "_Array " + classname + "_Array;\n");
+            
                 if (restrictionData.size() > 1)
                 {
                     //there are enumerations or min/maxInclusive
                     boolean isEnum = false;
-                    boolean hasRestrictionItems = false;
+
                     for (int i = 1; i < restrictionData.size(); i++)
                     {
                         QName value = (QName) restrictionData.elementAt(i);
@@ -283,7 +256,7 @@
                             if (i > 1)
                                 writer.write(", ");
                             else
-                                writer.write(" enum { ");
+                                writer.write("typedef enum { ");
 
                             writer.write("ENUM" + classname.toUpperCase() + "_"
                                     + value.getNamespaceURI() + "="
@@ -291,35 +264,25 @@
                         } 
                         else if ("minInclusive".equals(value.getLocalPart()))
                         {
-                            hasRestrictionItems = true;
-                            if (i <= 1)
-                                writer.write(langTypeName + " " + classname + ";\n");
-                            
                             writer.write("static const int " + classname
                                     + "_MinInclusive = " + value.getNamespaceURI() + ";\n");
                         } 
                         else if ("maxInclusive".equals(value.getLocalPart()))
                         {
-                            hasRestrictionItems = true;
-                            if (i <= 1)
-                                writer.write(langTypeName + " " + classname + ";\n");
-
                             writer.write("static const int " + classname
                                     + "_MaxInclusive = " + value.getNamespaceURI() + ";\n");
                         }
                     }
                     
                     if (isEnum)
-                        writer.write("} " + classname + ";\n");
-                    else if (!hasRestrictionItems)
-                        writer.write(langTypeName + " " + classname + ";\n");
+                        writer.write("} " + classname + "_Enum;\n");
                 } 
-                else
-                    writer.write(langTypeName + " " + classname + ";\n");
             } 
             else
             {
                 writer.write(langTypeName + " " + classname + ";\n");
+                writer.write("typedef " + langTypeName + "_Array " + classname + "_Array;\n");
+                
                 for (int i = 1; i < restrictionData.size(); i++)
                 {
                     QName value = (QName) restrictionData.elementAt(i);
@@ -353,7 +316,7 @@
             writer.write("public:\n");
             for (int i = 0; i < attribs.length; i++)
             {
-                attribs[i].setParamName( CUtils.sanitiseAttributeName( classname, attribs[i].getParamName()));
+                attribs[i].setParamName( CUtils.sanitiseAttributeName(classname, attribs[i].getParamName()));
                 
                 if (isElementNillable(i) 
                         || attribs[i].isArray() 
@@ -375,7 +338,8 @@
                         if (!paramName.endsWith("*"))
                             paramName += " *";
                         
-                        if (!attribs[i].isSimpleType() && attribs[i].getType().isSimpleType())
+                        if ((!attribs[i].isSimpleType() && attribs[i].getType().isSimpleType()) 
+                                || attribs[i].getType().isRestriction())
                             writer.write("\t");
                         else
                             writer.write("\tclass ");
@@ -409,28 +373,7 @@
                             + Integer.toString(anyCounter)
                             + ";\n");
                 }
-				else
-				{
-			        // vvv FJP - 17667
-					if( attribs[i].getType().isRestriction())
-					{
-					    String  typeName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
-					    Type    baseType = CUtils.findBaseTypeOfRestriction( attribs[i].getType(), wscontext);
-					    boolean	isPointer = CUtils.isPointerType( CUtils.getBaseTypeOfRestrictionAsString( baseType));
                     
-					    if( isPointer)
-					    {
-					        int	pointerPos = typeName.indexOf( "*");
-					        
-					        if( pointerPos > 0)
-					        {
-					            typeName = typeName.substring( 0, pointerPos);
-					        }
-					    }
-					    
-					    writer.write( "\t" + typeName + " " + attribs[i].getParamNameWithoutSymbols() + ";\n");
-					}
-			        // ^^^ FJP - 17667
                 else
                 {
                     writer.write("\t"
@@ -439,7 +382,6 @@
                                 + ";\n");
                 }
             }
-            }
             
             if (extensionBaseAttrib != null &&
                 getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib) != null)
@@ -568,46 +510,25 @@
                 }
                 else 
                 {
-                    // vvv FJP - 17667
+                    writer.write("\n\t"
+                                + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+                                + " get" + methodName + "();\n");
+
+                    writer.write("\t"
+                                + "void set" + methodName + "("
+                                + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
+                                + " InValue");
+                    
                     Type type = attribs[i].getType();
                     boolean isPointerType = false;
-                    String	typeName = getCorrectParmNameConsideringArraysAndComplexTypes( attribs[i]);
-                    
-                    // Check for restriction.  If found, then find base type.
-                    if( type.isRestriction())
-                    {
-                        type = CUtils.findBaseTypeOfRestriction( type, wscontext);
-                    }
                     
                     if (type.isSimpleType())
                         isPointerType = CUtils.isPointerType(CUtils.getclass4qname(type.getBaseType())); 
                     else
                         isPointerType = CUtils.isPointerType(getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]));
                     
-                    if( type.isRestriction() && isPointerType)
-                    {
-                        int pointerLocation = typeName.indexOf( "*");
-                        
-                        if( pointerLocation > 0)
-                        {
-                            typeName = typeName.substring( 0, pointerLocation);
-                        }
-                    }
-                    // ^^^ FJP - 17667
-
-                    
-                    writer.write("\n\t"
-                            + typeName
-                            + " get" + methodName + "();\n");
-
-                    writer.write("\t"
-                            + "void set" + methodName + "("
-                            + typeName
-                            + " InValue");
-                
-
                     if ( (attribs[i].getAllElement() || attribs[i].getChoiceElement() || isPointerType) 
-                         && (attribs[i].isSimpleType() || type.isSimpleType()))
+                         && (attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
                         writer.write(", bool deep = true");
                     
                     writer.write(");\n");
@@ -708,7 +629,7 @@
             
             writer.write("extern int Axis_DeSerialize_" + typeName
                     + "(" + typeName + "* param, IWrapperSoapDeSerializer* pDZ);\n");
-            writer.write("extern void* Axis_Create_" + typeName + "(int nSize);\n");
+            writer.write("extern void* Axis_Create_" + typeName + "(int nSize=0);\n");
             writer.write("extern void Axis_Delete_" + typeName + "("
                     + typeName + "* param, int nSize=0);\n");
             writer.write("extern int Axis_Serialize_" + typeName + "("
@@ -739,6 +660,7 @@
             if (this.type.isFault())
             {
                 writer.write("#include <axis/SoapFaultException.hpp>\n");
+                writer.write("\n");
                 writer.write("using namespace std;\n");
             }
             
@@ -746,15 +668,33 @@
             HashSet typeSet = new HashSet();
             for (int i = 0; i < attribs.length; i++)
             {
-                if ((attribs[i].isArray()) && 
-                        !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
-                    typeSet.add(attribs[i].getTypeName() + "_Array");
-
-                if (!(attribs[i].isSimpleType() || attribs[i].isAnyType()))
-                    typeSet.add(attribs[i].getTypeName());
+                String basicType = attribs[i].getTypeName();
+                Type theType = attribs[i].getType();
+                
+                if (theType.isRestriction() && !CUtils.isSimpleType(basicType))
+                    typeSet.add(basicType);
+                else if (!attribs[i].isSimpleType())
+                {
+                    if ((attribs[i].isArray()) && !theType.isSimpleType())
+                        typeSet.add(basicType + "_Array");
+    
+                    if (!attribs[i].isAnyType())
+                        typeSet.add(basicType);
+                }
             }
             
+            if (extensionBaseAttrib != null 
+                    && getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib) != null)
+            {
+                String extBaseType = getCorrectParmNameConsideringArraysAndComplexTypes(extensionBaseAttrib);
+                if (!CUtils.isSimpleType(extBaseType))
+                    typeSet.add(extBaseType);
+            }            
+            
             Iterator itr = typeSet.iterator();
+             if (itr.hasNext())
+                writer.write("\n"); 
+                
             while (itr.hasNext())
             {
                 // Do not want to include the header file we are generating!
@@ -777,12 +717,11 @@
             for (int i = 0; i < attribs.length; i++)
             {
                 if (!attribs[i].isArray() && 
-				    !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()) &&
-					!attribs[i].isAnyType() &&
-					!attribs[i].getType().isRestriction())
+                        !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())
+                        && !attribs[i].isAnyType())
 				{
                     typeSet.add(attribs[i].getTypeName());
-            }
+                } 
             }
             
             itr = typeSet.iterator();

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java Thu Dec 21 22:35:36 2006
@@ -399,10 +399,10 @@
             		else
             		{
             		    writer.write("\n\t" + paraTypeName + " v" + i);
-            		    if (!"xsd__base64Binary".equals(paraTypeName) && !"xsd__hexBinary".equals(paraTypeName) )
-            		    {
-            		        writer.write(" = " + CUtils.getInitValue(paraTypeName));
-            		    }
+                        String typeInitValue = CUtils.getInitValue(paraTypeName);
+            		    if (typeInitValue != null)
+            		        writer.write(" = " + typeInitValue);
+
             		    writer.write(";\n");
 	            		writer.write("\t"
 							+ paraTypeName

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java Thu Dec 21 22:35:36 2006
@@ -182,7 +182,10 @@
             writer.write("#include <axis/OtherFaultException.hpp>\n");
             writer.write("#include <axis/ISoapAttachment.hpp>\n");
             writer.write("#include <axis/ISoapFault.hpp>\n");
+            writer.write("\n");
             writer.write("AXIS_CPP_NAMESPACE_USE\n");
+            writer.write("\n");
+            
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
             HashSet typeSet = new HashSet();
@@ -190,18 +193,22 @@
             while (types.hasNext())
             {
                 atype = (Type) types.next();
-                if(atype.isExternalized())
-                {
-                    if (atype.isArray())
-                        if (atype.getElementType().equals("string"))
-                            removeSet.add(atype.getLanguageSpecificName());
-                    
-                    if (atype.getBaseType() != null)
-                        if (atype.getBaseType().getLocalPart().equals("string"))
-                            removeSet.add(atype.getLanguageSpecificName() + "_Array");
+                
+                if (!atype.isExternalized())
+                    continue;
 
-                    typeSet.add(atype.getLanguageSpecificName());
-                }
+                if (atype.isArray())
+                    if (atype.getElementType().equals("string"))
+                        removeSet.add(atype.getLanguageSpecificName());
+                
+                if (atype.getBaseType() != null)
+                    if (atype.getBaseType().getLocalPart().equals("string"))
+                        removeSet.add(atype.getLanguageSpecificName() + "_Array");
+                
+                if (atype.isRestriction())
+                    removeSet.add(atype.getLanguageSpecificName()  + "_Array");
+
+                typeSet.add(atype.getLanguageSpecificName());
             }
             
             Iterator ritr = removeSet.iterator();

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java?view=diff&rev=489565&r1=489564&r2=489565
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java Thu Dec 21 22:35:36 2006
@@ -235,9 +235,9 @@
                 else
                 {
                     writer.write("\n\t" + paraTypeName + " v" + i);
-                    if (!"xsd__base64Binary".equals(paraTypeName) 
-                            && !"xsd__hexBinary".equals(paraTypeName))
-                        writer.write(" = " + CUtils.getInitValue(paraTypeName));
+                    String typeInitValue = CUtils.getInitValue(paraTypeName);
+                    if (typeInitValue != null)
+                        writer.write(" = " + typeInitValue);
 
                     writer.write(";\n");
                     writer.write("\t"



---------------------------------------------------------------------
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