axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r510407 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws: CUtils.java c/BeanParamWriter.java c/literal/ClientStubWriter.java cpp/BeanParamWriter.java cpp/literal/ClientStubWriter.java
Date Thu, 22 Feb 2007 06:02:03 GMT
Author: nadiramra
Date: Wed Feb 21 22:02:02 2007
New Revision: 510407

URL: http://svn.apache.org/viewvc?view=rev&rev=510407
Log:
AXISCPP-542 (bad indentation) and AXISCPP-543 (no comments in generated code). First crack at
resolving both issues.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/CUtils.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/literal/ClientStubWriter.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/literal/ClientStubWriter.java

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=510407&r1=510406&r2=510407
==============================================================================
--- 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 Wed Feb 21 22:02:02 2007
@@ -40,6 +40,8 @@
 import org.apache.axis.wsdl.wsdl2ws.info.TypeMap;
 import org.apache.axis.wsdl.wsdl2ws.info.WebServiceContext;
 import org.apache.axis.wsdl.symbolTable.CSchemaUtils;
+import java.io.BufferedWriter;
+import java.io.IOException;
 
 public class CUtils 
 {
@@ -1376,5 +1378,18 @@
         
         return sNew;
     }
+    
+    public static void printBlockComment(BufferedWriter writer, String s) throws IOException
+    {
+        writer.write("\n");
+        writer.write("\t// ======================================================================\n");
+        
+        // TODO: divide string into multiple lines if greater then 80, sensitive
+        //       to not break line in middle of word. for now all comments are one-liners.
+        writer.write("\t// " + s + "\n");
+        
+        writer.write("\t// ======================================================================\n");  
+        writer.write("\n");
+    }    
 }
 

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=510407&r1=510406&r2=510407
==============================================================================
--- 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 Wed Feb 21 22:02:02 2007
@@ -69,6 +69,8 @@
         // TODO: xsd:extension not fully or correctly supported.
         if (extensionBaseAttrib != null)
         {
+            CUtils.printBlockComment(writer, "Serialize extension.");
+            
             String typeName = extensionBaseAttrib.getTypeName(); 
 
             if (extensionBaseAttrib.isSimpleType())
@@ -107,6 +109,8 @@
 
         if (attribs.length == 0)
         {
+            CUtils.printBlockComment(writer, "No attributes or elements to serialize.");
+        
             writer.write("\taxiscSoapSerializerSerialize(pSZ,\">\", NULL);\n");
 
             writeSerializeExtensionCode();
@@ -123,12 +127,14 @@
         //=============================================================================        
         
         writer.write("\tAxiscBool blnIsNewPrefix = xsdc_boolean_false;\n\n");
+
+        CUtils.printBlockComment(writer, "If null input, serialize as nil element.");
         
         writer.write("\tif ( param == NULL )\n\t{\n");
         writer.write("\t\taxiscSoapSerializerSerializeAsAttribute(pSZ, \"xsi:nil\", 0, (void*)&(xsdc_boolean_true), XSDC_BOOLEAN);\n");
         writer.write("\t\taxiscSoapSerializerSerialize(pSZ, \">\", NULL);\n");
         writer.write("\t\treturn AXISC_SUCCESS;\n");
-        writer.write("\t}\n\n");
+        writer.write("\t}\n");
         
         //=============================================================================
         // Serialize 
@@ -145,7 +151,9 @@
         // Serialize attributes, if any
         //=============================================================================        
 
-        writer.write("\t/* If there are any attributes serialize them. If there aren't then close the tag */\n");
+        if (attributeParamCount > 0)
+            CUtils.printBlockComment(writer, "Serialize attributes.");
+        
         for (int i = 0; i < attributeParamCount; i++)
         {            
             if (attribs[i].isArray() || !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
@@ -160,11 +168,11 @@
                 basicType = attribs[i].getTypeName();
             
             if (attribs[i].isOptional())
-                writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n");
+                writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n\t");
 
             if (CUtils.isPointerType(basicType) || attribs[i].isOptional())
             {
-                writer.write("\t\taxiscSoapSerializerSerializeAsAttribute(pSZ,\""
+                writer.write("\taxiscSoapSerializerSerializeAsAttribute(pSZ,\""
                         + attribs[i].getParamNameAsSOAPString() + "\", 0, (void*)(param->"
                         + attribs[i].getParamNameAsMember() + "), "
                         + CUtils.getXSDTypeForBasicType(basicType) + ");\n");
@@ -172,10 +180,8 @@
             else
             {
                 writer.write("\taxiscSoapSerializerSerializeAsAttribute(pSZ,\""
-                        + attribs[i].getParamNameAsSOAPString()
-                        + "\", 0, (void*)&(param->"
-                        + attribs[i].getParamNameAsMember()
-                        + "), "
+                        + attribs[i].getParamNameAsSOAPString() + "\", 0, (void*)&(param->"
+                        + attribs[i].getParamNameAsMember() + "), "
                         + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName()) + ");\n");
             }
         }
@@ -208,7 +214,8 @@
         // Serialize elements, if any
         //=============================================================================    
         
-        writer.write("\n\t/* then serialize elements if any*/\n");
+        if (attributeParamCount < attribs.length)
+            CUtils.printBlockComment(writer, "Serialize sub-elements.");
 
         boolean firstIfWritten = false;
         int anyCounter = 0; //counter for any types.
@@ -289,7 +296,7 @@
                     baseTypeName = typeName;
                 
                 if (attribs[i].isOptional())
-                    writer.write("\tif (param->" + attribs[i].getParamNameAsMember() + " != NULL)\n\t\t{\n\t");
+                    writer.write("\tif (param->" + attribs[i].getParamNameAsMember() + " != NULL)\n\t");
                 
                 if (CUtils.isPointerType(baseTypeName))
                 {
@@ -331,9 +338,6 @@
                             + ", (void*)&(param->" + attribs[i].getParamNameAsMember()
                             + "), " + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
                 }
-                
-                if (attribs[i].isOptional())
-                    writer.write("\t\t}\n");
             }
             else
             {
@@ -388,6 +392,8 @@
             writer.write("\n\taxiscSoapSerializerSerialize(pSZ, \"</\", Axis_TypeName_" + classname
                     + ", \">\", NULL);\n");
         }
+
+        CUtils.printBlockComment(writer, "Remove namespace, if new.");        
         
         writer.write("\n\tif (!bArray && blnIsNewPrefix)\n");
         writer.write("\t\taxiscSoapSerializerRemoveNamespacePrefix(pSZ, Axis_URI_" + classname + ");\n");
@@ -402,13 +408,15 @@
      */
     private void writeDOCArrayPortionOfSerializeGlobalMethod() throws IOException
     {
+        CUtils.printBlockComment(writer, "Serialize top-most element, possibly defining new namespace.");        
+        
         // For doc/literal objects
         writer.write("\tif (!bArray)\n\t{\n");
         writer.write("\t\tconst AxiscChar* sPrefix = axiscSoapSerializerGetNamespacePrefix(pSZ,Axis_URI_" + classname + ", &blnIsNewPrefix);\n");
         writer.write("\t\tif (blnIsNewPrefix)\n");
         writer.write("\t\t\taxiscSoapSerializerSerialize(pSZ,\" xmlns:\", sPrefix, \"=\\\"\", " 
                         + "Axis_URI_" + classname + ", \"\\\"\", NULL);\n");
-        writer.write("\t}\n\n");
+        writer.write("\t}\n");
     }
 
     /**
@@ -434,7 +442,7 @@
                     + "\" xsi:type=\\\"\", sPrefix, \":\", " 
                     + "Axis_TypeName_" + classname + ", \"\\\" xmlns:\", " 
                     + "sPrefix, \"=\\\"\", Axis_URI_" + classname + ", \"\\\">\", NULL);\n");
-        writer.write("\t}\n\n");
+        writer.write("\t}\n");
     }
 
     private void writeDeSerializeExtensionCode() throws IOException, WrapperFault
@@ -442,21 +450,23 @@
         if (extensionBaseAttrib != null
                 && extensionBaseAttrib.getTypeName() != null)
         {
+            CUtils.printBlockComment(writer, "Deserialize extension.");
+            
             if (extensionBaseAttrib.isSimpleType())
             {
                 writer.write("\t{\n"); // ==== begin scope
-                writer.write("\tvoid* pCharDataAs;\n\n");
+                writer.write("\t\tvoid* pCharDataAs;\n\n");
                 String typeName = extensionBaseAttrib.getTypeName();
                 String xsdType = CUtils.getXSDTypeForBasicType(typeName);
-                writer.write("\taxiscSoapDeSerializerGetChardataAs(pDZ, &pCharDataAs, " + xsdType + ");\n");
-                writer.write("\tparam->" + extensionBaseAttrib.getParamNameAsMember() + " = ");
+                writer.write("\t\taxiscSoapDeSerializerGetChardataAs(pDZ, &pCharDataAs, " + xsdType + ");\n");
+                writer.write("\t\tparam->" + extensionBaseAttrib.getParamNameAsMember() + " = ");
                 
                 if (CUtils.isPointerType(typeName))
                     writer.write("(" + typeName + ") pCharDataAs;\n");
                 else
                 {
                     writer.write(" *(" + typeName + "*) pCharDataAs;\n");
-                    writer.write("\taxiscAxisDelete(pCharDataAs, " + xsdType + ");\n");
+                    writer.write("\t\taxiscAxisDelete(pCharDataAs, " + xsdType + ");\n");
                 }      
                 writer.write("\t}\n"); // ==== end scope
             }
@@ -494,12 +504,18 @@
             writer.write("}\n\n");
             return;
         }  
+        
+        // We always use this...
+        writer.write("\tconst char* peekedElementName;\n");
 
         //=============================================================================
         // Deserialize attributes.
         // Makes logic simpler to follow with slight duplication. TODO
         //=============================================================================        
         
+        if (attributeParamCount > 0)
+            CUtils.printBlockComment(writer, "Deserialize attributes.");
+        
         //=============================================================================
         // Deserialize attributes and elements.
         //=============================================================================        
@@ -511,8 +527,22 @@
         int anyCounter = 0; //counter for any types.
         int arrayCount = 0;
         
+        boolean handleAll = false;
+        boolean handleChoice = false;
+     
+        // Tabs to ensure code alignment
+        String tab1  = "\t";
+        String tab2Default = "";
+        String tab2;
+       
         for (int i = 0; i < attribs.length; i++)
         {       
+            // Reset tabs
+            tab2  = tab2Default + "\t";
+            
+            if (i == attributeParamCount)
+                CUtils.printBlockComment(writer, "Deserialize elements.");
+            
             //if the attribute is a 'choice' construct we have to peek and make
             // the choice
 
@@ -560,7 +590,7 @@
             if (attribs[i].isAnyType())
             {
                 anyCounter +=1;
-                writer.write("\tparam->any" + anyCounter + " = axiscSoapDeSerializerGetAnyObject(pDZ);\n");
+                writer.write(tab1 + "param->any" + anyCounter + " = axiscSoapDeSerializerGetAnyObject(pDZ);\n");
             }
             else if (attribs[i].isArray())
             {
@@ -574,16 +604,14 @@
                     else
                         baseTypeName = attribs[i].getTypeName();
 
-                    writer.write("\t/* If there is an existing array, delete it */\n");
-                    writer.write("\tif (param->" + attribs[i].getParamNameAsMember() + " != NULL)\n");
-                    writer.write("\t{\n");
-                    writer.write("\t\taxiscAxisDelete(param->" + attribs[i].getParamNameAsMember() + ", XSDC_ARRAY);\n");
-                    writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + "= NULL;\n");
-                    writer.write("\t}\n");
+                    writer.write(tab1 + "if (param->" + attribs[i].getParamNameAsMember() + " != NULL)\n");
+                    writer.write(tab1 + "{\n");
+                    writer.write(tab1 + "\taxiscAxisDelete(param->" + attribs[i].getParamNameAsMember() + ", XSDC_ARRAY);\n");
+                    writer.write(tab1 + "\tparam->" + attribs[i].getParamNameAsMember() + "= NULL;\n");
+                    writer.write(tab1 + "}\n");
                     writer.write("\n");
-                    
-                    writer.write("\t/* Deserialize array */\n");
-                    writer.write("\tparam->" + attribs[i].getParamNameAsMember() 
+                 
+                    writer.write(tab1 + "param->" + attribs[i].getParamNameAsMember() 
                             + " = (" + baseTypeName + "_Array *)" 
                             + "axiscSoapDeSerializerGetBasicArray(pDZ, " 
                             + CUtils.getXSDTypeForBasicType(baseTypeName) + ", \"" 
@@ -594,7 +622,7 @@
                 else
                 {
                     arrayType = attribs[i].getTypeName();
-                    writer.write("\taxiscSoapDeSerializerGetCmplxArray(pDZ, (Axisc_Array *)param->" + attribs[i].getParamNameAsMember() 
+                    writer.write(tab1 + "axiscSoapDeSerializerGetCmplxArray(pDZ, (Axisc_Array *)param->" + attribs[i].getParamNameAsMember() 
                             + ", (void*)Axis_DeSerialize_"  + arrayType 
                             + ", (void*)Axis_Create_" + arrayType 
                             + ", (void*)Axis_Delete_" + arrayType 
@@ -608,10 +636,10 @@
                 // We only peek for elements, not element attributes!
                 if (attribs[i].isOptional() && !attribs[i].isAttribute())
                 {
-                    writer.write("\n\t{\n"); // start new variable scope                    
-                    writer.write("\tconst char* elementName" + i + " = axiscSoapDeSerializerPeekNextElementName(pDZ);\n");
-                    writer.write("\tif(strcmp(elementName" + i + ", \"" + soapTagName + "\") == 0)\n");
-                    writer.write("\t{\n");
+                    writer.write(tab1 + "peekedElementName = axiscSoapDeSerializerPeekNextElementName(pDZ);\n");
+                    writer.write(tab1 + "if (strcmp(peekedElementName, \"" + soapTagName + "\") == 0)\n");
+                    writer.write(tab1 + "{\n");
+                    tab2 += "\t";
                 }
                 
                 Type type = attribs[i].getType();
@@ -625,7 +653,7 @@
                         || attribs[i].isNillable() || isElementNillable(i) ||
                         isElementOptional(i) || isPointerType)
                 {
-                    writer.write("\tparam->"
+                    writer.write(tab2 + "param->"
                             + attribs[i].getParamNameAsMember() + " = "
                             + "axiscSoapDeSerializer"
                             + CUtils.getParameterGetValueMethodName(
@@ -636,27 +664,30 @@
                 {
                     String elementNameToSearchFor = attribs[i].isAttribute()? attribs[i].getParamNameAsSOAPString():attribs[i].getElementNameAsSOAPString();
                     
-                    writer.write("\t{\n");
-                    writer.write("\t" + attribs[i].getTypeName() + " * "
+                    writer.write(tab2 + "{\n"); // start local scope
+                    
+                    writer.write(tab2 + "\t" + attribs[i].getTypeName() + " * "
                         + attribs[i].getParamNameAsMember() + " = " 
                         + "axiscSoapDeSerializer"
                         + CUtils.getParameterGetValueMethodName(attribs[i].getTypeName(), attribs[i].isAttribute()) 
                         + "(pDZ, \"" + elementNameToSearchFor + "\",0);\n");
                     
-                    writer.write("\tif (" + attribs[i].getParamNameAsMember() + " != NULL)\n\t{\n");
-                    writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + " = *"
+                    writer.write(tab2 + "\tif (" + attribs[i].getParamNameAsMember() + " != NULL)\n");
+                    writer.write(tab2 + "\t{\n");
+                    writer.write(tab2 + "\t\tparam->" + attribs[i].getParamNameAsMember() + " = *"
                             + attribs[i].getParamNameAsMember() + ";\n");
 
                     if (CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()).equals("XSDC_HEXBINARY")
                             || CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()).equals("XSDC_BASE64BINARY"))
                     {
-                        writer.write( "\t\t" + attribs[i].getParamNameAsMember() + "->__ptr = NULL;\n");
+                        writer.write(tab2 + "\t\t" + attribs[i].getParamNameAsMember() + "->__ptr = NULL;\n");
                     }
                     
-                    writer.write("\t\taxiscAxisDelete( (void *) " + attribs[i].getParamNameAsMember() 
+                    writer.write(tab2 + "\t\taxiscAxisDelete( (void *) " + attribs[i].getParamNameAsMember() 
                             + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
-                    writer.write("\t}\n");  
-                    writer.write("\t}\n");                    
+                    writer.write(tab2 + "\t}\n");
+                    
+                    writer.write(tab2 + "}\n");  // end local scope                
                 }
                 
                 if (attribs[i].isOptional() && !attribs[i].isAttribute())
@@ -664,24 +695,21 @@
                     writer.write("\t\t\t}\n");
                     writer.write("\t\telse\n");
                     writer.write("\t\t\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
-                    writer.write("\n");
-                    writer.write("\n\t}\n"); // end new variable scope
                 }
             }
             else
             {
                 //if complex type
                 String soapTagName = attribs[i].getParamNameAsSOAPString();
-                writer.write("\n\t{\n"); // start new variable scope
                 
                 if (attribs[i].isOptional())
                 {
-                    writer.write("\tconst char* elementName" + i + " = axiscSoapDeSerializerPeekNextElementName(pDZ);\n");
-                    writer.write("\tif(strcmp(elementName" + i + ", \"" + soapTagName + "\") == 0)\n");
-                    writer.write("\t{\n");
+                    writer.write(tab1 + "peekedElementName = axiscSoapDeSerializerPeekNextElementName(pDZ);\n");
+                    writer.write(tab1 + "if (strcmp(peekedElementName, \"" + soapTagName + "\") == 0)\n");
+                    tab2 += "\t";
                 }
 
-                writer.write("\tparam->" + attribs[i].getParamNameAsMember() 
+                writer.write(tab2 + "param->" + attribs[i].getParamNameAsMember() 
                         + " = ("  + attribs[i].getTypeName()
                         + "*)axiscSoapDeSerializerGetCmplxObject(pDZ,(void*)Axis_DeSerialize_" + attribs[i].getTypeName()
                         + ", (void*)Axis_Create_" + attribs[i].getTypeName() 
@@ -690,17 +718,13 @@
                 
                 if (attribs[i].isOptional())
                 {
-                    writer.write("\t}\n");
-                    writer.write("\telse\n");
-                    writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
-                    writer.write("\n");
+                    writer.write(tab1 + "else\n");
+                    writer.write(tab1 + "\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
                 }      
-                
-                writer.write("\n\t}\n"); // end new variable scope
             }
 
             if (attribs[i].getChoiceElement())
-                writer.write("\t}\n");
+                writer.write(tab1 + "}\n");
             
             if (attribs[i].getAllElement())
                 if (attribs[i].getMinOccurs() == 0)
@@ -715,7 +739,6 @@
         
         writeDeSerializeExtensionCode();
         
-        writer.write("\t/* Return deserialization status */\n");
         writer.write("\treturn axiscSoapDeSerializerGetStatus(pDZ);\n");
         writer.write("}\n");
     }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java?view=diff&rev=510407&r1=510406&r2=510407
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ClientStubWriter.java Wed Feb 21 22:02:02 2007
@@ -332,7 +332,9 @@
         //=============================================================================
         // Generate method logic
         //=============================================================================        
-                        
+
+        CUtils.printBlockComment(writer, "Initialize client engine, set SOAP version, SOAPAction, operation, etc.");
+        
         writer.write("\tif (AXISC_SUCCESS != axiscCallInitialize(call, C_DOC_PROVIDER " + "))\n");
         writer.write("\t\treturn ");
         if (returntype != null)
@@ -357,6 +359,7 @@
         }
 
         // Add attributes to soap method
+        boolean commentIssued=false;
         for (int i = 0; i < paramsB.size (); i++)
         {
             ParameterInfo param = (ParameterInfo) paramsB.get (i);
@@ -365,6 +368,14 @@
             if (!param.isAttribute ())
                 continue;
             
+            if (!commentIssued)
+            {
+                commentIssued = true;
+                CUtils.printBlockComment(writer, "Add attributes to soap method.");
+            }
+            else
+                writer.write ("\n");
+            
             // Process attributes
             String elementType = param.getElementName ().getLocalPart ();
     
@@ -385,20 +396,30 @@
         } // end for-loop
         
         // new calls from stub base
-        writer.write("\n");
+        CUtils.printBlockComment(writer, "Apply SSL configuration properties and user-set SOAP headers.");        
         writer.write ("\taxiscStubIncludeSecure(stub);\n");  
         writer.write ("\taxiscStubApplyUserPreferences(stub);\n");
-        writer.write("\n");
         
         // Process elements
+        commentIssued=false;
+        String tab2;
         for (int i = 0; i < paramsB.size(); i++)
         {
+            tab2 = "\t";
             ParameterInfo param = (ParameterInfo) paramsB.get(i);
 
             // Ignore attributes
             if (param.isAttribute ())
                 continue;
             
+            if (!commentIssued)
+            {
+                commentIssued = true;
+                CUtils.printBlockComment(writer, "Process parameters.");
+            }
+            else
+                writer.write ("\n");
+                        
             // add elements
             type = wscontext.getTypemap().getType(param.getSchemaName());
             if (type != null)
@@ -438,14 +459,14 @@
                 
                 if (namespace.length () == 0)
                 {
-                    writer.write ("\tchar cPrefixAndParamName"
+                    writer.write ("\t\tchar cPrefixAndParamName"
                               + i + "[" + "] = \"" + parameterName + "\";\n");
                 }
                 else
                 {
                     int stringLength = 8 + 1 + parameterName.length () + 1;
-                    writer.write ("\tchar cPrefixAndParamName" + i + "[" + stringLength + "];\n");
-                    writer.write ("\tsprintf( cPrefixAndParamName" + i +
+                    writer.write ("\t\tchar cPrefixAndParamName" + i + "[" + stringLength + "];\n");
+                    writer.write ("\t\tsprintf( cPrefixAndParamName" + i +
                               ", \"%s:" + parameterName +
                               "\", axiscCallGetNamespacePrefix(call,\"" +  namespace + "\"));\n");
                 }
@@ -454,18 +475,18 @@
                 {
                     // TODO
                     String attchType = param.getType().getName().getLocalPart();
-                    writer.write("\n\tconst AxiscChar *xmlSoapNsPfx" + i + 
+                    writer.write("\t\tconst AxiscChar *xmlSoapNsPfx" + i + 
                         " = axiscCallGetNamespacePrefix(call,\"" + 
                         WrapperConstants.APACHE_XMLSOAP_NAMESPACE + "\");\n");
-                    writer.write("\tchar attchType" + i + "[64];\n");
-                    writer.write("\tstrcpy(attchType" + i + ", xmlSoapNsPfx" + i + ");\n");
-                    writer.write("\tstrcat(attchType" + i + ", \":" + attchType + "\");\n");
-                    writer.write("\tAXISCHANDLE attrs" + i + "[2];\n");
-                    writer.write("\tattrs" + i + "[0] = axiscCallCreateAttribute(call,\"type\", \"xsi\", attchType" + i + 
+                    writer.write("\t\tchar attchType" + i + "[64];\n");
+                    writer.write("\t\tstrcpy(attchType" + i + ", xmlSoapNsPfx" + i + ");\n");
+                    writer.write("\t\tstrcat(attchType" + i + ", \":" + attchType + "\");\n");
+                    writer.write("\t\tAXISCHANDLE attrs" + i + "[2];\n");
+                    writer.write("\t\tattrs" + i + "[0] = axiscCallCreateAttribute(call,\"type\", \"xsi\", attchType" + i + 
                         ");\n");
-                    writer.write("\tattrs" + i + "[1] = axiscCallCreateAttribute(call,xmlSoapNsPfx" + i + 
+                    writer.write("\t\tattrs" + i + "[1] = axiscCallCreateAttribute(call,xmlSoapNsPfx" + i + 
                         ", \"xmlns\", \"http://xml.apache.org/xml-soap\");\n");
-                    writer.write("\taxiscCallAddAttachmentParameter(call, Value" + i + ", cPrefixAndParamName" + i + 
+                    writer.write("\t\taxiscCallAddAttachmentParameter(call, Value" + i + ", cPrefixAndParamName" + i + 
                         ", attrs" + i + ", 2");
                 }
                 else if (typeisarray)
@@ -482,14 +503,14 @@
                     {
                         // Array of simple type
                         String containedType = CUtils.getclass4qname (qname);
-                        writer.write ("\taxiscCallAddBasicArrayParameter(call,");
+                        writer.write ("\t\taxiscCallAddBasicArrayParameter(call,");
                         writer.write ("(Axisc_Array *)Value" + i + ", " +
                               CUtils.getXSDTypeForBasicType(containedType) + ", cPrefixAndParamName" + i);
                     }
                     else if (arrayType != null && arrayType.isSimpleType ())
                     {
                         String containedType = CUtils.getclass4qname (arrayType.getBaseType ());
-                        writer.write ("\taxiscCallAddBasicArrayParameter(call,");
+                        writer.write ("\t\taxiscCallAddBasicArrayParameter(call,");
                         writer.write ("(Axisc_Array *)Value" + i + ", " +
                                   CUtils.getXSDTypeForBasicType(containedType) +
                                   ", cPrefixAndParamName" + i);
@@ -498,7 +519,7 @@
                     {
                         // Array of complex type
                         String containedType = qname.getLocalPart ();
-                        writer.write ("\taxiscCallAddCmplxArrayParameter(call,");
+                        writer.write ("\t\taxiscCallAddCmplxArrayParameter(call,");
                         writer.write ("(Axisc_Array *)Value" + i +
                                   ", (void*)Axis_Serialize_" + containedType +
                                   ", (void*)Axis_Delete_" + containedType +
@@ -516,13 +537,13 @@
                             || param.isOptional()
                             || CUtils.isPointerType(paramTypeName))
                     {
-                        writer.write ("\taxiscCallAddParameter(call,");
+                        writer.write ("\t\taxiscCallAddParameter(call,");
                         writer.write ("(void*)Value" + i + ", cPrefixAndParamName" + i
                                   + ", " + CUtils.getXSDTypeForBasicType(paramTypeName));
                     }
                     else
                     {
-                        writer.write ("\taxiscCallAddParameter(call,");
+                        writer.write ("\t\taxiscCallAddParameter(call,");
                         writer.write ("(void*)&Value" + i + ", cPrefixAndParamName" + i
                                   + ", " + CUtils.getXSDTypeForBasicType(paramTypeName));
                     }
@@ -530,7 +551,7 @@
                 else
                 {
                     // Complex Type
-                    writer.write ("\taxiscCallAddCmplxParameter(call,");
+                    writer.write ("\t\taxiscCallAddCmplxParameter(call,");
                     writer.write ("Value" + i
                           + ", (void*)Axis_Serialize_" + paramTypeName
                           + ", (void*)Axis_Delete_" + paramTypeName
@@ -548,13 +569,17 @@
 
         if (minfo.getOutputMessage () != null)
         {
+            CUtils.printBlockComment(writer, "Invoke web service, send/receive operation. Handle output parameters, if any.");
             writer.write("\tif (AXISC_SUCCESS == axiscCallSendAndReceive(call))\n\t{\n");       
             writer.write("\t\tif(AXISC_SUCCESS == axiscCallCheckMessage(call, \""
                 + minfo.getOutputMessage().getLocalPart() + "\", \""
                 + minfo.getOutputMessage().getNamespaceURI() + "\"))\n\t\t{\n");
         }
         else
-            writer.write("\tif (AXISC_SUCCESS == axiscCallSend(call))\n\t{\n");       
+        {
+            CUtils.printBlockComment(writer, "Invoke web service, send-only operation.");
+            writer.write("\tif (AXISC_SUCCESS == axiscCallSend(call))\n\t{\n");      
+        }
         
         if (isAllTreatedAsOutParams)
         {

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=510407&r1=510406&r2=510407
==============================================================================
--- 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 Wed Feb 21 22:02:02 2007
@@ -289,6 +289,8 @@
         // TODO: xsd:extension not fully or correctly supported.
         if (extensionBaseAttrib != null)
         {
+            CUtils.printBlockComment(writer, "Serialize extension.");
+            
             String typeName = extensionBaseAttrib.getTypeName(); 
 
             if (extensionBaseAttrib.isSimpleType())
@@ -335,6 +337,8 @@
 
         if (attribs.length == 0) 
         {
+            CUtils.printBlockComment(writer, "No attributes or elements to serialize.");
+            
             writer.write("\tpSZ->serialize(\">\", NULL);\n");
 
             writeSerializeExtensionCode();
@@ -350,11 +354,13 @@
         // to put this, or we need to find a way to determine if nillable.
         //=============================================================================        
 
+        CUtils.printBlockComment(writer, "If null input, serialize as nil element.");
+        
         writer.write("\tif ( param == NULL )\n\t{\n");
         writer.write("\t\tpSZ->serializeAsAttribute( \"xsi:nil\", 0, (void*)&(xsd_boolean_true), XSD_BOOLEAN);\n");
         writer.write("\t\tpSZ->serialize( \">\", NULL);\n");
         writer.write("\t\treturn AXIS_SUCCESS;\n");
-        writer.write("\t}\n\n");
+        writer.write("\t}\n");
         
         //=============================================================================
         // Serialize 
@@ -371,7 +377,9 @@
         // Serialize attributes, if any
         //=============================================================================        
 
-        writer.write("\t/* If there are any attributes serialize them. If there aren't then close the tag */\n");
+        if (attributeParamCount > 0)
+            CUtils.printBlockComment(writer, "Serialize attributes.");
+        
         for (int i = 0; i < attributeParamCount; i++)
         {
             if (attribs[i].isArray() || !(attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
@@ -388,22 +396,20 @@
                 basicType = attribs[i].getTypeName();
 
             if (attribs[i].isOptional())
-                writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n");
+                writer.write("\tif (0 != param->" + attribs[i].getParamNameAsMember() + ")\n\t");
             
             if (CUtils.isPointerType(basicType) || attribs[i].isOptional())
             {
-                writer.write("\t\tpSZ->serializeAsAttribute(\""
+                writer.write("\tpSZ->serializeAsAttribute(\""
                         + soapTagName + "\", 0, (void*)(param->"
                         + attribs[i].getParamNameAsMember() + "), "
                         + CUtils.getXSDTypeForBasicType(basicType) + ");\n");
             }
             else
             {
-                writer.write("\t\tpSZ->serializeAsAttribute(\""
-                        + soapTagName
-                        + "\", 0, (void*)&(param->"
-                        + attribs[i].getParamNameAsMember()
-                        + "), "
+                writer.write("\tpSZ->serializeAsAttribute(\""
+                        + soapTagName + "\", 0, (void*)&(param->"
+                        + attribs[i].getParamNameAsMember() + "), "
                         + CUtils.getXSDTypeForBasicType(attribs[i].getTypeName()) + ");\n");
             }
         }
@@ -436,7 +442,8 @@
         // Serialize elements, if any
         //=============================================================================                
         
-        writer.write("\n\t/* then serialize elements if any*/\n");
+        if (attributeParamCount < attribs.length)
+            CUtils.printBlockComment(writer, "Serialize sub-elements.");
 
         boolean firstIfWritten = false;
         int anyCounter = 0; //counter for any types.
@@ -516,7 +523,7 @@
                     baseTypeName = typeName;
                 
                 if (attribs[i].isOptional())
-                    writer.write("\tif (param->" + attribs[i].getParamNameAsMember() + " != NULL)\n\t{\n\t");
+                    writer.write("\tif (param->" + attribs[i].getParamNameAsMember() + " != NULL)\n\t");
                 
                 if (CUtils.isPointerType(baseTypeName))
                 {
@@ -558,9 +565,6 @@
                             + ", (void*)&(param->" + attribs[i].getParamNameAsMember()
                             + "), " + CUtils.getXSDTypeForBasicType(baseTypeName) + ");\n");
                 }
-                
-                if (attribs[i].isOptional())
-                    writer.write("\t}\n");
             }
             else
             {
@@ -615,7 +619,9 @@
                     + ", \">\", NULL);\n");
         }
 
-        writer.write("\n\tif (!bArray && blnIsNewPrefix)\n");
+        CUtils.printBlockComment(writer, "Remove namespace, if new.");        
+        
+        writer.write("\tif (!bArray && blnIsNewPrefix)\n");
         writer.write("\t\tpSZ->removeNamespacePrefix(Axis_URI_" + classname + ");\n");
         writer.write("\n");
         
@@ -628,6 +634,8 @@
      */
     private void writeDOCArrayPortionOfSerializeGlobalMethod() throws IOException
     {
+        CUtils.printBlockComment(writer, "Serialize top-most element, possibly defining new namespace.");        
+        
         // For doc/literal objects
         writer.write("\tbool blnIsNewPrefix = false;\n");
         writer.write("\tif (!bArray)\n\t{\n");
@@ -635,7 +643,7 @@
         writer.write("\t\tif (blnIsNewPrefix)\n");
         writer.write("\t\t\tpSZ->serialize(\" xmlns:\", sPrefix, \"=\\\"\", "
                         + "Axis_URI_" + classname + ", \"\\\"\", NULL);\n");
-        writer.write( "\t}\n\n");
+        writer.write( "\t}\n");
     }
 
     /**
@@ -662,7 +670,7 @@
                     + "\" xsi:type=\\\"\", sPrefix, \":\", " 
                     + "Axis_TypeName_" + classname + ", \"\\\" xmlns:\", " 
                     + "sPrefix, \"=\\\"\", Axis_URI_" + classname + ", \"\\\">\", NULL);\n");
-        writer.write( "\t}\n\n");
+        writer.write( "\t}\n");
     }
 
     private void writeDeSerializeExtensionCode() throws IOException, WrapperFault
@@ -670,6 +678,8 @@
         if (extensionBaseAttrib != null
                 && extensionBaseAttrib.getTypeName() != null)
         {
+            CUtils.printBlockComment(writer, "Deserialize extension.");
+            
             if (extensionBaseAttrib.isSimpleType())
             {
                 writer.write("\tvoid* pCharDataAs;\n");
@@ -729,11 +739,18 @@
             return;
         }
 
+        
+        // We always use this...
+        writer.write("\tconst char* peekedElementName;\n");
+
         //=============================================================================
         // Deserialize attributes.
         // Makes logic simpler to follow with slight duplication. TODO
         //=============================================================================        
         
+        if (attributeParamCount > 0)
+            CUtils.printBlockComment(writer, "Deserialize attributes.");
+        
         //=============================================================================
         // Deserialize attributes and elements.
         //=============================================================================        
@@ -745,8 +762,22 @@
         int anyCounter = 0; //counter for any types.
         int arrayCount = 0;
         
+        boolean handleAll = false;
+        boolean handleChoice = false;
+     
+        // Tabs to ensure code alignment
+        String tab1  = "\t";
+        String tab2Default = "";
+        String tab2;
+       
         for (int i = 0; i < attribs.length; i++)
         {
+            // Reset tabs
+            tab2  = tab2Default + "\t";
+            
+            if (i == attributeParamCount)
+                CUtils.printBlockComment(writer, "Deserialize elements.");
+            
             //if the attribute is a 'choice' construct we have to peek and make
             // the choice
 
@@ -794,7 +825,7 @@
             if (attribs[i].isAnyType())
             {
                 anyCounter +=1;
-                writer.write("\tparam->any" + Integer.toString(anyCounter)+ " = pIWSDZ->getAnyObject();\n");
+                writer.write(tab1 + "param->any" + Integer.toString(anyCounter)+ " = pIWSDZ->getAnyObject();\n");
             }
             else if (attribs[i].isArray())
             {
@@ -808,19 +839,19 @@
                     else
                         baseTypeName = attribs[i].getTypeName();
 
-                    writer.write("\tAxis_Array * array" + arrayCount + " = pIWSDZ->getBasicArray("
+                    writer.write(tab1 + "Axis_Array * array" + arrayCount + " = pIWSDZ->getBasicArray("
                             + CUtils.getXSDTypeForBasicType(baseTypeName) + ", \""
                             + attribs[i].getParamNameAsSOAPString()
                             + "\",0);\n");
-                    writer.write("\tif(param->" + attribs[i].getParamNameAsMember() + " == NULL)\n");
-                    writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + " = new " + attribs[i].getTypeName() + "_Array();\n");
-                    writer.write("\tparam->" + attribs[i].getParamNameAsMember() + "->clone( *array" + arrayCount + ");\n");
-                    writer.write("\tAxis::AxisDelete((void*) array" + arrayCount + ", XSD_ARRAY);\n\n");
+                    writer.write(tab1 + "if(param->" + attribs[i].getParamNameAsMember() + " == NULL)\n");
+                    writer.write(tab1 + "\tparam->" + attribs[i].getParamNameAsMember() + " = new " + attribs[i].getTypeName() + "_Array();\n");
+                    writer.write(tab1 + "param->" + attribs[i].getParamNameAsMember() + "->clone( *array" + arrayCount + ");\n");
+                    writer.write(tab1 + "Axis::AxisDelete((void*) array" + arrayCount + ", XSD_ARRAY);\n\n");
                 }
                 else
                 {
                     arrayType = attribs[i].getTypeName();
-                    writer.write("\tpIWSDZ->getCmplxArray(param->" + attribs[i].getParamNameAsMember() 
+                    writer.write(tab1 + "pIWSDZ->getCmplxArray(param->" + attribs[i].getParamNameAsMember() 
                             + ", (void*)Axis_DeSerialize_" + arrayType
                             + ", (void*)Axis_Create_" + arrayType 
                             + ", (void*)Axis_Delete_" + arrayType
@@ -834,9 +865,10 @@
                 // We only peek for elements, not element attributes!
                 if (attribs[i].isOptional() && !attribs[i].isAttribute())
                 {
-                    writer.write("\tconst char* elementName" + i + " = pIWSDZ->peekNextElementName();\n");
-                    writer.write("\t\tif(strcmp(elementName" + i + ", \"" + soapTagName + "\") == 0)\n");
-                    writer.write("\t\t{\n");
+                    writer.write(tab1 + "peekedElementName = pIWSDZ->peekNextElementName();\n");
+                    writer.write(tab1 + "if (strcmp(peekedElementName, \"" + soapTagName + "\") == 0)\n");
+                    writer.write(tab1 + "{\n");
+                    tab2 += "\t";
                 }
                 
                 Type type = attribs[i].getType();
@@ -853,13 +885,13 @@
                 {
                     if (attribs[i].getChoiceElement() && isElementNillable(i) && !isPointerType)
                     {
-                        writer.write("\tparam->"
+                        writer.write(tab2 + "param->"
                                 + attribs[i].getParamNameAsMember()
                                 + " = (" + attribs[i].getTypeName()
                                 + "**)(" + attribs[i].getTypeName()
                                 +"*)new " +attribs[i].getTypeName() + ";\n");
                         
-                        writer.write("\t\t*(param->"
+                        writer.write(tab2 + "*(param->"
                                 + attribs[i].getParamNameAsMember() + ") = pIWSDZ->"
                                 + CUtils.getParameterGetValueMethodName(
                                         attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
@@ -876,59 +908,60 @@
                         
                         if( isPointerType)
                         {
-                            writer.write("\t" + typeName + "    pValue" + i + " = pIWSDZ->" +
+                            writer.write(tab2 + typeName + " pValue" + i + " = pIWSDZ->" +
                                     CUtils.getParameterGetValueMethodName(baseTypeName, attribs[i].isAttribute()) +
                                     "( \"" + soapTagName + "\", 0);\n");
                         }
                         else
                         {
-                            writer.write("\t\t\t" + typeName + " *    pValue" + i + " = pIWSDZ->" +
+                            writer.write(tab2 + typeName + " *    pValue" + i + " = pIWSDZ->" +
                                     CUtils.getParameterGetValueMethodName(baseTypeName, attribs[i].isAttribute()) +
                                     "( \"" + soapTagName + "\", 0);\n");
                         }
                         
-                        writer.write( "\t\t\tif( pValue" + i + " == NULL)\n");
-                        writer.write("\t\t\t\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
-                        writer.write( "\t\t\telse\n");
-                        writer.write( "\t\t\t{\n");
+                        writer.write(tab2 + "if( pValue" + i + " == NULL)\n");
+                        writer.write(tab2 + "\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
+                        writer.write(tab2 + "else\n");
+                        writer.write(tab2 + "{\n");
                         
-                        writer.write("\t\t\t\tparam->set" + attribs[i].getMethodName() + " (pValue" + i + ");\n");
-                        writer.write("\t\t\t\tAxis::AxisDelete( (void *) pValue" + i + ", " 
-                                + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n\n");
-                        writer.write( "\t\t\t}\n\n");
+                        writer.write(tab2 + "\tparam->set" + attribs[i].getMethodName() + " (pValue" + i + ");\n");
+                        writer.write(tab2 + "\tAxis::AxisDelete( (void *) pValue" + i + ", " 
+                                + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n");
+                        writer.write(tab2 + "}\n");
                     }
                 } 
                 else if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
                 {
-                    writer.write("\tparam->"
+                    writer.write(tab2 + "param->"
                             + attribs[i].getParamNameAsMember() + " = pIWSDZ->"
                             + CUtils.getParameterGetValueMethodName(
                                     attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
                             + soapTagName + "\",0);\n");
+//                    writer.write(tab2 + "param->__axis_deepcopy_"  + attribs[i].getParamNameAsMember()
+//                            + " = true;\n");
                 }
                 else
                 {
                     String elementNameToSearchFor = attribs[i].isAttribute()? attribs[i].getParamNameAsSOAPString():attribs[i].getElementNameAsSOAPString();
                     
-                    writer.write("\t" + attribs[i].getTypeName() + " * "
-                            + attribs[i].getParamNameAsMember() + " = NULL;\n\n");
-                    writer.write("\tif ((" + attribs[i].getParamNameAsMember() + " = pIWSDZ->"
+                    writer.write(tab2 + attribs[i].getTypeName() + " * "
+                            + attribs[i].getParamNameAsMember() + " = NULL;\n");
+                    writer.write(tab2 + "if ((" + attribs[i].getParamNameAsMember() + " = pIWSDZ->"
                             + CUtils.getParameterGetValueMethodName(
                                     attribs[i].getTypeName(), attribs[i].isAttribute()) + "( \""
-                            + elementNameToSearchFor + "\",0)) != NULL)\n\t{\n");
-
-                    writer.write("\t\tparam->set"
+                            + elementNameToSearchFor + "\",0)) != NULL)\n");
+                    writer.write(tab2 + "{\n");
+                    writer.write(tab2 + "\tparam->set"
                             + attribs[i].getMethodName() + "(* " + attribs[i].getParamNameAsMember() + " );\n");
-                    writer.write("\t\tAxis::AxisDelete( (void *) " + attribs[i].getParamNameAsMember() + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
-                    writer.write("\t}\n");                        
+                    writer.write(tab2 + "\tAxis::AxisDelete( (void *) " + attribs[i].getParamNameAsMember() + ", " + CUtils.getXSDTypeForBasicType( attribs[i].getTypeName()) + ");\n");
+                    writer.write(tab2 + "}\n");                        
                 }
                 
                 if (attribs[i].isOptional() && !attribs[i].isAttribute())
                 {
-                    writer.write("\t\t\t}\n");
-                    writer.write("\t\telse\n");
-                    writer.write("\t\t\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
-                    writer.write("\n");
+                    writer.write(tab1 + "}\n");
+                    writer.write(tab1 + "else\n");
+                    writer.write(tab1 + "\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
                 }
             }
             else
@@ -938,12 +971,12 @@
                 
                 if (attribs[i].isOptional())
                 {
-                    writer.write("\tconst char* elementName" + i + " = pIWSDZ->peekNextElementName();\n");
-                    writer.write("\tif(strcmp(elementName" + i + ", \"" + soapTagName + "\") == 0)\n");
-                    writer.write("\t{\n");
+                    writer.write(tab1 + "peekedElementName = pIWSDZ->peekNextElementName();\n");
+                    writer.write(tab1 + "if (strcmp(peekedElementName, \"" + soapTagName + "\") == 0)\n");
+                    tab2 += "\t";
                 }
 
-                writer.write("\tparam->" + attribs[i].getParamNameAsMember()
+                writer.write(tab2 + "param->" + attribs[i].getParamNameAsMember()
                         + " = (" + attribs[i].getTypeName()
                         + "*)pIWSDZ->getCmplxObject((void*)Axis_DeSerialize_" + attribs[i].getTypeName()
                         + ", (void*)Axis_Create_" + attribs[i].getTypeName() 
@@ -952,19 +985,19 @@
                 
                 if (attribs[i].isOptional())
                 {
-                    writer.write("\t}\n");
-                    writer.write("\telse\n");
-                    writer.write("\t\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
-                    writer.write("\n");
+                    writer.write(tab1 + "else\n");
+                    writer.write(tab1 + "\tparam->" + attribs[i].getParamNameAsMember() + " = NULL;\n");
                 }
             }
 
             if (attribs[i].getChoiceElement())
-                writer.write("\t}\n");
+                writer.write(tab1 + "}\n");
             
             if (attribs[i].getAllElement())
                 if (attribs[i].getMinOccurs() == 0)
                     writer.write("\t}\n");
+            
+            writer.write("\n");                        
         }
         
         //=============================================================================

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java?view=diff&rev=510407&r1=510406&r2=510407
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java Wed Feb 21 22:02:02 2007
@@ -334,30 +334,33 @@
                 
         writer.write ("\ttry\n\t{\n");
     
-        writer.write("\tif (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER" + "))\n");
-        writer.write("\t\treturn ");
+        CUtils.printBlockComment(writer, "Initialize client engine, set SOAP version, SOAPAction, operation, etc.");
+        
+        writer.write("\t\tif (AXIS_SUCCESS != m_pCall->initialize(CPP_DOC_PROVIDER" + "))\n");
+        writer.write("\t\t\treturn ");
         if (returntype != null)
             writer.write ((returntypeisarray ? "RetArray" : returntypeissimple ? "Ret" : "pReturn") + ";\n");
         else
             writer.write (";\n");
         writer.write ("\n");
         
-        writer.write ("\tif (NULL==m_pCall->getTransportProperty(\"SOAPAction\",false))\n");
-        writer.write ("\t\tm_pCall->setTransportProperty(SOAPACTION_HEADER , \""
+        writer.write ("\t\tif (NULL==m_pCall->getTransportProperty(\"SOAPAction\",false))\n");
+        writer.write ("\t\t\tm_pCall->setTransportProperty(SOAPACTION_HEADER , \""
                + minfo.getSoapAction () + "\");\n");
         writer.write("\n");
         
-        writer.write ("\tm_pCall->setSOAPVersion(SOAP_VER_1_1);\n");
+        writer.write ("\t\tm_pCall->setSOAPVersion(SOAP_VER_1_1);\n");
         //TODO check which version is it really.
         
         if( minfo.getInputMessage() != null)
         {
-            writer.write( "\tm_pCall->setOperation(\"" 
+            writer.write( "\t\tm_pCall->setOperation(\"" 
                     + minfo.getInputMessage().getLocalPart() + "\", \"" 
                     + minfo.getInputMessage().getNamespaceURI() + "\");\n");
         }
         
         // Add attributes to soap method
+        boolean commentIssued=false;
         for (int i = 0; i < paramsB.size (); i++)
         {
             ParameterInfo param = (ParameterInfo) paramsB.get (i);
@@ -366,40 +369,58 @@
             if (!param.isAttribute ())
                 continue;
             
+            if (!commentIssued)
+            {
+                commentIssued = true;
+                CUtils.printBlockComment(writer, "Add attributes to soap method.");
+            }
+            else
+                writer.write ("\n");
+            
             // Process attributes
             String elementType = param.getElementName ().getLocalPart ();
     
             if ("string".equals (elementType))
             {
-                writer.write ("\tm_pCall->setSOAPMethodAttribute(\""
+                writer.write ("\t\tm_pCall->setSOAPMethodAttribute(\""
                       + param.getParamNameAsSOAPString () + "\", \"\", Value" + i + ");\n");
             }
             else if ("int".equals (elementType))
             {
-                writer.write ("\t{\n");
-                writer.write ("\t\tchar buffer[20];\n");
-                writer.write ("\t\tsprintf(buffer,\"%d\", Value" + i + ");\n");
-                writer.write ("\t\tm_pCall->setSOAPMethodAttribute(\"" +
+                writer.write ("\t\t{\n");
+                writer.write ("\t\t\tchar buffer[20];\n");
+                writer.write ("\t\t\tsprintf(buffer,\"%d\", Value" + i + ");\n");
+                writer.write ("\t\t\tm_pCall->setSOAPMethodAttribute(\"" +
                        param.getParamNameAsSOAPString () + "\", \"\", buffer);\n");
-                writer.write ("\t}\n");
+                writer.write ("\t\t}\n");
             }
         } // end for-loop
     
         //new calls from stub base
-        writer.write("\n");
-        writer.write ("\tincludeSecure();\n");
-        writer.write ("\tapplyUserPreferences();\n");
-        writer.write("\n");
-    
+        CUtils.printBlockComment(writer, "Apply SSL configuration properties and user-set SOAP headers.");
+        writer.write ("\t\tincludeSecure();\n");
+        writer.write ("\t\tapplyUserPreferences();\n");
+
         // Process elements
+        commentIssued=false;
+        String tab2;
         for (int i = 0; i < paramsB.size (); i++)
         {
+            tab2 = "";
             ParameterInfo param = (ParameterInfo) paramsB.get (i);
     
             // Ignore attributes
             if (param.isAttribute ())
                 continue;
-                
+
+            if (!commentIssued)
+            {
+                commentIssued = true;
+                CUtils.printBlockComment(writer, "Process parameters.");
+            }
+            else
+                writer.write ("\n");
+            
             // add elements
             type = wscontext.getTypemap ().getType (param.getSchemaName ());
             if (type != null)
@@ -426,25 +447,28 @@
             }
     
             if (param.isAnyType ())
-                writer.write ("\tm_pCall->addAnyObject(Value" + i);
+                writer.write ("\t\tm_pCall->addAnyObject(Value" + i);
             else
             {
                 String parameterName = ((ParameterInfo) paramsB.get (i)).getElementNameAsSOAPString ();
                 String namespace = ((ParameterInfo) paramsB.get (i)).getElementName ().getNamespaceURI ();
     
                 if (((ParameterInfo)paramsB.get(i)).isOptional())
-                    writer.write("\tif (Value" + i + " != NULL)\n\t{\n");
+                {
+                    writer.write("\t\tif (Value" + i + " != NULL)\n\t\t{\n");
+                    tab2 = "\t";
+                }
                 
                 if (namespace.length () == 0)
                 {
-                    writer.write ("\tchar cPrefixAndParamName"
+                    writer.write (tab2 + "\t\tchar cPrefixAndParamName"
                               + i + "[" + "] = \"" + parameterName + "\";\n");
                 }
                 else
                 {
                     int stringLength = 8 + 1 + parameterName.length () + 1;
-                    writer.write ("\tchar cPrefixAndParamName" + i + "[" + stringLength + "];\n");
-                    writer.write ("\tsprintf( cPrefixAndParamName" + i +
+                    writer.write (tab2 + "\t\tchar cPrefixAndParamName" + i + "[" + stringLength + "];\n");
+                    writer.write (tab2 + "\t\tsprintf( cPrefixAndParamName" + i +
                               ", \"%s:" + parameterName +
                               "\", m_pCall->getNamespacePrefix(\"" +  namespace + "\"));\n");
                 }
@@ -452,18 +476,18 @@
                 if (param.getType().isAttachment())
                 {
                     String attchType = param.getType().getName().getLocalPart();
-                          writer.write("\n\tconst AxisChar *xmlSoapNsPfx" + i + 
+                          writer.write(tab2 + "\t\tconst AxisChar *xmlSoapNsPfx" + i + 
                         " = m_pCall->getNamespacePrefix(\"" + 
                         WrapperConstants.APACHE_XMLSOAP_NAMESPACE + "\");\n");
-                    writer.write("\tchar attchType" + i + "[64];\n");
-                    writer.write("\tstrcpy(attchType" + i + ", xmlSoapNsPfx" + i + ");\n");
-                    writer.write("\tstrcat(attchType" + i + ", \":" + attchType + "\");\n");
-                    writer.write("\tIAttribute *attrs" + i + "[2];\n");
-                    writer.write("\tattrs" + i + "[0] = m_pCall->createAttribute(\"type\", \"xsi\", attchType" + i + 
+                    writer.write(tab2 + "\t\tchar attchType" + i + "[64];\n");
+                    writer.write(tab2 + "\t\tstrcpy(attchType" + i + ", xmlSoapNsPfx" + i + ");\n");
+                    writer.write(tab2 + "\t\tstrcat(attchType" + i + ", \":" + attchType + "\");\n");
+                    writer.write(tab2 + "\t\tIAttribute *attrs" + i + "[2];\n");
+                    writer.write(tab2 + "\t\tattrs" + i + "[0] = m_pCall->createAttribute(\"type\", \"xsi\", attchType" + i + 
                         ");\n");
-                    writer.write("\tattrs" + i + "[1] = m_pCall->createAttribute(xmlSoapNsPfx" + i + 
+                    writer.write(tab2 + "\t\tattrs" + i + "[1] = m_pCall->createAttribute(xmlSoapNsPfx" + i + 
                         ", \"xmlns\", \"http://xml.apache.org/xml-soap\");\n");
-                    writer.write("\tm_pCall->addAttachmentParameter(Value" + i + ", cPrefixAndParamName" + i + 
+                    writer.write(tab2 + "\t\tm_pCall->addAttachmentParameter(Value" + i + ", cPrefixAndParamName" + i + 
                         ", attrs" + i + ", 2");
                 }
                 else if (typeisarray)
@@ -480,14 +504,14 @@
                     {
                         // Array of simple type
                         String containedType = CUtils.getclass4qname (qname);
-                        writer.write ("\tm_pCall->addBasicArrayParameter(");
+                        writer.write (tab2 + "\t\tm_pCall->addBasicArrayParameter(");
                         writer.write ("Value" + i + ", " +
                               CUtils.getXSDTypeForBasicType(containedType) + ", cPrefixAndParamName" + i);
                     }
                     else if (arrayType != null && arrayType.isSimpleType ())
                     {
                         String containedType = CUtils.getclass4qname (arrayType.getBaseType ());
-                        writer.write ("\tm_pCall->addBasicArrayParameter(");
+                        writer.write (tab2 + "\t\tm_pCall->addBasicArrayParameter(");
                         writer.write ("Value" + i + ", " +
                                   CUtils.getXSDTypeForBasicType(containedType) +
                                   ", cPrefixAndParamName" + i);
@@ -496,7 +520,7 @@
                     {
                         // Array of complex type
                         String containedType = qname.getLocalPart ();
-                        writer.write ("\tm_pCall->addCmplxArrayParameter(");
+                        writer.write (tab2 + "\t\tm_pCall->addCmplxArrayParameter(");
                         writer.write ("Value" + i +
                                   ", (void*)Axis_Serialize_" + containedType +
                                   ", (void*)Axis_Delete_" + containedType +
@@ -514,13 +538,13 @@
                             || param.isOptional()
                             || CUtils.isPointerType(paramTypeName))
                     {
-                        writer.write ("\tm_pCall->addParameter(");
+                        writer.write (tab2 + "\t\tm_pCall->addParameter(");
                         writer.write ("(void*)Value" + i + ", cPrefixAndParamName" + i
                                   + ", " + CUtils.getXSDTypeForBasicType(paramTypeName));
                     }
                     else
                     {
-                        writer.write ("\tm_pCall->addParameter(");
+                        writer.write (tab2 + "\t\tm_pCall->addParameter(");
                         writer.write ("(void*)&Value" + i + ", cPrefixAndParamName" + i
                                   + ", " + CUtils.getXSDTypeForBasicType(paramTypeName));
                     }
@@ -528,7 +552,7 @@
                 else
                 {
                     // Complex Type
-                    writer.write ("\tm_pCall->addCmplxParameter(");
+                    writer.write (tab2 + "\t\tm_pCall->addCmplxParameter(");
                     writer.write ("Value" + i
                           + ", (void*)Axis_Serialize_" + paramTypeName
                           + ", (void*)Axis_Delete_" + paramTypeName
@@ -538,21 +562,23 @@
 
             writer.write (");\n");
             if (((ParameterInfo)paramsB.get(i)).isOptional())
-                writer.write("\t}\n");
+                writer.write("\t\t}\n");
         } // end for-loop
         
-        writer.write("\n");
-        
 
         if (minfo.getOutputMessage () != null)
         {
-            writer.write ("\tif (AXIS_SUCCESS == m_pCall->sendAndReceive())\n\t{\n");
-            writer.write ("\t\tif(AXIS_SUCCESS == m_pCall->checkMessage(\""
+            CUtils.printBlockComment(writer, "Invoke web service, send/receive operation. Handle output parameters, if any.");
+            writer.write ("\t\tif (AXIS_SUCCESS == m_pCall->sendAndReceive())\n\t\t{\n");
+            writer.write ("\t\t\tif(AXIS_SUCCESS == m_pCall->checkMessage(\""
                   + minfo.getOutputMessage ().getLocalPart () + "\", \""
-                  + minfo.getOutputMessage ().getNamespaceURI () + "\"))\n\t\t{\n");
+                  + minfo.getOutputMessage ().getNamespaceURI () + "\"))\n\t\t\t{\n");
         }
         else
-            writer.write ("\tif (AXIS_SUCCESS == m_pCall->send())\n\t{\n");
+        {
+            CUtils.printBlockComment(writer, "Invoke web service, send-only operation.");
+            writer.write ("\t\tif (AXIS_SUCCESS == m_pCall->send())\n\t\t{\n");
+        }
         
         if (isAllTreatedAsOutParams)
         {
@@ -607,48 +633,48 @@
                     {
                         containedType = CUtils.getclass4qname (qname);
         
-                        writer.write("\n\t\t\tAxis_Array * pReturn" + i + " = m_pCall->getBasicArray(" + CUtils.getXSDTypeForBasicType (containedType) 
+                        writer.write("\n\t\t\t\tAxis_Array * pReturn" + i + " = m_pCall->getBasicArray(" + CUtils.getXSDTypeForBasicType (containedType) 
                             + ", \"" + currentType.getParamNameAsSOAPString ()
                             + "\", 0);\n\n");
-                        writer.write("\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
-                        writer.write("\t\t\t{\n");
-                        writer.write("\t\t\t\tif( *OutValue" + i + " == NULL)\n");
-                        writer.write("\t\t\t\t\t*OutValue" + i + " = new " + currentParaType + "();\n");
-                        writer.write("\t\t\t\telse\n");
-                        writer.write("\t\t\t\t\t(*OutValue" + i + ")->clear();\n");
-                        writer.write("\t\t\t\t(*OutValue" + i + ")->clone(*pReturn" + i + ");\n");
-                        writer.write("\t\t\t}\n\n");
-                        writer.write("\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", XSD_ARRAY);\n");
+                        writer.write("\t\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
+                        writer.write("\t\t\t\t{\n");
+                        writer.write("\t\t\t\t\tif( *OutValue" + i + " == NULL)\n");
+                        writer.write("\t\t\t\t\t\t*OutValue" + i + " = new " + currentParaType + "();\n");
+                        writer.write("\t\t\t\t\telse\n");
+                        writer.write("\t\t\t\t\t\t(*OutValue" + i + ")->clear();\n");
+                        writer.write("\t\t\t\t\t(*OutValue" + i + ")->clone(*pReturn" + i + ");\n");
+                        writer.write("\t\t\t\t}\n\n");
+                        writer.write("\t\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", XSD_ARRAY);\n");
                     }
                     else
                     {
                         containedType = qname.getLocalPart ();
-                        writer.write("\n\t\t\tif (OutValue" + i + " != NULL)\n" );
-                        writer.write("\t\t\t{\n");
-                        writer.write("\t\t\t\tif (" + currentParamName + " == NULL)\n");
-                        writer.write("\t\t\t\t\t" + currentParamName + " = new " + containedType + "_Array();\n");
-                        writer.write("\t\t\t\telse\n");
-                        writer.write("\t\t\t\t\t(" + currentParamName + ")->clear();\n");
-                        writer.write("\t\t\t\tm_pCall->getCmplxArray(" + currentParamName 
+                        writer.write("\n\t\t\t\tif (OutValue" + i + " != NULL)\n" );
+                        writer.write("\t\t\t\t{\n");
+                        writer.write("\t\t\t\t\tif (" + currentParamName + " == NULL)\n");
+                        writer.write("\t\t\t\t\t\t" + currentParamName + " = new " + containedType + "_Array();\n");
+                        writer.write("\t\t\t\t\telse\n");
+                        writer.write("\t\t\t\t\t\t(" + currentParamName + ")->clear();\n");
+                        writer.write("\t\t\t\t\tm_pCall->getCmplxArray(" + currentParamName 
                               + ", (void*) Axis_DeSerialize_" + containedType
                               + ", (void*) Axis_Create_" + containedType
                               + ", (void*) Axis_Delete_" + containedType
                               + ", \"" + currentType.getElementNameAsSOAPString () 
                               + "\", Axis_URI_" + containedType + ");\n");
-                        writer.write("\t\t\t}\n");
-                        writer.write("\t\t\telse\n");
-                        writer.write("\t\t\t{\n");
-                        writer.write("\t\t\t\t// Unable to return value, but will deserialize to ensure subsequent elements can be correctly processed.\n");
-                        writer.write("\t\t\t\t" + containedType + "_Array * pTemp" + i 
+                        writer.write("\t\t\t\t}\n");
+                        writer.write("\t\t\t\telse\n");
+                        writer.write("\t\t\t\t{\n");
+                        writer.write("\t\t\t\t\t// Unable to return value, but will deserialize to ensure subsequent elements can be correctly processed.\n");
+                        writer.write("\t\t\t\t\t" + containedType + "_Array * pTemp" + i 
                                 + " = new " + containedType + "_Array();\n");
-                        writer.write("\t\t\t\tm_pCall->getCmplxArray(pTemp" + i 
+                        writer.write("\t\t\t\t\tm_pCall->getCmplxArray(pTemp" + i 
                               + ", (void*) Axis_DeSerialize_" + containedType
                               + ", (void*) Axis_Create_" + containedType
                               + ", (void*) Axis_Delete_" + containedType
                               + ", \"" + currentType.getElementNameAsSOAPString () 
                               + "\", Axis_URI_" + containedType + ");\n");
-                        writer.write("\t\t\t\tdelete pTemp" + i + ";\n");
-                        writer.write("\t\t\t}\n");
+                        writer.write("\t\t\t\t\tdelete pTemp" + i + ";\n");
+                        writer.write("\t\t\t\t}\n");
                     }
                 }
                 else if (typeissimple)
@@ -668,58 +694,58 @@
                             xsdType += " *";
                         }
                         
-                        writer.write( "\t\t\t" + currentParaType + " pReturn" + i + " = m_pCall->" + CUtils.getParameterGetValueMethodName( baseTypeName, false) + "( \"" + currentType.getParamNameAsSOAPString() + "\", 0);\n");
+                        writer.write( "\t\t\t\t" + currentParaType + " pReturn" + i + " = m_pCall->" + CUtils.getParameterGetValueMethodName( baseTypeName, false) + "( \"" + currentType.getParamNameAsSOAPString() + "\", 0);\n");
                         writer.write( "\n");
-                        writer.write( "\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
-                        writer.write( "\t\t\t\t{\n");
-                        writer.write( "\t\t\t\tif( *OutValue" + i + " != NULL)\n");
-                        writer.write( "\t\t\t\t{\n");
-                        writer.write( "\t\t\t\t\tint\tiStringSize" + i + " = strlen( (char *) *OutValue" + i + ");\n");
-                        writer.write( "\t\t\t\t\tint\tiStrLenValue" + i + " = strlen( pReturn" + i + ");\n");
-                        writer.write( "\n");
-                        writer.write( "\t\t\t\t\tif( iStrLenValue" + i + " > iStringSize" + i + ")\n");
+                        writer.write( "\t\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
                         writer.write( "\t\t\t\t\t{\n");
-                        writer.write( "\t\t\t\t\t\t*OutValue" + i + " =(" + xsdType + ") new char[iStrLenValue" + i + " + 1];\n");
-                        writer.write( "\t\t\t\t\t\tstrcpy( (char *) *OutValue" + i + ", pReturn" + i + ");\n");
+                        writer.write( "\t\t\t\t\tif( *OutValue" + i + " != NULL)\n");
+                        writer.write( "\t\t\t\t\t{\n");
+                        writer.write( "\t\t\t\t\t\tint\tiStringSize" + i + " = strlen( (char *) *OutValue" + i + ");\n");
+                        writer.write( "\t\t\t\t\t\tint\tiStrLenValue" + i + " = strlen( pReturn" + i + ");\n");
+                        writer.write( "\n");
+                        writer.write( "\t\t\t\t\t\tif( iStrLenValue" + i + " > iStringSize" + i + ")\n");
+                        writer.write( "\t\t\t\t\t\t{\n");
+                        writer.write( "\t\t\t\t\t\t\t*OutValue" + i + " =(" + xsdType + ") new char[iStrLenValue" + i + " + 1];\n");
+                        writer.write( "\t\t\t\t\t\t\tstrcpy( (char *) *OutValue" + i + ", pReturn" + i + ");\n");
+                        writer.write( "\t\t\t\t\t\t}\n");
+                        writer.write( "\t\t\t\t\t\telse\n");
+                        writer.write( "\t\t\t\t\t\t\tstrcpy( (char *) *OutValue" + i + ", pReturn" + i + ");\n");
                         writer.write( "\t\t\t\t\t}\n");
                         writer.write( "\t\t\t\t\telse\n");
+                        writer.write( "\t\t\t\t\t{\n");
+                        writer.write( "\t\t\t\t\t\t*OutValue" + i + " = (" + xsdType + ") new char[strlen( pReturn" + i + ") + 1];\n");
                         writer.write( "\t\t\t\t\t\tstrcpy( (char *) *OutValue" + i + ", pReturn" + i + ");\n");
+                        writer.write( "\t\t\t\t\t}\n");
                         writer.write( "\t\t\t\t}\n");
-                        writer.write( "\t\t\t\telse\n");
-                        writer.write( "\t\t\t\t{\n");
-                        writer.write( "\t\t\t\t\t*OutValue" + i + " = (" + xsdType + ") new char[strlen( pReturn" + i + ") + 1];\n");
-                        writer.write( "\t\t\t\t\tstrcpy( (char *) *OutValue" + i + ", pReturn" + i + ");\n");
-                        writer.write( "\t\t\t\t}\n");
-                        writer.write( "\t\t\t}\n");
                         writer.write( "\n");
-                        writer.write( "\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", " + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n");
+                        writer.write( "\t\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", " + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n");
                     }
                     else 
                     {
-                        writer.write( "\t\t\t" + currentParaType + " * pReturn" + i + " = m_pCall->" + CUtils.getParameterGetValueMethodName( baseTypeName, false) + "( \"" + currentType.getParamNameAsSOAPString() + "\", 0);\n");
+                        writer.write( "\t\t\t\t" + currentParaType + " * pReturn" + i + " = m_pCall->" + CUtils.getParameterGetValueMethodName( baseTypeName, false) + "( \"" + currentType.getParamNameAsSOAPString() + "\", 0);\n");
                         writer.write( "\n");
-                        writer.write( "\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
-                        writer.write( "\t\t\t{\n");
+                        writer.write( "\t\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
+                        writer.write( "\t\t\t\t{\n");
                         
                         if (currentType.isNillable() || currentType.isOptional())
                         {
-                            writer.write( "\t\t\t\tif( *OutValue" + i + " == NULL)\n");
-                            writer.write( "\t\t\t\t\t*OutValue" + i + " = new " + currentParaType + "();\n");
+                            writer.write( "\t\t\t\t\tif( *OutValue" + i + " == NULL)\n");
+                            writer.write( "\t\t\t\t\t\t*OutValue" + i + " = new " + currentParaType + "();\n");
                             writer.write( "\n");
-                            writer.write( "\t\t\t\t*");
+                            writer.write( "\t\t\t\t\t*");
                         }
                         else
-                            writer.write( "\t\t\t\t");
+                            writer.write( "\t\t\t\t\t");
 
                         writer.write( "*OutValue" + i + " = *pReturn" + i + ";\n");
-                        writer.write( "\t\t\t}\n");
+                        writer.write( "\t\t\t\t}\n");
                         writer.write( "\n");
-                        writer.write( "\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", " + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n");
+                        writer.write( "\t\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", " + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n");
                     }
                 }
                 else if (currentType.isAnyType ())
                 {
-                    writer.write ("\t\t\t"
+                    writer.write ("\t\t\t\t"
                           + currentParamName + " = *(" + currentParaType 
                           + "*)m_pCall->getAnyObject();\n");
                 }
@@ -729,7 +755,7 @@
                     if (lastIndexOfStar > 0)
                         currentParaType = currentParaType.substring(0, lastIndexOfStar);
 
-                    writer.write ("\n\t\t\t"
+                    writer.write ("\n\t\t\t\t"
                               + currentParamName + " = (" + currentParaType
                               + "*)m_pCall->getCmplxObject((void*) Axis_DeSerialize_" + currentParaType 
                               + ", (void*) Axis_Create_" + currentParaType 
@@ -738,17 +764,17 @@
                 }
             } // end for-loop for paramsC
             
+            writer.write ("\t\t\t}\n");
             writer.write ("\t\t}\n");
-            writer.write ("\t}\n");
-            writer.write ("\tm_pCall->unInitialize();\n");
+            writer.write ("\t\tm_pCall->unInitialize();\n");
         }
         else if (returntype == null)
         {
             if (minfo.getOutputMessage () != null)
-                writer.write ("\t\t\t/*not successful*/\n\t\t}\n");
+                writer.write ("\t\t\t\t/*not successful*/\n\t\t\t}\n");
 
-            writer.write ("\t}\n");
-            writer.write ("\tm_pCall->unInitialize();\n");
+            writer.write ("\t\t}\n");
+            writer.write ("\t\tm_pCall->unInitialize();\n");
         }
         else if (returntypeisarray)
         {
@@ -761,16 +787,16 @@
             if (CUtils.isSimpleType (qname))
             {
                 containedType = CUtils.getclass4qname (qname);
-                writer.write ("\t\t\tAxis_Array * RetAxisArray = m_pCall->getBasicArray(" 
+                writer.write ("\t\t\t\tAxis_Array * RetAxisArray = m_pCall->getBasicArray(" 
                         + CUtils.getXSDTypeForBasicType (containedType) 
                         + ", \"" + returntype.getParamNameAsSOAPString () + "\", 0);\n");
-                writer.write ("\t\t\tRetArray->clone(*RetAxisArray);\n");
-                writer.write ("\t\t\tAxis::AxisDelete( (void *)RetAxisArray, XSD_ARRAY);\n");
+                writer.write ("\t\t\t\tRetArray->clone(*RetAxisArray);\n");
+                writer.write ("\t\t\t\tAxis::AxisDelete( (void *)RetAxisArray, XSD_ARRAY);\n");
             }
             else
             {
                 containedType = qname.getLocalPart ();
-                writer.write("\t\t\tRetArray = (" + containedType + "_Array *) m_pCall->getCmplxArray(RetArray, (void*) Axis_DeSerialize_"
+                writer.write("\t\t\t\tRetArray = (" + containedType + "_Array *) m_pCall->getCmplxArray(RetArray, (void*) Axis_DeSerialize_"
                         + containedType 
                         + ", (void*) Axis_Create_" + containedType
                           + ", (void*) Axis_Delete_" + containedType
@@ -778,10 +804,10 @@
                           + "\", Axis_URI_" + containedType + ");\n");
             }
             
+            writer.write ("\t\t\t}\n");
             writer.write ("\t\t}\n");
-            writer.write ("\t}\n");
-            writer.write ("\tm_pCall->unInitialize();\n");
-            writer.write ("\treturn RetArray;\n");
+            writer.write ("\t\tm_pCall->unInitialize();\n");
+            writer.write ("\t\treturn RetArray;\n");
         }
         else if (returntypeissimple)
         {
@@ -789,107 +815,107 @@
             {
                 if( CUtils.isPointerType( outparamType))
                 {
-                    writer.write( "\t\t\t" + outparamType + " pReturn = m_pCall->" 
+                    writer.write( "\t\t\t\t" + outparamType + " pReturn = m_pCall->" 
                             + CUtils.getParameterGetValueMethodName( outparamType, false) 
                             + "(\"" + returntype.getParamNameAsSOAPString() + "\", 0);\n");
                 }
                 else
                 {
-                    writer.write( "\t\t\t" + outparamType + " * pReturn = m_pCall->" 
+                    writer.write( "\t\t\t\t" + outparamType + " * pReturn = m_pCall->" 
                             + CUtils.getParameterGetValueMethodName( outparamType, false) 
                             + "(\"" + returntype.getParamNameAsSOAPString() + "\", 0);\n");
                 }
                 
                 writer.write( "\n");
-                writer.write( "\t\t\tif( pReturn != NULL)\n");
-                writer.write( "\t\t\t{\n");
+                writer.write( "\t\t\t\tif( pReturn != NULL)\n");
+                writer.write( "\t\t\t\t{\n");
                 if( CUtils.isPointerType(outparamType))
                 {
-                    writer.write( "\t\t\t\tRet = new char[strlen( pReturn) + 1];\n");
-                    writer.write( "\t\t\t\tstrcpy( Ret, pReturn);\n");
+                    writer.write( "\t\t\t\t\tRet = new char[strlen( pReturn) + 1];\n");
+                    writer.write( "\t\t\t\t\tstrcpy( Ret, pReturn);\n");
                 }
                 else
                 {
-                    writer.write( "\t\t\t\tRet = new " + outparamType + "();\n");
-                    writer.write( "\t\t\t\t*Ret = *pReturn;\n");
+                    writer.write( "\t\t\t\t\tRet = new " + outparamType + "();\n");
+                    writer.write( "\t\t\t\t\t*Ret = *pReturn;\n");
                 }
                 
-                writer.write( "\t\t\t\tAxis::AxisDelete( (void *) pReturn, " + CUtils.getXSDTypeForBasicType( outparamType) + ");\n");
+                writer.write( "\t\t\t\t\tAxis::AxisDelete( (void *) pReturn, " + CUtils.getXSDTypeForBasicType( outparamType) + ");\n");
+                writer.write( "\t\t\t\t}\n");
                 writer.write( "\t\t\t}\n");
-                writer.write( "\t\t}\n");
             }
             else
             {
                 if (CUtils.isPointerType(outparamType))
                 {
-                    writer.write ("\t\t\t" + outparamType +
+                    writer.write ("\t\t\t\t" + outparamType +
                               " pReturn = m_pCall->" +
                               CUtils.getParameterGetValueMethodName(outparamType,false) + "(\"" +
                               returntype.getParamNameAsSOAPString () + "\", 0);\n");
-                    writer.write ("\t\t\tif(pReturn)\n");
-                    writer.write ("\t\t\t{\n");
-                    writer.write ("\t\t\t\tRet = new char[strlen( pReturn) + 1];\n");
-                    writer.write ("\t\t\t\tstrcpy( Ret, pReturn);\n");
-                    writer.write ("\t\t\t\tAxis::AxisDelete( pReturn, XSD_STRING);\n");
-                    writer.write ("\t\t\t}\n");
+                    writer.write ("\t\t\t\tif(pReturn)\n");
+                    writer.write ("\t\t\t\t{\n");
+                    writer.write ("\t\t\t\t\tRet = new char[strlen( pReturn) + 1];\n");
+                    writer.write ("\t\t\t\t\tstrcpy( Ret, pReturn);\n");
+                    writer.write ("\t\t\t\t\tAxis::AxisDelete( pReturn, XSD_STRING);\n");
+                    writer.write ("\t\t\t\t}\n");
                 }
                 else
                 {
-                    writer.write ("\t\t\t" + outparamType + " * pReturn = m_pCall->" +
+                    writer.write ("\t\t\t\t" + outparamType + " * pReturn = m_pCall->" +
                               CUtils.getParameterGetValueMethodName(outparamType, false) + "(\"" +
                               returntype.getElementNameAsSOAPString() + "\", 0);\n");
-                    writer.write ("\t\t\tif(pReturn)\n");
-                    writer.write ("\t\t\t{\n");
+                    writer.write ("\t\t\t\tif(pReturn)\n");
+                    writer.write ("\t\t\t\t{\n");
                     
                     if( CUtils.isPointerType( outparamType))
-                        writer.write ("\t\t\t\tRet = *pReturn;\n");
+                        writer.write ("\t\t\t\t\tRet = *pReturn;\n");
                     else
-                        writer.write ("\t\t\t\tRet = *pReturn;\n");
+                        writer.write ("\t\t\t\t\tRet = *pReturn;\n");
     
-                    writer.write ("\t\t\t\tAxis::AxisDelete( (void *) pReturn, " + CUtils.getXSDTypeForBasicType( outparamType) + ");\n");
-                    writer.write ("\t\t\t}\n");
+                    writer.write ("\t\t\t\t\tAxis::AxisDelete( (void *) pReturn, " + CUtils.getXSDTypeForBasicType( outparamType) + ");\n");
+                    writer.write ("\t\t\t\t}\n");
                 }
                 
                 // TODO If we unexpectedly receive a nill value, when nillable="false" we should do something appropriate, perhaps as below:
 //                              writer.write("\t\t\telse");
 //                              writer.write("\t\t\t\tthrow new Exception(\"Unexpected use of nill\");");
-                writer.write ("\t\t}\n");
+                writer.write ("\t\t\t}\n");
 
             }
-            writer.write ("\t}\n");
-            writer.write ("\tm_pCall->unInitialize();\n");
-            writer.write ("\treturn Ret;\n");
+            writer.write ("\t\t}\n");
+            writer.write ("\t\tm_pCall->unInitialize();\n");
+            writer.write ("\t\treturn Ret;\n");
         }
         else if (returntype.isAnyType ())
         {
-            writer.write ("\t\t\tpReturn = (" + outparamType + "*)m_pCall->getAnyObject();\n\t\t}\n");
-            writer.write ("\t}\n");
-            writer.write ("\tm_pCall->unInitialize();\n");
-            writer.write ("\treturn pReturn;\n");
+            writer.write ("\t\t\t\tpReturn = (" + outparamType + "*)m_pCall->getAnyObject();\n\t\t}\n");
+            writer.write ("\t\t}\n");
+            writer.write ("\t\tm_pCall->unInitialize();\n");
+            writer.write ("\t\treturn pReturn;\n");
         }
         else
         {
             if (outparamType.lastIndexOf ("*") > 0)
             {
                 String outparamTypeBase = outparamType.substring (0,outparamType.lastIndexOf("*"));
-                writer.write ("\t\t\tpReturn = (" + outparamType +
+                writer.write ("\t\t\t\tpReturn = (" + outparamType +
                           ")m_pCall->getCmplxObject((void*) Axis_DeSerialize_" + outparamTypeBase +
                           ", (void*) Axis_Create_" + outparamTypeBase +
                           ", (void*) Axis_Delete_" + outparamTypeBase + ",\"" +
-                          returntype.getElementNameAsSOAPString () + "\", 0);\n\t\t}\n");
+                          returntype.getElementNameAsSOAPString () + "\", 0);\n\t\t\t}\n");
             }
             else
             {
-                writer.write ("\t\t\tpReturn = (" + outparamType
+                writer.write ("\t\t\t\tpReturn = (" + outparamType
                           + "*)m_pCall->getCmplxObject((void*) Axis_DeSerialize_" + outparamType +
                           ", (void*) Axis_Create_" + outparamType +
                           ", (void*) Axis_Delete_" + outparamType + ",\"" +
-                          returntype.getElementNameAsSOAPString () + "\", 0);\n\t\t}\n");
+                          returntype.getElementNameAsSOAPString () + "\", 0);\n\t\t\t}\n");
             }
 
-            writer.write ("\t}\n");
-            writer.write ("\tm_pCall->unInitialize();\n");
-            writer.write ("\treturn pReturn;\n");
+            writer.write ("\t\t}\n");
+            writer.write ("\t\tm_pCall->unInitialize();\n");
+            writer.write ("\t\treturn pReturn;\n");
         }
     
         writer.write ("\t}\n");



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