axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r517431 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp: ClientStubWriter.java literal/ClientStubWriter.java
Date Mon, 12 Mar 2007 22:29:27 GMT
Author: nadiramra
Date: Mon Mar 12 15:29:26 2007
New Revision: 517431

URL: http://svn.apache.org/viewvc?view=rev&rev=517431
Log:
AXISCPP-1028 - More efficient use of memory resources.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
URL: http://svn.apache.org/viewvc/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java?view=diff&rev=517431&r1=517430&r2=517431
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ClientStubWriter.java
Mon Mar 12 15:29:26 2007
@@ -367,12 +367,20 @@
         writer.write("\t\tm_pCall->setOperation( \"" 
                 + minfo.getMethodname() + "\", \"" 
                 + namespaceURI + "\");\n"); 
+
+        
+        //=============================================================================
+        // Apply user specified properties
+        //============================================================================= 
      
         
-        //new calls from stub base
         writer.write("\n");
         writer.write ("\t\tincludeSecure();\n");
         writer.write ("\t\tapplyUserPreferences();\n");
         writer.write("\n");        
+
+        //=============================================================================
+        // Process elements
+        //============================================================================= 
      
         
         for (int i = 0; i < paramsB.size(); i++)
         {
@@ -448,6 +456,11 @@
 
             writer.write(");\n");
         }
+        
+        //=============================================================================
+        // Invoke web service - two-way message processing
+        //============================================================================= 
      
+        
         writer.write("\n\t\tif( AXIS_SUCCESS == m_pCall->sendAndReceive())\n\t\t{\n");
         writer.write("\t\t\tif( AXIS_SUCCESS == m_pCall->checkMessage( \""
                 + minfo.getOutputMessage().getLocalPart() + "\",\""
@@ -458,7 +471,11 @@
         
         if( returntype != null)
             paramTagName = returntype.getParamNameAsSOAPString();
-
+  
+        //=============================================================================
+        // Process output parameters
+        //============================================================================= 
      
+        
         if (isAllTreatedAsOutParams)
         {
             String currentParamName;
@@ -645,27 +662,27 @@
         }
         else if (returntypeissimple)
         {
-            writer.write("\t\t\t\t" + outparamType);
-            if (!CUtils.isPointerType(outparamType))
-                writer.write(" *");
-            
-            writer.write(" pReturn = m_pCall->"
-                    + CUtils.getParameterGetValueMethodName(outparamType,
-                            false) + "( \"" + paramTagName + "\", 0);\n\n");
-            writer.write("\t\t\t\tif( pReturn)\n");
-            writer.write("\t\t\t\t{\n");
-            if (CUtils.isPointerType(outparamType))
+            if (returntype.isNillable () || CUtils.isPointerType(outparamType))
             {
-                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\tRet = m_pCall->" 
+                        + CUtils.getParameterGetValueMethodName( outparamType, false) 
+                        + "(\"" + returntype.getParamNameAsSOAPString() + "\", 0);\n");
             }
-            else if (returntype.isOptional() || returntype.isNillable())
-                writer.write("\t\t\t\t\tRet = new " + outparamType + "( *pReturn);\n");
             else
-                writer.write("\t\t\t\t\tRet = *pReturn;\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\t" + outparamType + " * pReturn = m_pCall->" +
+                          CUtils.getParameterGetValueMethodName(outparamType, false) + "(\""
+
+                          returntype.getElementNameAsSOAPString() + "\", 0);\n");
+                writer.write ("\t\t\t\tif(pReturn)\n");
+                writer.write ("\t\t\t\t{\n");
+                writer.write ("\t\t\t\t\tRet = *pReturn;\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\t}\n");
             writer.write("\t\t}\n\n");
             writer.write("\t\tm_pCall->unInitialize();\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=517431&r1=517430&r2=517431
==============================================================================
--- 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
Mon Mar 12 15:29:26 2007
@@ -356,8 +356,11 @@
                     + minfo.getInputMessage().getLocalPart() + "\", \"" 
                     + minfo.getInputMessage().getNamespaceURI() + "\");\n");
         }
-        
+
+        //=============================================================================
         // Add attributes to soap method
+        //============================================================================= 
      
+                   
         boolean commentIssued=false;
         for (int i = 0; i < paramsB.size (); i++)
         {
@@ -394,12 +397,18 @@
             }
         } // end for-loop
     
-        //new calls from stub base
+        //=============================================================================
+        // Apply user specified properties
+        //============================================================================= 
      
+        
         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++)
@@ -563,6 +572,9 @@
                 writer.write("\t\t}\n");
         } // end for-loop
         
+        //=============================================================================
+        // Invoke web service - one-way or two-way message processing
+        //============================================================================= 
      
 
         if (minfo.getOutputMessage () != null)
         {
@@ -578,6 +590,10 @@
             writer.write ("\t\tif (AXIS_SUCCESS == m_pCall->send())\n\t\t{\n");
         }
         
+        //=============================================================================
+        // Process output parameters
+        //============================================================================= 
      
+
         if (isAllTreatedAsOutParams)
         {
             String currentParamName;
@@ -763,7 +779,7 @@
             } // end for-loop for paramsC
             
             writer.write ("\t\t\t}\n");
-            writer.write ("\t\t}\n");
+            writer.write ("\t\t}\n\n");
             writer.write ("\t\tm_pCall->unInitialize();\n");
         }
         else if (returntype == null)
@@ -771,7 +787,7 @@
             if (minfo.getOutputMessage () != null)
                 writer.write ("\t\t\t\t/*not successful*/\n\t\t\t}\n");
 
-            writer.write ("\t\t}\n");
+            writer.write ("\t\t}\n\n");
             writer.write ("\t\tm_pCall->unInitialize();\n");
         }
         else if (returntypeisarray)
@@ -803,91 +819,42 @@
             }
             
             writer.write ("\t\t\t}\n");
-            writer.write ("\t\t}\n");
+            writer.write ("\t\t}\n\n");
             writer.write ("\t\tm_pCall->unInitialize();\n");
             writer.write ("\t\treturn RetArray;\n");
         }
         else if (returntypeissimple)
         {
-            if (returntype.isNillable ())
+            if (returntype.isNillable () || CUtils.isPointerType(outparamType))
             {
-                if( CUtils.isPointerType( outparamType))
-                {
-                    writer.write( "\t\t\t\t" + outparamType + " pReturn = m_pCall->" 
-                            + CUtils.getParameterGetValueMethodName( outparamType, false)

-                            + "(\"" + returntype.getParamNameAsSOAPString() + "\", 0);\n");
-                }
-                else
-                {
-                    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\t\tif( pReturn != NULL)\n");
-                writer.write( "\t\t\t\t{\n");
-                if( CUtils.isPointerType(outparamType))
-                {
-                    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\t\tRet = new " + outparamType + "();\n");
-                    writer.write( "\t\t\t\t\t*Ret = *pReturn;\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\t\tRet = m_pCall->" 
+                        + CUtils.getParameterGetValueMethodName( outparamType, false) 
+                        + "(\"" + returntype.getParamNameAsSOAPString() + "\", 0);\n");
             }
             else
             {
-                if (CUtils.isPointerType(outparamType))
-                {
-                    writer.write ("\t\t\t\t" + outparamType +
-                              " pReturn = m_pCall->" +
-                              CUtils.getParameterGetValueMethodName(outparamType,false) +
"(\"" +
-                              returntype.getParamNameAsSOAPString () + "\", 0);\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\t" + outparamType + " * pReturn = m_pCall->"
+
-                              CUtils.getParameterGetValueMethodName(outparamType, false)
+ "(\"" +
-                              returntype.getElementNameAsSOAPString() + "\", 0);\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\t\tRet = *pReturn;\n");
-                    else
-                        writer.write ("\t\t\t\t\tRet = *pReturn;\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\t" + outparamType + " * pReturn = m_pCall->" +
+                          CUtils.getParameterGetValueMethodName(outparamType, false) + "(\""
+
+                          returntype.getElementNameAsSOAPString() + "\", 0);\n");
+                writer.write ("\t\t\t\tif(pReturn)\n");
+                writer.write ("\t\t\t\t{\n");
+                writer.write ("\t\t\t\t\tRet = *pReturn;\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\t}\n");
-
             }
-            writer.write ("\t\t}\n");
+            writer.write ("\t\t\t}\n");
+            writer.write ("\t\t}\n\n");
             writer.write ("\t\tm_pCall->unInitialize();\n");
             writer.write ("\t\treturn Ret;\n");
         }
         else if (returntype.isAnyType ())
         {
             writer.write ("\t\t\t\tpReturn = (" + outparamType + "*)m_pCall->getAnyObject();\n\t\t}\n");
-            writer.write ("\t\t}\n");
+            writer.write ("\t\t}\n\n");
             writer.write ("\t\tm_pCall->unInitialize();\n");
             writer.write ("\t\treturn pReturn;\n");
         }
@@ -911,7 +878,7 @@
                           returntype.getElementNameAsSOAPString () + "\", 0);\n\t\t\t}\n");
             }
 
-            writer.write ("\t\t}\n");
+            writer.write ("\t\t}\n\n");
             writer.write ("\t\tm_pCall->unInitialize();\n");
             writer.write ("\t\treturn pReturn;\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