axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r394813 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c: ArrayParamWriter.java BeanParamWriter.java ClientStubWriter.java
Date Tue, 18 Apr 2006 00:01:22 GMT
Author: nadiramra
Date: Mon Apr 17 17:01:21 2006
New Revision: 394813

URL: http://svn.apache.org/viewcvs?rev=394813&view=rev
Log:
C support fixes/enhancements.

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

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java?rev=394813&r1=394812&r2=394813&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ArrayParamWriter.java
Mon Apr 17 17:01:21 2006
@@ -65,6 +65,8 @@
 
             // include system header files
             writer.write("#include <stdlib.h>\n");
+            writer.write("#include <stdio.h>\n");
+            writer.write("#include <string.h>\n");
             writer.write("\n");
             
             // include header file for datatype
@@ -130,12 +132,13 @@
             writer.write("{\n");
             
             // Begin function body
-            
-            writer.write("\t" + classname + " *pArray = (" + classname + "*)malloc(sizeof("
+ classname + "));\n");
-            writer.write("\tmemset(pArray, 0, sizeof(" + classname + "));\n");
+
+            writer.write("\t/* Create array data type */\n");
+            writer.write("\t" + classname + " *pArray = (" + classname + "*)axiscAxisNew(XSDC_ARRAY,
0);\n");
             writer.write("\tpArray->m_Type = C_USER_TYPE;\n");
             writer.write("\n");
 
+            writer.write("\t/* Create actual array of requested size */\n");
             writer.write("\tif (nSize > 0)\n");
             writer.write("\t{\n");
             writer.write("\t\tpArray->m_Array = Axis_Create_" + attribs[0].getTypeName()

@@ -163,16 +166,28 @@
                     + "(" + classname + "* param)\n");
             writer.write("{\n");
             
-            writer.write("\tif (param == NULL)\n");
+            // Begin function body
+            
+            writer.write("\t/* If null, simply return */\n");
+            writer.write("\tif (!param)\n");
             writer.write("\t\treturn;\n");
             writer.write("\n");
-            writer.write("\tif (param->m_Array != NULL)\n");
+            
+            writer.write("\t/* Reclaim array memory resources, if it exists */\n");
+            writer.write("\tif (param->m_Array)\n");
             writer.write("\t{\n");
             writer.write("\t\tAxis_Delete_" +  attribs[0].getTypeName() 
                     + "((" + attribs[0].getTypeName() + " *)param->m_Array, 1, param->m_Size);\n");
-            writer.write("\t\tfree(param->m_Array);\n");
+            writer.write("\t\tparam->m_Array = (" + attribs[0].getTypeName() + " **)NULL;\n");
+            writer.write("\t\taxiscAxisDelete(param, XSDC_ARRAY);\n");
             writer.write("\t}\n");
+            writer.write("\n");
+            
+            writer.write("\t/* Reclaim array data type memory resources */\n");
             writer.write("\tfree(param);\n");
+            
+            // End function body            
+            
             writer.write("}\n");
             writer.write("\n");            
         }

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/BeanParamWriter.java?rev=394813&r1=394812&r2=394813&view=diff
==============================================================================
--- 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
Mon Apr 17 17:01:21 2006
@@ -142,7 +142,7 @@
         writer.write("\t\t\t\tAxis_URI_" + classname + ", \"\\\"\", NULL );\n");
         writer.write("\t\t}\n");
         writer.write("\t}\n");
-
+        writer.write("\n");
         
         writer.write("\t/* If there are any attributes serialize them. If there aren't then
close the tag */\n");
         for (int i = 0; i < attributeParamCount; i++)
@@ -317,7 +317,7 @@
                 
                 if (CUtils.isPointerType(baseTypeName))
                 {
-                    writer.write("\t\taxiscSerializeAsElement(pSZ, \""
+                    writer.write("\taxiscSerializeAsElement(pSZ, \""
                             + attribs[i].getSOAPElementNameAsString()
                             + "\", " + namespace
                             + ", (void*)(param->" + attribs[i].getParamNameWithoutSymbols()
+ "), "
@@ -466,7 +466,7 @@
             if (attribs[i].isAnyType())
             {
                 anyCounter +=1;
-                writer.write("\tparam->any" + anyCounter + " = axiscGetAnyObject(pDZ);\n");
+                writer.write("\tparam->any" + anyCounter + " = axiscGetAnyObjectIWrapperSoapDeSerializer(pDZ);\n");
             }
             else if (attribs[i].isArray())
             {
@@ -480,6 +480,7 @@
                     else
                         baseTypeName = attribs[i].getTypeName();
 
+                    // TODO  - need to create a deletearray function that accepts a delete
function
                     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");
@@ -500,7 +501,7 @@
                 else
                 {
                     arrayType = attribs[i].getTypeName();
-                    writer.write("\taxiscGetCmplxArrayCall(pDZ,\n" 
+                    writer.write("\taxiscGetCmplxArrayIWrapperSoapDeSerializer(pDZ,\n" 
                             + "\t\t(Axisc_Array *)param->" + attribs[i].getParamName()
+ ",\n" 
                             + "\t\t(void*)Axis_DeSerialize_"  + arrayType + ",\n"
                             + "\t\t(void*)Axis_Create_"       + arrayType + ",\n"
@@ -513,9 +514,7 @@
                 }
             }
             else if ((attribs[i].isSimpleType() || attribs[i].getType().isSimpleType()))
-            {
-                writer.write("\n\t{\n"); // start new variable scope
-                
+            {                
                 String soapTagName = (attribs[i].isAttribute() ? attribs[i].getParamName()
: attribs[i].getElementNameAsString());
                 if (soapTagName.lastIndexOf("_Ref") > -1)
                     soapTagName = soapTagName.substring(0, soapTagName.lastIndexOf("_Ref"));
@@ -525,6 +524,7 @@
                 
                 if (attribs[i].isOptional())
                 {
+                    writer.write("\n\t{\n"); // start new variable scope                
   
                     writer.write("\tconst char* elementName" + i + " = axiscPeekNextElementName(pDZ);\n");
                     writer.write("\t\tif(strcmp(elementName" + i + ", \"" + soapTagName +
"\") == 0)\n");
                     writer.write("\t\t{\n");
@@ -568,25 +568,31 @@
 
                         String elementName = attribs[i].getParamNameAsMember();
 
-                        writer.write("\t{\n");
+                        writer.write("\t{\n");  // start new scope
                         if( isPointerType)
                         {
                             writer.write("\t" + typeName + "    pValue" + i + " = " +
                                     CUtils.getParameterGetValueMethodName(baseTypeName, attribs[i].isAttribute())
+
-                                    "(pDZ,\"" + soapTagName + "\", 0);\n\n");
+                                    "(pDZ,\"" + soapTagName + "\", 0);\n");
                         }
                         else
                         {
                             writer.write("\t" + typeName + " *  pValue" + i + " = " +
                                     CUtils.getParameterGetValueMethodName(baseTypeName, attribs[i].isAttribute())
+
-                                    "(pDZ, \"" + soapTagName + "\", 0);\n\n");
+                                    "(pDZ, \"" + soapTagName + "\", 0);\n");
                         }
                         
                         writer.write( "\tparam->" + elementName + "= pValue" + i + ";\n");
-                        writer.write( "\tif( pValue" + i + " != NULL)\n");
-                        writer.write("\t\taxiscAxisDelete( (void *) pValue" + i + ", " 
-                                + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n\n");
-                        writer.write("\t}\n\n");
+                        
+                        // TODO - need to delete only if hex, or base 64, or any. and just
the struct,
+                        // not contents.
+                        if (!isPointerType)
+                        {
+                            writer.write( "\tif( pValue" + i + " != NULL)\n");
+                            writer.write("\t\taxiscAxisDelete( (void *) pValue" + i + ",
" 
+                                + CUtils.getXSDTypeForBasicType( baseTypeName) + ");\n");
+                        }
+                        writer.write("\t}\n\n"); // end new scope
                     }
                 } 
                 else if (attribs[i].getChoiceElement() || attribs[i].getAllElement())
@@ -620,12 +626,10 @@
                 {
                     writer.write("\t\t\t}\n");
                     writer.write("\t\telse\n");
-                    writer.write("\t\t{\n");
                     writer.write("\t\t\tparam->" + attribs[i].getParamNameAsMember() +
" = NULL;\n");
-                    writer.write("\t\t}\n\n");
+                    writer.write("\n");
+                    writer.write("\n\t}\n"); // end new variable scope
                 }
-                
-                writer.write("\n\t}\n"); // end new variable scope
             }
             else
             {
@@ -650,7 +654,7 @@
 
                 writer.write("\tparam->" + attribs[i].getParamNameAsMember() 
                         + " = ("  + attribs[i].getTypeName()
-                        + "*)axiscGetCmplxObject(pDZ,(void*)Axis_DeSerialize_"
+                        + "*)axiscGetCmplxObjectIWrapperSoapDeSerializer(pDZ,(void*)Axis_DeSerialize_"
                         + attribs[i].getTypeName()
                         + "\n\t\t, (void*)Axis_Create_"
                         + attribs[i].getTypeName() + ", (void*)Axis_Delete_"
@@ -676,6 +680,7 @@
                 if (attribs[i].getMinOccurs() == 0)
                     writer.write("\t}\n");
             
+            writer.write("\n");
         }
         
         if (extensionBaseAttrib != null
@@ -706,13 +711,13 @@
         writer.write("\t" + classname + "* pTemp;\n");
         writer.write("\tif (bArray && (nSize > 0))\n\t{\n");
         writer.write("\t\tif (pObj)\n\t\t{\n");
-        writer.write("\t\t\tpObj = (void *)  realloc(pObj, sizeof(" + classname + ")*nSize);\n");
+        writer.write("\t\t\tpObj = (void *)  realloc(pObj, sizeof(" + classname + " *)*nSize);\n");
         writer.write("\t\t\tpTemp = pObj;\n");
         writer.write("\t\t\tpTemp += nSize/2;\n");
-        writer.write("\t\t\tmemset(pTemp, 0, sizeof(" + classname + ")*nSize/2);\n");
+        writer.write("\t\t\tmemset(pTemp, 0, sizeof(" + classname + " *)*nSize/2);\n");
         writer.write("\t\t}\n\t\telse\n\t\t{\n");
-        writer.write("\t\t\tpObj = (void *)  malloc(sizeof(" + classname + ")*nSize);\n");
-        writer.write("\t\t\tmemset(pObj, 0, sizeof(" + classname + ")*nSize);\n\t\t}\n");
+        writer.write("\t\t\tpObj = (void *)  malloc(sizeof(" + classname + " *)*nSize);\n");
+        writer.write("\t\t\tmemset(pObj, 0, sizeof(" + classname + " *)*nSize);\n\t\t}\n");
         writer.write("\t}\n\telse\n\t{\n");
         writer.write("\t\tpObj = (void *)  malloc(sizeof(" + classname + "));\n");
         writer.write("\t\tmemset(pObj, 0, sizeof(" + classname + "));\n\n");
@@ -764,39 +769,37 @@
         {
             if (attribs[i].isSimpleType() || attribs[i].getType().isSimpleType())
             {
-                String passedInBaseType;
-                String baseTypeName = null;
-                
-                if (!attribs[i].isSimpleType() && attribs[i].getType().isSimpleType())
-                    baseTypeName = CUtils.getclass4qname(attribs[i].getType().getBaseType());
-                else
-                    baseTypeName = attribs[i].getTypeName();
-                
-                if (attribs[i].isArray())
-                    passedInBaseType = "XSDC_ARRAY";
-                else
-                    passedInBaseType = CUtils.getXSDTypeForBasicType(baseTypeName);
-                                
-                writer.write("\t\tif (param->" + attribs[i].getParamNameAsMember() + "
!= NULL)\n");
-                writer.write("\t\t\taxiscAxisDelete(param->" + attribs[i].getParamNameAsMember()

-                        + "," + passedInBaseType + ");\n");
-                writer.write("\n");
+                if (CUtils.isPointerType(attribs[i].getTypeName()))
+                {
+                    String passedInBaseType;
+                    String baseTypeName = null;
+                    
+                    if (!attribs[i].isSimpleType() && attribs[i].getType().isSimpleType())
+                        baseTypeName = CUtils.getclass4qname(attribs[i].getType().getBaseType());
+                    else
+                        baseTypeName = attribs[i].getTypeName();
+                    
+                    if (attribs[i].isArray())
+                        passedInBaseType = "XSDC_ARRAY";
+                    else
+                        passedInBaseType = CUtils.getXSDTypeForBasicType(baseTypeName);
+                                    
+                    writer.write("\t\tif (param->" + attribs[i].getParamNameAsMember()
+ " != NULL)\n");
+                    writer.write("\t\t\taxiscAxisDelete(param->" + attribs[i].getParamNameAsMember()

+                            + "," + passedInBaseType + ");\n");
+                    writer.write("\n");
+                }
             }
             else
             {
-                String isArray = "0";
-                String arraySize = "0";    
-                
+
+                String deleteFunctionSuffix = "";
                 if (attribs[i].isArray())
-                {
-                    isArray = "1";
-                    arraySize = "param->" + attribs[i].getParamName() + "->m_Size";
-                }
+                    deleteFunctionSuffix = "_Array";
                 
-                writer.write("\t\tif (param->" + attribs[i].getParamName());
-                writer.write("\t\t\tAxis_Delete_" + attribs[i].getTypeName()
-                              + "(param->" + attribs[i].getParamName()
-                              + isArray + "," + arraySize + ");\n");
+                writer.write("\t\tif (param->" + attribs[i].getParamName() + ")\n");
+                writer.write("\t\t\tAxis_Delete_" + attribs[i].getTypeName() + deleteFunctionSuffix

+                            + "(param->" + attribs[i].getParamName() + ");\n");      
            
             }
         }
         

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubWriter.java?rev=394813&r1=394812&r2=394813&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/ClientStubWriter.java
Mon Apr 17 17:01:21 2006
@@ -48,9 +48,7 @@
      */
     public ClientStubWriter(WebServiceContext wscontext) throws WrapperFault
     {
-        super(
-            WrapperUtils.getClassNameFromFullyQualifiedName(
-                wscontext.getSerInfo().getQualifiedServiceName()));
+        super(WrapperUtils.getClassNameFromFullyQualifiedName(wscontext.getSerInfo().getQualifiedServiceName()));
         this.wscontext = wscontext;
         this.methods = wscontext.getSerInfo().getMethods();
     }
@@ -63,11 +61,8 @@
         try
         {
             writer.write("/*\n");
-            writer.write(
-                " * This file was auto-generated by the Axis C++ Web Service "
-                    + "Generator (WSDL2Ws)\n");
-            writer.write(
-                " * This file contains Client Stub implementation for remote web service.\n");
+            writer.write(" * This file was auto-generated by the Axis C++ Web Service Generator
(WSDL2Ws)\n");
+            writer.write(" * This file contains Client Stub implementation for remote web
service.\n");
             writer.write(" */\n\n");
         }
         catch (IOException e)
@@ -83,21 +78,15 @@
     {
         try
         {
-            writer.write(
-                "void* get_"
-                    + classname
-                    + "_stub(const char* pchEndPointUri)\n{");
+            writer.write("void* get_" + classname + "_stub(const char* pchEndPointUri)\n{");
             writer.write("\tif(pchEndPointUri)\n");
             writer.write("\t{\n");
-            writer.write(
-                "\t\treturn getStubObject(APTHTTP1_1, pchEndPointUri);\n");
+            writer.write("\t\treturn getStubObject(APTHTTP1_1, pchEndPointUri);\n");
             writer.write("\t}\n");
             writer.write("\telse\n");
             writer.write("\t{\n");
-            writer.write(
-                "\t\treturn getStubObject(APTHTTP1_1, \""
-                    + wscontext.getWrapInfo().getTargetEndpointURI()
-                    + "\");\n");
+            writer.write("\t\treturn getStubObject(APTHTTP1_1, \""
+                    + wscontext.getWrapInfo().getTargetEndpointURI() + "\");\n");
             writer.write("\t}\n");
             writer.write("}\n");
             writer.write("void destroy_" + classname + "_stub(void* p){\n");
@@ -105,12 +94,10 @@
 
             writer.write("int get_" + classname + "_Status(void* pStub){\n");
             writer.write("\tCall* pCall = (Call*)pStub;\n");
-            writer.write(
-                "\tif ( pStub == NULL ) return AXIS_SUCCESS; else return pCall->_functions->getStatus(pCall->_object);\n");
+            writer.write("\tif ( pStub == NULL ) return AXIS_SUCCESS; else return pCall->_functions->getStatus(pCall->_object);\n");
             writer.write("\t}\n");
 
-            writer.write(
-                "\n/*Methods corresponding to the web service methods*/\n");
+            writer.write("\n/*Methods corresponding to the web service methods*/\n");
             MethodInfo minfo;
             for (int i = 0; i < methods.size(); i++)
             {
@@ -133,8 +120,13 @@
     {
         try
         {
-            writer.write(
-                "#include \"" + classname + CUtils.C_HEADER_SUFFIX + "\"\n\n");
+            writer.write("#include <stdlib.h>\n");
+            writer.write("#include <stdio.h>\n");
+            writer.write("#include <string.h>\n");
+            writer.write("\n");
+            
+            writer.write("#include \"" + classname + CUtils.C_HEADER_SUFFIX + "\"\n");
+            writer.write("\n");
         }
         catch (IOException e)
         {
@@ -150,29 +142,18 @@
      * @throws IOException
      */
 
-    public void writeMethodInWrapper(MethodInfo minfo)
-        throws WrapperFault, IOException
+    public void writeMethodInWrapper(MethodInfo minfo)  throws WrapperFault, IOException
     {
         boolean isAllTreatedAsOutParams = false;
         ParameterInfo returntype = null;
         int noOfOutParams = minfo.getOutputParameterTypes().size();
         if (0 == noOfOutParams)
-        {
             returntype = null;
-        }
+        else if (1 == noOfOutParams)
+            returntype = (ParameterInfo) minfo.getOutputParameterTypes().iterator().next();
         else
-            if (1 == noOfOutParams)
-            {
-                returntype =
-                    (ParameterInfo) minfo
-                        .getOutputParameterTypes()
-                        .iterator()
-                        .next();
-            }
-            else
-            {
-                isAllTreatedAsOutParams = true;
-            }
+            isAllTreatedAsOutParams = true;
+        
         Collection params = minfo.getInputParameterTypes();
         String methodName = minfo.getMethodname();
         Type retType = null;
@@ -381,7 +362,7 @@
             else
                 if (typeissimple)
                 {
-                    //for simple types	
+                    //for simple types    
                     writer.write(
                         "\tpCall->_functions->addParameter(pCall->_object, ");
                     writer.write(



Mime
View raw message