axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From dushshan...@apache.org
Subject svn commit: r354984 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp: ServiceHeaderWriter.java ServiceWriter.java WrapHeaderWriter.java WrapWriter.java literal/WrapWriter.java
Date Thu, 08 Dec 2005 05:06:30 GMT
Author: dushshantha
Date: Wed Dec  7 21:06:15 2005
New Revision: 354984

URL: http://svn.apache.org/viewcvs?rev=354984&view=rev
Log:
Fixed the server side code generation for rpc and doc/lit style to suit the new memory model.
As a fix to AXISCPP-149. 

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.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/WrapWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java?rev=354984&r1=354983&r2=354984&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
Wed Dec  7 21:06:15 2005
@@ -137,28 +137,25 @@
                                 .iterator()
                                 .next();
                         String returnTypeName = returntype.getLangName();
-                        if (CUtils.isSimpleType(returnTypeName)
-								&& returntype.isNillable()
-								& !(CUtils.isPointerType(returnTypeName)))
+                        String returnType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(returntype,wscontext);
+                        
+                        if ((returnType.lastIndexOf ("_Array") > 0)
+                                || (CUtils.isSimpleType(returnTypeName)
+    							&& (returntype.isNillable() || returntype.isOptional())
+    							&& !(CUtils.isPointerType(returnTypeName))))
                         {
                         	writer.write(
     	                            "\t\t"
-    	                                + WrapperUtils
-    	                                    .getClassNameFromParamInfoConsideringArrays(
-    	                                    returntype,
-    	                                    wscontext)
+    	                                + returnType
     	                                + " * ");
                         }
                         else
                         {
 	                        writer.write(
 	                            "\t\t"
-	                                + WrapperUtils
-	                                    .getClassNameFromParamInfoConsideringArrays(
-	                                    returntype,
-	                                    wscontext)
+	                                + returnType
 	                                + " ");
-                        }
+	                    }
                     }
                     else
                     {
@@ -177,21 +174,19 @@
                 	hasInputParms = true;
                 	ParameterInfo fparam = (ParameterInfo) params.next();
                     String paramTypeName = fparam.getLangName();
+                    String paramType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext);
                     
                     if (fparam.getType().isAttachment())
                     {
                     	writer.write("ISoapAttachment *Value" + 0);
                     }
                     
-                    else if (CUtils.isSimpleType(paramTypeName)
-                    		&& fparam.isNillable()
-							&& !(CUtils.isPointerType(paramTypeName)))
+                    else if ((paramType.lastIndexOf ("_Array") > 0)||(CUtils.isSimpleType(paramTypeName)
+                    		&& (fparam.isNillable() || fparam.isOptional())
+							&& !(CUtils.isPointerType(paramTypeName))))
                     {
                     	writer.write(
-    	                        WrapperUtils
-    	                            .getClassNameFromParamInfoConsideringArrays(
-    	                            fparam,
-    	                            wscontext)
+                    			paramType
     	                            + " * Value"
     	                            + 0);
                     }
@@ -204,30 +199,27 @@
 	                            wscontext)
 	                            + " Value"
 	                            + 0);
-                    }
+	                }
                 }
                 for (int j = 1; params.hasNext(); j++)
                 {
                 	
                     ParameterInfo nparam = (ParameterInfo) params.next();
                     String paramTypeName = nparam.getLangName();
-                    
+                    String typeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext);
                     
                     if (nparam.getType().isAttachment())
                     {
                     	writer.write(", ISoapAttachment *Value" + j);
                     }
                                         
-                    else if (CUtils.isSimpleType(paramTypeName)
-                    		&& nparam.isNillable()
-							&& !(CUtils.isPointerType(paramTypeName)))
+                    else if ((paramTypeName.lastIndexOf ("_Array") > 0)||(CUtils.isSimpleType(paramTypeName)
+                    		&& (nparam.isNillable()|| nparam.isOptional())
+							&& !(CUtils.isPointerType(paramTypeName))))
                     {
                     	writer.write(
     	                        ","
-    	                            + WrapperUtils
-    	                                .getClassNameFromParamInfoConsideringArrays(
-    	                                nparam,
-    	                                wscontext)
+    	                            + typeName
     	                            + " * Value"
     	                            + j);
                     }
@@ -235,13 +227,10 @@
                     {
 	                    writer.write(
 	                        ","
-	                            + WrapperUtils
-	                                .getClassNameFromParamInfoConsideringArrays(
-	                                nparam,
-	                                wscontext)
+	                            + typeName
 	                            + " Value"
 	                            + j);
-                    }
+	                }
                 }
                 if (isAllTreatedAsOutParams)
                 {

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java?rev=354984&r1=354983&r2=354984&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
Wed Dec  7 21:06:15 2005
@@ -157,25 +157,20 @@
                                 .getOutputParameterTypes()
                                 .iterator()
                                 .next();
-                        String returnTypeName = returntype.getLangName(); 
-                        if (CUtils.isSimpleType(returntype.getLangName())
-                        		&& returntype.isNillable()
-								&& !(CUtils.isPointerType(returnTypeName)))
+                        String returnTypeName = returntype.getLangName();
+                        String returnType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(returntype,wscontext);
+                        if ((returnType.lastIndexOf ("_Array") > 0)||(CUtils.isSimpleType(returntype.getLangName())
+                        		&& (returntype.isNillable()|| returntype.isOptional())
+								&& !(CUtils.isPointerType(returnTypeName))))
                         {
                         	writer.write(
-    	                            WrapperUtils
-    	                                .getClassNameFromParamInfoConsideringArrays(
-    	                                returntype,
-    	                                wscontext)
+                        			returnType
     	                                + " * ");
                         }
                         else
                         {
 	                        writer.write(
-	                            WrapperUtils
-	                                .getClassNameFromParamInfoConsideringArrays(
-	                                returntype,
-	                                wscontext)
+	                        		returnType
 	                                + " ");
                         }
                     }
@@ -195,31 +190,26 @@
                 	hasInputParms = true;
                 	ParameterInfo fparam = (ParameterInfo) params.next();
                     String fparamTypeName = fparam.getLangName();
+                    String fparamType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(fparam,wscontext);
                     
                     if (fparam.getType().isAttachment())
                     {
                     	writer.write("ISoapAttachment *Value" + 0);
                     }
                     
-                    else if (CUtils.isSimpleType(fparamTypeName)
-							&& fparam.isNillable()
-							&& !(CUtils.isPointerType(fparamTypeName)))
+                    else if ((fparamType.lastIndexOf ("_Array") > 0)||(CUtils.isSimpleType(fparamTypeName)
+							&& (fparam.isNillable()|| fparam.isOptional())
+							&& !(CUtils.isPointerType(fparamTypeName))))
                     {
                     	writer.write(
-    	                        WrapperUtils
-    	                            .getClassNameFromParamInfoConsideringArrays(
-    	                            fparam,
-    	                            wscontext)
+                    			fparamType
     	                            + " * Value"
     	                            + 0);
                     }
                     else
                     {
 	                    writer.write(
-	                        WrapperUtils
-	                            .getClassNameFromParamInfoConsideringArrays(
-	                            fparam,
-	                            wscontext)
+	                    		fparamType
 	                            + " Value"
 	                            + 0);
                     }
@@ -228,34 +218,28 @@
                 {
                 	ParameterInfo nparam = (ParameterInfo) params.next();
                     String paramTypeName = nparam.getLangName();
-                    
+                    String paramType = WrapperUtils.getClassNameFromParamInfoConsideringArrays(nparam,wscontext);
                     
                     if (nparam.getType().isAttachment())
                     {
                     	writer.write(", ISoapAttachment *Value" + j);
                     }
                                         
-                    else if (CUtils.isSimpleType(paramTypeName)
-                    		&& nparam.isNillable()
-							&& !(CUtils.isPointerType(paramTypeName)))
+                    else if ((paramType.lastIndexOf ("_Array") > 0)||(CUtils.isSimpleType(paramTypeName)
+                    		&& (nparam.isNillable()|| nparam.isOptional())
+							&& !(CUtils.isPointerType(paramTypeName))))
                     {
                     	writer.write(
     	                        ","
-    	                            + WrapperUtils
-    	                                .getClassNameFromParamInfoConsideringArrays(
-    	                                nparam,
-    	                                wscontext)
-    	                            + " * Value hehe "
+    	                            + paramType
+    	                            + " * Value "
     	                            + j);
                     }
                     else
                     {
 	                    writer.write(
 	                        ","
-	                            + WrapperUtils
-	                                .getClassNameFromParamInfoConsideringArrays(
-	                                nparam,
-	                                wscontext)
+	                            + paramType
 	                            + " Value"
 	                            + j);
                     }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java?rev=354984&r1=354983&r2=354984&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapHeaderWriter.java
Wed Dec  7 21:06:15 2005
@@ -157,6 +157,7 @@
             writer.write("#include <axis/server/WrapperClassHandler.hpp>\n");
             writer.write("#include <axis/IMessageData.hpp>\n");
             writer.write("#include <axis/GDefine.hpp>\n");
+            writer.write("#include <axis/Axis.hpp>\n");
             writer.write("#include <axis/AxisWrapperAPI.hpp>\n");
             writer.write("#include \"AxisServiceException.hpp\" \n");
             writer.write("AXIS_CPP_NAMESPACE_USE \n\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java?rev=354984&r1=354983&r2=354984&view=diff
==============================================================================
--- 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 Wed
Dec  7 21:06:15 2005
@@ -388,30 +388,29 @@
                     if (CUtils.isSimpleType(qname))
                     {
                         containedType = CUtils.getclass4qname(qname);
+                        
+                        writer.write("\t" + outparamTypeName + " * v" + i +" = new " + outparamTypeName
+ "();\n");
                         writer.write(
                             "\t"
-                                + paramType
-                                + " v"
+                                + "Axis_Array * RetArray"
                                 + i
-                                + " = ("
-                                + CUtils.getBasicArrayNameforType(containedType)
-                                + "&)*(pIWSDZ->getBasicArray("
+                                + " = pIWSDZ->getBasicArray("
                                 + CUtils.getXSDTypeForBasicType(containedType)
                                 + ", \""
                                 + parameterName
-                                + "\",0));\n");
+                                + "\",0);\n");
+                        writer.write ("\tv" + i + "->clone(*RetArray"+ i + ");\n");
+                        writer.write ("\tAxis::AxisDelete( (void *)RetArray" + i + ", XSD_ARRAY);\n\n");
                     }
                     else
                     {
                         containedType = qname.getLocalPart();
+                        writer.write("\t" + outparamTypeName + " * v" + i +" = new " + outparamTypeName
+ "();\n");
                         writer.write(
                             "\t"
-                                + paramType
-                                + " v"
+                                + "Axis_Array * RetArray"
                                 + i
-                                + " = ("
-                                + paramType
-                                + "&)pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_"
+                                + " = pIWSDZ->getCmplxArray(v" + i + ", (void*)Axis_DeSerialize_"
                                 + containedType
                                 + "\n\t\t, (void*)Axis_Create_"
                                 + containedType
@@ -424,6 +423,8 @@
                                 + "\", Axis_URI_"
                                 + containedType
                                 + ");\n");
+                        writer.write("\tv" + i + "->clone(*(" + outparamTypeName + " *)RetArray"
+ i + ");\n");
+                        writer.write ("\tAxis::AxisDelete( (void *)RetArray" + i + ", XSD_ARRAY);\n\n");
                     }
                 }
                 else
@@ -477,9 +478,10 @@
         	/* Invoke the service when return type not void */
         	writer.write("\t\t" + outparamTypeName);
         	System.out.println(outparamTypeName);
-        	if (returntypeissimple
+        	if ((outparamTypeName.lastIndexOf ("_Array") > 0)
+        		||(returntypeissimple
         			&& returntype.isNillable()
-        			&&!(CUtils.isPointerType(outparamTypeName)))
+        			&&!(CUtils.isPointerType(outparamTypeName))))
         	{
         		writer.write(" *");
         	}
@@ -528,7 +530,7 @@
                     {
                         containedType = CUtils.getclass4qname(qname);
                         writer.write(
-                            "\t\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"
+                            "\t\treturn pIWSSZ->addOutputBasicArrayParam(ret,"
                                 + CUtils.getXSDTypeForBasicType(containedType)
                                 + ", \""
                                 + methodName
@@ -538,7 +540,7 @@
                     {
                         containedType = qname.getLocalPart();
                         writer.write(
-                            "\t\treturn pIWSSZ->addOutputCmplxArrayParam((Axis_Array*)(&ret),"
+                            "\t\treturn pIWSSZ->addOutputCmplxArrayParam(ret,"
                                 + "(void*) Axis_Serialize_"
                                 + containedType
                                 + ", (void*) Axis_Delete_"

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java?rev=354984&r1=354983&r2=354984&view=diff
==============================================================================
--- 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
Wed Dec  7 21:06:15 2005
@@ -230,18 +230,19 @@
                     { /*parameters that are declared as arrays in the wrapping element.*/
                         String containedType =
                             CUtils.getclass4qname(type.getName());
+                        
+                        writer.write("\t" + outparamType + " * v" + i +" = new " + outparamType
+ "();\n");
                         writer.write(
                             "\t"
-                                + paraTypeName
-                                + " v"
+                        		+ "Axis_Array * RetArray"
                                 + i
-                                + " = ("
-                                + CUtils.getBasicArrayNameforType(containedType)
-                                + "&)*(pIWSDZ->getBasicArray("
+                                + " = pIWSDZ->getBasicArray("
                                 + CUtils.getXSDTypeForBasicType(containedType)
                                 + ", \""
                                 + elementName
-                                + "\",0));\n");
+                                + "\",0);\n");
+                        writer.write ("\tv" + i + "->clone(*RetArray"+ i + ");\n");
+                        writer.write ("\tAxis::AxisDelete( (void *)RetArray" + i + ", XSD_ARRAY);\n\n");
                     }
                     else
                     {
@@ -302,20 +303,20 @@
                         if (CUtils.isSimpleType(qname))
                         {
                             containedType = CUtils.getclass4qname(qname);
+                            
+                            writer.write("\t" + outparamType + " * v" + i +" = new " + outparamType
+ "();\n");
                             writer.write(
                                 "\t"
-                                    + paraTypeName
-                                    + " v"
+                            		+ "Axis_Array * RetArray"
                                     + i
-                                    + " = ("
-                                    + CUtils.getBasicArrayNameforType(
-                                        containedType)
-                                    + "&)*(pIWSDZ->getBasicArray("
+                                    + " = pIWSDZ->getBasicArray("
                                     + CUtils.getXSDTypeForBasicType(
                                         containedType)
                                     + ", \""
                                     + elementName
-                                    + "\",0));\n");
+                                    + "\",0);\n");
+                            writer.write ("\tv" + i + "->clone(*RetArray"+ i + ");\n");
+                            writer.write ("\tAxis::AxisDelete( (void *)RetArray" + i + ",
XSD_ARRAY);\n\n");
                         }
                         else
                         {
@@ -324,32 +325,29 @@
                                 containedType =
                                     CUtils.getclass4qname(
                                         arrayType.getBaseType());
+                                writer.write("\t" + outparamType + " * v" + i +" = new "
+ outparamType + "();\n");
                                 writer.write(
                                     "\t"
-                                        + paraTypeName
-                                        + " v"
+                                		+ "Axis_Array * RetArray"
                                         + i
-                                        + " = ("
-                                        + CUtils.getBasicArrayNameforType(
-                                            containedType)
-                                        + "&)*(pIWSDZ->getBasicArray("
+                                        + " = pIWSDZ->getBasicArray("
                                         + CUtils.getXSDTypeForBasicType(
                                             containedType)
                                         + ", \""
                                         + elementName
-                                        + "\",0));\n");
+                                        + "\",0);\n");
+                                writer.write ("\tv" + i + "->clone(*RetArray"+ i + ");\n");
+                                writer.write ("\tAxis::AxisDelete( (void *)RetArray" + i
+ ", XSD_ARRAY);\n\n");
                             }
                             else
                             {
                                 containedType = qname.getLocalPart();
+                                writer.write("\t" + paraTypeName + " * v" + i +" = new "
+ paraTypeName + "();\n");
                                 writer.write(
                                     "\t"
-                                        + paraTypeName
-                                        + " v"
+                                		+ "Axis_Array * RetArray"
                                         + i
-                                        + " = ("
-                                        + paraTypeName
-                                        + "&)pIWSDZ->getCmplxArray((void*)Axis_DeSerialize_"
+                                        + " = pIWSDZ->getCmplxArray(v" + i + ",(void*)Axis_DeSerialize_"
                                         + containedType
                                         + "\n\t\t, (void*)Axis_Create_"
                                         + containedType
@@ -432,11 +430,11 @@
         { /* Invoke the service when return type not void */
             returnParamName = returntype.getElementNameAsString();
             writer.write("\t" + outparamType);
-            if (!returntypeisarray 
+            if ((outparamType.lastIndexOf ("_Array") > 0)||(!returntypeisarray 
         		&& (!returntypeissimple
             		|| (returntypeissimple		//Chinthana:This has been changed because XSDElementNill
Test failed.
         				&& returntype.isNillable()
-						&& !(CUtils.isPointerType(retType.getLanguageSpecificName())))))
+						&& !(CUtils.isPointerType(retType.getLanguageSpecificName()))))))
             {
             	writer.write(" *");
             }
@@ -489,7 +487,7 @@
                     String containedType =
                         CUtils.getclass4qname(retType.getName());
                     writer.write(
-                        "\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"
+                        "\treturn pIWSSZ->addOutputBasicArrayParam(ret,"
                             + CUtils.getXSDTypeForBasicType(containedType)
                             + ", \""
                             + returnParamName
@@ -530,7 +528,7 @@
                     {
                         containedType = CUtils.getclass4qname(qname);
                         writer.write(
-                            "\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"
+                            "\treturn pIWSSZ->addOutputBasicArrayParam(ret,"
                                 + CUtils.getXSDTypeForBasicType(containedType)
                                 + ", \""
                                 + returnParamName
@@ -543,7 +541,7 @@
                             containedType =
                                 CUtils.getclass4qname(arrayType.getBaseType());
                             writer.write(
-                                "\treturn pIWSSZ->addOutputBasicArrayParam((Axis_Array*)(&ret),"
+                                "\treturn pIWSSZ->addOutputBasicArrayParam(ret,"
                                     + CUtils.getXSDTypeForBasicType(
                                         containedType)
                                     + ", \""
@@ -554,7 +552,7 @@
                         {
                             containedType = qname.getLocalPart();
                             writer.write(
-                                "\treturn pIWSSZ->addOutputCmplxArrayParam((Axis_Array*)(&ret),"
+                                "\treturn pIWSSZ->addOutputCmplxArrayParam(ret,"
                                     + "(void*) Axis_Serialize_"
                                     + containedType
                                     + ", (void*) Axis_Delete_"



Mime
View raw message