axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r332271 - in /webservices/axis/trunk/c: src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ tests/auto_build/testcases/ tests/auto_build/testcases/client/cpp/ tests/auto_build/testcases/output/ test...
Date Thu, 10 Nov 2005 11:00:52 GMT
Author: dicka
Date: Thu Nov 10 03:00:39 2005
New Revision: 332271

URL: http://svn.apache.org/viewcvs?rev=332271&view=rev
Log:
Further updates to resolve Jira issue AXISCPP-149. 

This update is the second stage, covering arrays of (xsd) simple types within complex types.

Modified:
    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/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays.cpp.out
    webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays_ServerResponse.expected
    webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list
    webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/Arrays.wsdl

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/BeanParamWriter.java?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- 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 Nov 10 03:00:39 2005
@@ -148,102 +148,122 @@
         {
 			for (int i = 0; i < attribs.length; i++)
             {
-                // FJP Nillable vv
-                if (isElementNillable(i))
-                {
-					String parameterName = attribs[i]
-							.getParamNameWithoutSymbols();
-					String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
-
-					if (attribs[i].isAnyType())
-                    {
-                        anyCounter += 1;
-                    	parameterName = parameterName + Integer.toString(anyCounter);
-                    }
-					
-					writer.write("\n" + properParamName + " * " + classname
-							+ "::get" + parameterName + "()\n{\n");
-
-					writer.write("\t" + "return " + parameterName + " ; \n}\n");
-
-					writer.write("\n" + "void " + classname + "::set"
-							+ parameterName + "(" + properParamName
-							+ " * pInValue)\n{\n");
-
-					writer.write("\t" + parameterName + " = pInValue ; \n");
-
-					if (attribs[i].getChoiceElement())
-                    {
-                        for (int j = 0; j < attribs.length; j++)
-                        {
-                            if ((attribs[j].getChoiceElement()) && (j != i))
-                            {
-								writer.write("\t"
-										+ attribs[j]
-												.getParamNameWithoutSymbols()
-										+ " = NULL ; \n");
+			    String parameterName = attribs[i]
+			       							.getParamNameWithoutSymbols();
+				String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
+				
+				if (attribs[i].isArray())
+				{
+                    writer.write("\n" + properParamName + " * " + classname
+                            + "::get" + parameterName + "()\n{\n");
+
+                    writer.write("\t" + "return " + parameterName + " ; \n}\n");
+
+                    writer.write("\n" + "void " + classname + "::set"
+                            + parameterName + "(" + properParamName
+                            + " * pInValue)\n{\n");
+
+                    writer.write("\tif(" + parameterName + " == NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\t" + parameterName + " = new " + properParamName + "();\n");
+                    writer.write("\t}\n");
+                    writer.write("\t" + parameterName + "->clone(*pInValue); \n");
+                    writer.write("}\n");
+                }
+				else
+				{
+	                // FJP Nillable vv
+	                if (isElementNillable(i))
+	                {
+						
+	
+						if (attribs[i].isAnyType())
+	                    {
+	                        anyCounter += 1;
+	                    	parameterName = parameterName + Integer.toString(anyCounter);
+	                    }
+						
+						writer.write("\n" + properParamName + " * " + classname
+								+ "::get" + parameterName + "()\n{\n");
+	
+						writer.write("\t" + "return " + parameterName + " ; \n}\n");
+	
+						writer.write("\n" + "void " + classname + "::set"
+								+ parameterName + "(" + properParamName
+								+ " * pInValue)\n{\n");
+	
+						writer.write("\t" + parameterName + " = pInValue ; \n");
+	
+						if (attribs[i].getChoiceElement())
+	                    {
+	                        for (int j = 0; j < attribs.length; j++)
+	                        {
+	                            if ((attribs[j].getChoiceElement()) && (j != i))
+	                            {
+									writer.write("\t"
+											+ attribs[j]
+													.getParamNameWithoutSymbols()
+											+ " = NULL ; \n");
+								}
 							}
 						}
-					}
-
-					writer.write("}\n");
-				} 
-                else 
-                {
-					// FJP Nillable ^^
-					/**
-					 * Dushshantha: Write getter
-					 */
-
-					String parameterName = attribs[i].getParamNameWithoutSymbols();
-                    String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
-                    
-                    if (attribs[i].isAnyType())
-                    {
-                        anyCounter += 1;
-                    	parameterName = parameterName + Integer.toString(anyCounter);
-                    }
-
-                    writer.write("\n"
-                                    + properParamName
-                                    + " " + classname + "::get"
-                                    + parameterName
-                                    + "()\n{\n");
-
-                    writer.write("\t" + "return "
-                            + parameterName
-                            + " ; \n}\n");
-
-					/**
-					 * Dushshantha: Write setter
-					 */
-
-                    writer.write("\n"
-                            + "void "
-                            + classname
-                            + "::set"
-                            + parameterName
-                            + "("
-                            + properParamName
-                            + " InValue)\n{\n");
-
-                    writer.write("\t" + parameterName
-                            + " = InValue ; \n");
-
-					if (attribs[i].getChoiceElement())
-                    {
-                        for (int j = 0; j < attribs.length; j++)
-                        {
-                            if ((attribs[j].getChoiceElement()) && (j != i))
-                            {
-								writer.write("\t"
-										+ attribs[j].getParamNameWithoutSymbols()
-										+ " = NULL ; \n");
+	
+						writer.write("}\n");
+					} 
+	                else 
+	                {
+						// FJP Nillable ^^
+						/**
+						 * Dushshantha: Write getter
+						 */
+	                    
+	                    if (attribs[i].isAnyType())
+	                    {
+	                        anyCounter += 1;
+	                    	parameterName = parameterName + Integer.toString(anyCounter);
+	                    }
+	
+	                    writer.write("\n"
+	                                    + properParamName
+	                                    + " " + classname + "::get"
+	                                    + parameterName
+	                                    + "()\n{\n");
+	
+	                    writer.write("\t" + "return "
+	                            + parameterName
+	                            + " ; \n}\n");
+	
+						/**
+						 * Dushshantha: Write setter
+						 */
+	
+	                    writer.write("\n"
+	                            + "void "
+	                            + classname
+	                            + "::set"
+	                            + parameterName
+	                            + "("
+	                            + properParamName
+	                            + " InValue)\n{\n");
+	
+	                    writer.write("\t" + parameterName
+	                            + " = InValue ; \n");
+	
+						if (attribs[i].getChoiceElement())
+	                    {
+	                        for (int j = 0; j < attribs.length; j++)
+	                        {
+	                            if ((attribs[j].getChoiceElement()) && (j != i))
+	                            {
+									writer.write("\t"
+											+ attribs[j].getParamNameWithoutSymbols()
+											+ " = NULL ; \n");
+								}
 							}
 						}
+	
+						writer.write("}\n");
 					}
-
-					writer.write("}\n");
 				}
 			}
 		} 
@@ -357,9 +377,9 @@
 				//if Array
 				if (attribs[i].isSimpleType()) 
                 {
-					writer.write("\tpSZ->serializeBasicArray((Axis_Array*)(&param->"
+					writer.write("\tpSZ->serializeBasicArray(param->"
 									+ attribs[i].getParamNameAsMember()
-									+ "),"
+									+ ","
 									+ CUtils.getXSDTypeForBasicType(attribs[i]
 											.getTypeName())
 									+ ", \""
@@ -779,6 +799,13 @@
 		try 
         {
 			writer.write("\n" + classname + "::" + classname + "()\n{\n");
+			for (int i = 0 ; i < attribs.length ; i++)
+			{
+			    if (attribs[i].isArray())
+			    {
+			        writer.write("\t" + attribs[i].getParamNameAsMember() + " = NULL;\n");
+			    }
+			}
             writer.write("\t reset();\n");
             writer.write("}\n");
 
@@ -808,10 +835,10 @@
             {
 				if (attribs[i].isArray()) 
                 {
-					writer.write("\t" + attribs[i].getParamNameAsMember()
-							+ ".m_Array = 0;\n");
-					writer.write("\t" + attribs[i].getParamNameAsMember()
-							+ ".m_Size = 0;\n");
+                    writer.write("\tif ( " + attribs[i].getParamNameAsMember() + " != NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\t" + attribs[i].getParamNameAsMember() + "->clear();\n");
+                    writer.write("\t}\n");
 				} 
                 else if (!attribs[i].isSimpleType()) 
                 {
@@ -877,18 +904,8 @@
             {
 				if (attribs[i].isArray()) 
                 {
-					if (attribs[i].getChoiceElement())
-                    {
-						writer.write("\tdelete [] ((" + attribs[i].getTypeName()
-							+ "*)" + attribs[i].getParamNameAsMember()
-							+ "->m_Array);\n");
-                    }
-					else
-                    {
-						writer.write("\tdelete [] ((" + attribs[i].getTypeName()
-							+ "*)" + attribs[i].getParamNameAsMember()
-							+ ".m_Array);\n");
-                    }
+					writer.write("\tdelete " + attribs[i].getParamNameAsMember()
+						+ ";\n");
 				}
 				
 				else if (attribs[i].isAnyType())

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ParmHeaderFileWriter.java?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- 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 Nov 10 03:00:39 2005
@@ -92,7 +92,7 @@
 					attribs[i].setParamName("m_" + attribs[i].getParamName());
 				}
 				// FJP Nillable vv
-				if (isElementNillable(i)) {
+				if (isElementNillable(i) || attribs[i].isArray()) {
 					
 					if(attribs[i].isAnyType()){
 						anyCounter += 1;
@@ -168,7 +168,7 @@
                     }
                 }
 				
-				if (isElementNillable(i)) {
+				if (isElementNillable(i) || attribs[i].isArray()) {
 					if ( attribs[i].isAnyType()){
 						anyCounter += 1;
 
@@ -330,6 +330,7 @@
 	protected void writePreprocessorStatements() throws WrapperFault {
 		try {
 			writer.write("#include <axis/AxisUserAPI.hpp>\n");
+			writer.write("#include <axis/AxisUserAPIArrays.hpp>\n");
 			if (this.type.isFault()) {
 				writer.write("#include <axis/SoapFaultException.hpp>\n");
 				writer.write("using namespace std;\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/BeanParamWriter.java
Thu Nov 10 03:00:39 2005
@@ -148,18 +148,12 @@
             {
                 attribs[i].setParamName( CUtils.sanitiseAttributeName( classname, attribs[i].getParamName()));
 
-                // FJP Nillable vv
-                if (isElementNillable(i))
+            	String methodName = attribs[i].getParamNameWithoutSymbols();
+                String parameterName = methodName;
+                String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
+
+                if (attribs[i].isArray())
                 {
-                    String parameterName = attribs[i].getParamNameWithoutSymbols();
-                    String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
-                    
-                    if (attribs[i].isAnyType())
-                    {                    	
-                    	anyCounter += 1;
-                    	parameterName = parameterName + Integer.toString(anyCounter);
-                    }
-                    
                     writer.write("\n" + properParamName + " * " + classname
                             + "::get" + parameterName + "()\n{\n");
 
@@ -169,91 +163,119 @@
                             + parameterName + "(" + properParamName
                             + " * pInValue)\n{\n");
 
-                    writer.write("\t" + parameterName + " = pInValue ; \n");
-
-                    if (attribs[i].getChoiceElement())
-                    {
-                        for (int j = 0; j < attribs.length; j++)
-                        {
-                            if ((attribs[j].getChoiceElement()) && (j != i))
-                            {
-                                writer.write("\t"
-                                        + attribs[j].getParamNameWithoutSymbols()
-                                        + " = NULL ; \n");
-                            }
-                        }
-                    }
-
+                    writer.write("\tif(" + parameterName + " == NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\t" + parameterName + " = new " + properParamName + "();\n");
+                    writer.write("\t}\n");
+                    writer.write("\t" + parameterName + "->clone(*pInValue); \n");
                     writer.write("}\n");
-                } 
+                }
                 else
                 {
-                    // FJP Nillable ^^
-
-                    /**
-                     * Dushshantha: Write getter
-                     */
-                	String methodName = attribs[i].getParamNameWithoutSymbols();
-                    String parameterName = methodName;
-                    String properParamName = getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i]);
-
-                    if( methodName.endsWith( "_"))
-                    {
-                        String localMethodName = methodName.substring( 0, methodName.length()
- 1);
-                        
-                        if( localMethodName.equals( classname))
-                        {
-                            methodName = localMethodName; 
-                        }
-                    }
-                    
-                    if (attribs[i].isAnyType())
-                    {                    	
-                    	anyCounter += 1;
-                    	parameterName = parameterName + Integer.toString(anyCounter);
-                    	methodName = methodName + Integer.toString(anyCounter);
-                    }
-
-                    writer.write("\n"
-                            + properParamName
-                            + " " + classname + "::get"
-                            + methodName
-                            + "()\n{\n");
-
-                    writer.write("\t" + "return "
-                            + parameterName
-                            + " ; \n}\n");
-
-                    /**
-                     * Dushshantha: Write setter
-                     */
-
-                    writer.write("\n"
-                            + "void "
-                            + classname
-                            + "::set"
-                            + methodName
-                            + "("
-                            + properParamName
-                            + " InValue)\n{\n");
-
-                    writer.write("\t" + parameterName
-                            + " = InValue ; \n");
-
-                    if (attribs[i].getChoiceElement())
-                    {
-                        for (int j = 0; j < attribs.length; j++)
-                        {
-                            if ((attribs[j].getChoiceElement()) && (j != i))
-                            {
-                                writer.write("\t"
-                                        + attribs[j].getParamNameWithoutSymbols()
-                                        + " = NULL ; \n");
-                            }
-                        }
-                    }
-
-                    writer.write("}\n");
+	                // FJP Nillable vv
+	                if (isElementNillable(i))
+	                {
+	                    
+	                    
+	                    if (attribs[i].isAnyType())
+	                    {                    	
+	                    	anyCounter += 1;
+	                    	parameterName = parameterName + Integer.toString(anyCounter);
+	                    }
+	                    
+	                    writer.write("\n" + properParamName + " * " + classname
+	                            + "::get" + parameterName + "()\n{\n");
+	
+	                    writer.write("\t" + "return " + parameterName + " ; \n}\n");
+	
+	                    writer.write("\n" + "void " + classname + "::set"
+	                            + parameterName + "(" + properParamName
+	                            + " * pInValue)\n{\n");
+	
+	                    writer.write("\t" + parameterName + " = pInValue ; \n");
+	
+	                    if (attribs[i].getChoiceElement())
+	                    {
+	                        for (int j = 0; j < attribs.length; j++)
+	                        {
+	                            if ((attribs[j].getChoiceElement()) && (j != i))
+	                            {
+	                                writer.write("\t"
+	                                        + attribs[j].getParamNameWithoutSymbols()
+	                                        + " = NULL ; \n");
+	                            }
+	                        }
+	                    }
+	
+	                    writer.write("}\n");
+	                } 
+	                else
+	                {
+	                    // FJP Nillable ^^
+	
+	                    /**
+	                     * Dushshantha: Write getter
+	                     */
+	
+	
+	                    if( methodName.endsWith( "_"))
+	                    {
+	                        String localMethodName = methodName.substring( 0, methodName.length()
- 1);
+	                        
+	                        if( localMethodName.equals( classname))
+	                        {
+	                            methodName = localMethodName; 
+	                        }
+	                    }
+	                    
+	                    if (attribs[i].isAnyType())
+	                    {                    	
+	                    	anyCounter += 1;
+	                    	parameterName = parameterName + Integer.toString(anyCounter);
+	                    	methodName = methodName + Integer.toString(anyCounter);
+	                    }
+	
+	                    writer.write("\n"
+	                            + properParamName
+	                            + " " + classname + "::get"
+	                            + methodName
+	                            + "()\n{\n");
+	
+	                    writer.write("\t" + "return "
+	                            + parameterName
+	                            + " ; \n}\n");
+	
+	                    /**
+	                     * Dushshantha: Write setter
+	                     */
+	
+	                    writer.write("\n"
+	                            + "void "
+	                            + classname
+	                            + "::set"
+	                            + methodName
+	                            + "("
+	                            + properParamName
+	                            + " InValue)\n{\n");
+	
+	                    writer.write("\t" + parameterName
+	                            + " = InValue ; \n");
+	
+	                    if (attribs[i].getChoiceElement())
+	                    {
+	                        for (int j = 0; j < attribs.length; j++)
+	                        {
+	                            if ((attribs[j].getChoiceElement()) && (j != i))
+	                            {
+	                                writer.write("\t"
+	                                        + attribs[j].getParamNameWithoutSymbols()
+	                                        + " = NULL ; \n");
+	                            }
+	                        }
+	                    }
+	
+	                    writer.write("}\n");
+	                }
                 }
             }
         } 
@@ -445,37 +467,16 @@
                 //if Array
                 if (attribs[i].isSimpleType())
                 {
-                	/**
-                     * Dushshantha: If the element is a Choice, It should be
-                     * treated as a pointer to an array. Chinthana: This is the
-                     * same in 'all' element
-                     */
-
-                    if(attribs[i].getChoiceElement()||attribs[i].getAllElement())
-                    {
-                    	writer.write("\tpSZ->serializeBasicArray((Axis_Array*)(param->"
-                                + attribs[i].getParamName()
-                                + "), Axis_URI_"
-                                + classname
-                                + ","
-                                + CUtils.getXSDTypeForBasicType(attribs[i]
-                                                .getTypeName())
-                                + ", \""
-                                + attribs[i].getParamNameAsSOAPElement()
-                                + "\");\n");
-                    }
-                    else
-                    {
-                        writer.write("\tpSZ->serializeBasicArray((Axis_Array*)(&param->"
-                                + attribs[i].getParamName()
-                                + "), Axis_URI_"
-                                + classname
-                                + ","
-                                + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName())
-                                + ", \""
-                                + attribs[i].getParamNameAsSOAPElement()
-                                + "\");\n");
-                    }
+                	writer.write("\tpSZ->serializeBasicArray(param->"
+                            + attribs[i].getParamName()
+                            + ", Axis_URI_"
+                            + classname
+                            + ","
+                            + CUtils.getXSDTypeForBasicType(attribs[i]
+                                            .getTypeName())
+                            + ", \""
+                            + attribs[i].getParamNameAsSOAPElement()
+                            + "\");\n");
                 }
                 else
                 {
@@ -723,7 +724,7 @@
         {
             if (attribs[i].isArray())
             {
-                writer.write("\tAxis_Array array;\n\n");
+                writer.write("\tAxis_Array * array;\n\n");
                 break;
             }
         }
@@ -801,86 +802,12 @@
                             + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName()) + ",
\""
                             + attribs[i].getParamNameAsSOAPElement()
                             + "\",0);\n");
-
-                    String typename = attribs[i].getTypeName();
-                    
-                    if (CUtils.isPointerType(typename))
-                    {
-                        if (attribs[i].getChoiceElement())
-                        {
-                            writer.write("\tparam->"
-                                    + attribs[i].getParamNameAsMember()
-                                    + "->m_Array = ("
-                                    + attribs[i].getTypeName() + "*)new "
-                                    + attribs[i].getTypeName()
-                                    + "[array.m_Size];\n");
-                        }
-                        else
-                        {
-                            writer.write("\tparam->"
-                                    + attribs[i].getParamNameAsMember()
-                                    + ".m_Array = (" + attribs[i].getTypeName()
-                                    + "*)new " + attribs[i].getTypeName()
-                                    + "[array.m_Size];\n");
-                        }
-                    }
-                    else
-                    {
-                        /**
-                         * Dushshantha: If the element is a Choice, It should be
-                         * treated as a pointer to an array. Chinthana: This is
-                         * the same in 'all' element
-                         */
-
-                        if (attribs[i].getChoiceElement()
-                                || attribs[i].getAllElement())
-                        {
-                            writer.write("\tparam->"
-                                    + attribs[i].getParamNameAsMember()
-                                    + "->m_Array = ("
-                                    + attribs[i].getTypeName() + "**)new "
-                                    + attribs[i].getTypeName()
-                                    + "*[array.m_Size];\n");
-                        }
-                        else
-                        {
-                            writer.write("\tparam->"
-                                    + attribs[i].getParamNameAsMember()
-                                    + ".m_Array = (" + attribs[i].getTypeName()
-                                    + "**)new " + attribs[i].getTypeName()
-                                    + "*[array.m_Size];\n");
-                        }
-                    }
-
-                    /**
-                     * Dushshantha: If the element is a Choice, It should be
-                     * treated as a pointer to an array. Chinthana: This is the
-                     * same in 'all' element
-                     */
-
-                    if (attribs[i].getChoiceElement()
-                            || attribs[i].getAllElement())
-                    {
-                        writer.write("\tparam->"
-                                + attribs[i].getParamNameAsMember()
-                                + "->m_Size = array.m_Size;\n\n");
-                        writer.write("\tmemcpy( param->"
-                                + attribs[i].getParamNameAsMember()
-                                + "->m_Array, array.m_Array, sizeof( "
-                                + attribs[i].getTypeName()
-                                + " *) * array.m_Size);\n");
-                    }
-                    else
-                    {
-                        writer.write("\tparam->"
-                                + attribs[i].getParamNameAsMember()
-                                + ".m_Size = array.m_Size;\n\n");
-                        writer.write("\tmemcpy( param->"
-                                + attribs[i].getParamNameAsMember()
-                                + ".m_Array, array.m_Array, sizeof( "
-                                + attribs[i].getTypeName()
-                                + " *) * array.m_Size);\n");
-                    }
+                    writer.write("\tif(param->" + attribs[i].getParamNameAsMember() +
" == NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + "
= new " + attribs[i].getTypeName() + "_Array();\n");
+                    writer.write("\t}\n");
+                    writer.write("\tparam->" + attribs[i].getParamNameAsMember() + "->clone(
*array);\n");
+                    writer.write("\tAxis::AxisDelete((void*) array, XSD_ARRAY);\n\n");
                 }
                 else
                 {
@@ -1189,7 +1116,14 @@
         try
         {
             writer.write("\n" + classname + "::" + classname + "()\n{\n");
-            writer.write("\t reset();\n");
+            for (int i = 0 ; i < attribs.length ; i++)
+            {
+                if (attribs[i].isArray())
+                {
+                    writer.write("\t" + attribs[i].getParamNameAsMember() + " = NULL;\n");
+                }
+            }
+            writer.write("\treset();\n");
             writer.write("}\n");
 
             writeReset();
@@ -1218,33 +1152,10 @@
             {
                 if (attribs[i].isArray())
                 {
-                    /**
-                     * Dushshantha: If the element is a Choice, it sould be
-                     * treated as a pointer to an array. Memory should be
-                     * allocated for that. Chinthana: This is the same in 'all'
-                     * element
-                     */
-
-                    if (attribs[i].getChoiceElement()
-                            || attribs[i].getAllElement())
-                    {
-                        writer.write("\t"
-                                + attribs[i].getParamNameAsMember()
-                                + " = new "
-                                + CUtils.getBasicArrayNameforType(attribs[i]
-                                        .getTypeName()) + "();\n");
-                        writer.write("\t" + attribs[i].getParamNameAsMember()
-                                + "->m_Array = 0;\n");
-                        writer.write("\t" + attribs[i].getParamNameAsMember()
-                                + "->m_Size = 0;\n");
-                    }
-                    else
-                    {
-                        writer.write("\t" + attribs[i].getParamNameAsMember()
-                                + ".m_Array = 0;\n");
-                        writer.write("\t" + attribs[i].getParamNameAsMember()
-                                + ".m_Size = 0;\n");
-                    }
+                    writer.write("\tif ( " + attribs[i].getParamNameAsMember() + " != NULL)\n");
+                    writer.write("\t{\n");
+                    writer.write("\t\t" + attribs[i].getParamNameAsMember() + "->clear();\n");
+                    writer.write("\t}\n");
                 }
                 else if (!attribs[i].isSimpleType())
                 {
@@ -1309,39 +1220,8 @@
                 String typename = attribs[i].getTypeName();
             	if(attribs[i].isArray())
                 {
-            		if (attribs[i].isSimpleType())
-                    {
-                        if (attribs[i].getChoiceElement())
-                        {
-                            writer.write("\tif (" + name
-                                    + "->m_Array != NULL)\n");
-                            writer.write("\t\tdelete [] ((" + typename + "*)"
-                                    + name + "->m_Array);\n");
-                        }
-                        else
-                        {
-                            writer.write("\tif (" + name
-                                    + ".m_Array != NULL)\n");
-                            writer.write("\t\tdelete [] ((" + typename + "*)"
-                                    + name + ".m_Array);\n");
-                        }
-                    }
-            		else
-            		{
-            			if (isNillable())
-                        {
-                            writer.write("\tif (" + name
-                                    + ".m_Array != NULL)\n");
-                            writer.write("\t\tdelete " + name + ".m_Array;\n");
-                        }
-                        else
-                        {
-                            writer.write("\tif (" + name
-                                    + ".m_Array != NULL)\n");
-                            writer.write("\t\tdelete [] ((" + typename + "*)"
-                                    + name + ".m_Array);\n");
-                        }
-            		}
+                    writer.write("\tif (" + name + "!= NULL)\n");
+                    writer.write("\t\tdelete " + name + ";\n");
             	}
             	else if (attribs[i].isAnyType())
                 {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ParmHeaderFileWriter.java
Thu Nov 10 03:00:39 2005
@@ -261,13 +261,13 @@
                 attribs[i].setParamName( CUtils.sanitiseAttributeName( classname, attribs[i].getParamName()));
                 
 				// FJP Nillable vv
-				if (isElementNillable(i)) {
+				if (isElementNillable(i)  || attribs[i].isArray()) {
 					if(attribs[i].isAnyType()){
 						anyCounter += 1;
 						writer
 						.write("\t"
 								+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
-								+ " *\t" + attribs[i].getParamName()
+								+ " * " + attribs[i].getParamName()
 								+ Integer.toString(anyCounter)
 								+ ";\n");
 						
@@ -275,7 +275,7 @@
 					else{
 					writer.write("\t"
 								 + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
-								 + " *\t" + attribs[i].getParamName()
+								 + " * " + attribs[i].getParamName()
 								 + ";\n");
 					}
 				} else {
@@ -285,7 +285,7 @@
 						writer
 						.write("\t"
 								+ getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
-								+ "\t" + attribs[i].getParamName()
+								+ " " + attribs[i].getParamName()
 								+ Integer.toString(anyCounter)
 								+ ";\n");
 						
@@ -294,7 +294,7 @@
 					else{
 				    writer.write("\t"
                                 + getCorrectParmNameConsideringArraysAndComplexTypes(attribs[i])
-                                + "\t" + attribs[i].getParamNameWithoutSymbols()
+                                + " " + attribs[i].getParamNameWithoutSymbols()
                                 + ";\n");
 					}
 				}
@@ -343,7 +343,7 @@
                 }
             	
 // FJP Nillable vv
-                if (isElementNillable(i))
+                if (isElementNillable(i)  || attribs[i].isArray())
                 {
                 	if ( attribs[i].isAnyType()){
                 		anyCounter += 1;
@@ -515,6 +515,7 @@
         try
         {
             writer.write("#include <axis/AxisUserAPI.hpp>\n");
+            writer.write("#include <axis/AxisUserAPIArrays.hpp>\n");
             if (this.type.isFault())
             {
                 writer.write("#include <axis/SoapFaultException.hpp>\n");

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ArraysClient.cpp Thu Nov
10 03:00:39 2005
@@ -26,6 +26,7 @@
 void testAxis_Array();
 void testAxis_ArrayWithNillElements();
 void testAxis_ArrayCopying();
+void testComplexTypeWithSimpleArray();
 
 int main(int argc, char* argv[])
 {
@@ -44,6 +45,7 @@
     testAxis_Array();
     testAxis_ArrayWithNillElements();
     testAxis_ArrayCopying();
+	testComplexTypeWithSimpleArray();
 
     bool bSuccess = false;
     int iRetryIterationCount = 3;
@@ -63,7 +65,7 @@
             }
             inputArray.set(array, arraySize);
             
-            xsd__int_Array * outputArray = ws.SimpleArray(&inputArray);
+            xsd__int_Array * outputArray = ws.simpleArray(&inputArray);
             int outputSize = 0;
             const xsd__int** output = outputArray->get(outputSize);
             cout << "Array size = " << outputSize << endl;
@@ -86,6 +88,41 @@
                 cout << "NULL array" << endl;
             }
             
+
+			ComplexTypeWithSimpleArray * inputComplexType = new ComplexTypeWithSimpleArray;
+			inputComplexType->setsimpleType(&inputArray);
+			ComplexTypeWithSimpleArray * outputComplexType = ws.complexTypeWithSimpleArray(inputComplexType);
+			if (outputComplexType != NULL)
+			{
+				output = outputArray->get(outputSize);
+				cout << "Array size = " << outputSize << endl;
+				if (output != NULL)
+				{
+					for (int count = 0 ; count < outputSize ; count++)
+					{
+						if (output[count] != NULL)
+						{
+							cout << *output[count] << endl;
+						}
+						else
+						{
+							cout << "NULL" << endl;
+						}
+					}
+				}
+				else
+				{
+					cout << "NULL array" << endl;
+				}
+			}
+			else
+			{
+				cout << "NULL complex type" << endl;
+			}
+
+			delete inputComplexType;
+			delete outputComplexType;
+
             bSuccess = 1;
         }
         catch(AxisException& e)
@@ -322,5 +359,47 @@
     {
         cout << "NULL" << endl;
     }
+}
+
+void testComplexTypeWithSimpleArray()
+{
+	ComplexTypeWithSimpleArray complexType;
+	int count = 0;
+	int inputSize = 3;
+	xsd__int_Array inputArray;
+	xsd__int** array = new xsd__int*[inputSize];
+	for (count = 0 ; count < inputSize ; count++ )
+	{
+		array[count] = new xsd__int(count);
+	}
+	inputArray.set(array, inputSize);
+
+	complexType.setsimpleType(&inputArray);
+
+	xsd__int_Array * outputArray = complexType.getsimpleType();
+	int outputSize = 0;
+	const xsd__int** output = outputArray->get(outputSize);
+    cout << "Size is " << outputSize << endl;
+	if (output != NULL)
+	{
+		for (count = 0 ; count < outputSize ; count++ )
+		{	
+			if (output[count] != NULL)
+			{
+				cout << *output[count] << endl;
+			}
+			else
+			{
+				cout << "NULL" << endl;
+			}
+
+		}
+	}
+	else
+	{
+		cout << "NULL array" << endl;
+	}
+
+
 }
 

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays.cpp.out
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays.cpp.out?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays.cpp.out (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays.cpp.out Thu Nov 10 03:00:39
2005
@@ -18,6 +18,14 @@
 0
 10
 20
+Size is 3
+0
+1
+2
+Array size = 3
+0
+1
+2
 Array size = 3
 0
 1

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays_ServerResponse.expected
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays_ServerResponse.expected?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays_ServerResponse.expected
(original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/Arrays_ServerResponse.expected
Thu Nov 10 03:00:39 2005
@@ -6,6 +6,17 @@
 
 ###
 <?xml version="1.0" encoding="utf-8"?>
-<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><SimpleArrayResponse
xmlns="http://org.apache.axis/Arrays/"><simpleType>0</simpleType><simpleType>1</simpleType><simpleType>2</simpleType></SimpleArrayResponse></soapenv:Body></soapenv:Envelope>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><simpleArrayResponse
xmlns="http://org.apache.axis/Arrays/"><simpleType>0</simpleType><simpleType>1</simpleType><simpleType>2</simpleType></simpleArrayResponse></soapenv:Body></soapenv:Envelope>
+0
+
+HTTP/1.1 200 OK
+Server: WebSphere Application Server/5.1
+Content-Type: text/xml; charset=utf-8
+Content-Language: en-GB
+Transfer-Encoding: chunked
+
+###
+<?xml version="1.0" encoding="utf-8"?>
+<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"><soapenv:Header/><soapenv:Body><complexTypeWithSimpleArrayResponse
xmlns="http://org.apache.axis/Arrays/"><ComplexTypeWithSimpleArray><simpleType>0</simpleType><simpleType>1</simpleType><simpleType>2</simpleType></ComplexTypeWithSimpleArray></complexTypeWithSimpleArrayResponse></soapenv:Body></soapenv:Envelope>
 0
 

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/unitTest.list?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
Binary files - no diff available.

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/Arrays.wsdl
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/Arrays.wsdl?rev=332271&r1=332270&r2=332271&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/Arrays.wsdl (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/wsdls/Arrays.wsdl Thu Nov 10 03:00:39
2005
@@ -7,7 +7,7 @@
 	<wsdl:types>
 		<xsd:schema targetNamespace="http://org.apache.axis/Arrays/"
 			xmlns:xsd="http://www.w3.org/2001/XMLSchema">
-			<xsd:element name="SimpleArrayResponse">
+			<xsd:element name="simpleArrayResponse">
 				<xsd:complexType>
 					<xsd:sequence>
 						<xsd:element name="simpleType" type="xsd:int"
@@ -15,7 +15,7 @@
 					</xsd:sequence>
 				</xsd:complexType>
 			</xsd:element>
-			<xsd:element name="SimpleArrayRequest">
+			<xsd:element name="simpleArrayRequest">
 				<xsd:complexType>
 					<xsd:sequence>
 						<xsd:element name="simpleType" type="xsd:int"
@@ -23,26 +23,69 @@
 					</xsd:sequence>
 				</xsd:complexType>
 			</xsd:element>
+
+			<xsd:complexType name="ComplexTypeWithSimpleArray">
+				<xsd:sequence>
+					<xsd:element name="simpleType" type="xsd:int" maxOccurs="unbounded"/>
+				</xsd:sequence>
+			</xsd:complexType>
+
+            <xsd:element name="complexTypeWithSimpleArrayResponse">
+				<xsd:complexType>
+					<xsd:sequence>
+						<xsd:element name="ComplexTypeWithSimpleArray"
+							type="tns:ComplexTypeWithSimpleArray">
+						</xsd:element>
+					</xsd:sequence>
+				</xsd:complexType>
+            </xsd:element>
+            <xsd:element name="complexTypeWithSimpleArrayRequest">
+            	<xsd:complexType>
+            		<xsd:sequence>
+            			<xsd:element name="complexTypeWithSimpleArray"
+            				type="tns:ComplexTypeWithSimpleArray">
+            			</xsd:element>
+            		</xsd:sequence>
+            	</xsd:complexType>
+            </xsd:element>
 		</xsd:schema>
 	</wsdl:types>
-	<wsdl:message name="SimpleArrayResponse">
-		<wsdl:part element="tns:SimpleArrayResponse"
-			name="SimpleArrayResponse" />
-	</wsdl:message>
-	<wsdl:message name="SimpleArrayRequest">
-		<wsdl:part element="tns:SimpleArrayRequest"
-			name="SimpleArrayRequest" />
+	<wsdl:message name="simpleArrayResponse">
+		<wsdl:part element="tns:simpleArrayResponse"
+			name="simpleArrayResponse" />
 	</wsdl:message>
+	<wsdl:message name="simpleArrayRequest">
+		<wsdl:part element="tns:simpleArrayRequest"
+			name="simpleArrayRequest" />
+	</wsdl:message>
+	<wsdl:message name="complexTypeWithSimpleArrayResponse">
+		<wsdl:part name="complexTypeWithSimpleArrayResponse"
+			element="tns:complexTypeWithSimpleArrayResponse">
+		</wsdl:part>
+	</wsdl:message>
+	<wsdl:message name="complexTypeWithSimpleArrayRequest">
+		<wsdl:part name="complexTypeWithSimpleArrayRequest"
+			element="tns:complexTypeWithSimpleArrayRequest">
+		</wsdl:part>
+	</wsdl:message>
 	<wsdl:portType name="Arrays">
-		<wsdl:operation name="SimpleArray">
-			<wsdl:input message="tns:SimpleArrayRequest" />
-			<wsdl:output message="tns:SimpleArrayResponse" />
-		</wsdl:operation>
+		<wsdl:operation name="simpleArray">
+			<wsdl:input message="tns:simpleArrayRequest" />
+			<wsdl:output message="tns:simpleArrayResponse" />
+		</wsdl:operation>
+		<wsdl:operation name="complexTypeWithSimpleArray">
+			<wsdl:input
+				message="tns:complexTypeWithSimpleArrayRequest">
+			</wsdl:input>
+			<wsdl:output
+				message="tns:complexTypeWithSimpleArrayResponse">
+			</wsdl:output>
+		</wsdl:operation>
 	</wsdl:portType>
 	<wsdl:binding name="ArraysSOAP" type="tns:Arrays">
 		<soap:binding style="document"
 			transport="http://schemas.xmlsoap.org/soap/http" />
-		<wsdl:operation name="SimpleArray">
+		<wsdl:operation name="simpleArray">
 			<soap:operation
 				soapAction="http://org.apache.axis/Arrays/NewOperation" />
 			<wsdl:input>
@@ -51,6 +94,10 @@
 			<wsdl:output>
 				<soap:body use="literal" />
 			</wsdl:output>
+		</wsdl:operation>
+		<wsdl:operation name="complexTypeWithSimpleArray">
+			<wsdl:input></wsdl:input>
+			<wsdl:output></wsdl:output>
 		</wsdl:operation>
 	</wsdl:binding>
 	<wsdl:service name="Arrays">



Mime
View raw message