axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nadira...@apache.org
Subject svn commit: r386503 - in /webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal: ParmHeaderFileWriter.java WrapWriter.java
Date Fri, 17 Mar 2006 01:39:26 GMT
Author: nadiramra
Date: Thu Mar 16 17:39:22 2006
New Revision: 386503

URL: http://svn.apache.org/viewcvs?rev=386503&view=rev
Log:
Format code so more readable - align braces, etc.

Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/WrapWriter.java

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java?rev=386503&r1=386502&r2=386503&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/ParmHeaderFileWriter.java Thu Mar 16 17:39:22 2006
@@ -47,8 +47,7 @@
      * @param type
      * @throws WrapperFault
      */
-    public ParmHeaderFileWriter(WebServiceContext wscontext, Type type)
-        throws WrapperFault
+    public ParmHeaderFileWriter(WebServiceContext wscontext, Type type) throws WrapperFault
     {
         super(wscontext, type);
     }
@@ -60,20 +59,15 @@
     {
         try
         {
-            this.writer =
-                new BufferedWriter(new FileWriter(getFilePath(), false));
+            this.writer = new BufferedWriter(new FileWriter(getFilePath(), false));
             writeClassComment();
+            
             // if this headerfile not defined define it 
-            this.writer.write(
-                "#if !defined(__"
-                    + classname.toUpperCase()
-                    + "_H__INCLUDED_)\n");
-            this.writer.write(
-                "#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
+            this.writer.write("#if !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)\n");
+            this.writer.write("#define __" + classname.toUpperCase() + "_H__INCLUDED_\n\n");
+            
             if (type.isSimpleType())
-            {
                 writeSimpleTypeWithEnumerations();
-            }
             else
             {
                 writePreprocessorStatements();
@@ -81,15 +75,12 @@
                 writeAttributes();
                 this.writer.write("} " + classname + ";\n\n");
             }
-            this.writer.write(
-                "#endif /* !defined(__"
-                    + classname.toUpperCase()
-                    + "_H__INCLUDED_)*/\n");
+            
+            this.writer.write("#endif /* !defined(__" + classname.toUpperCase() + "_H__INCLUDED_)*/\n");
             writer.flush();
             writer.close();
             if (WSDL2Ws.verbose)
-                System.out.println(
-                    getFilePath().getAbsolutePath() + " created.....");
+                System.out.println(getFilePath().getAbsolutePath() + " created.....");
         }
         catch (IOException e)
         {
@@ -108,10 +99,12 @@
             Vector restrictionData = type.getEnumerationdata();
             if (restrictionData == null)
                 return;
+            
             TypeEntry baseEType = (TypeEntry) restrictionData.firstElement();
             QName baseType = baseEType.getQName();
             if (!CUtils.isSimpleType(baseType))
                 return;
+            
             String langTypeName = CUtils.getclass4qname(baseType);
             writer.write("typedef ");
             if ("string".equals(baseType.getLocalPart()))
@@ -123,131 +116,98 @@
                     if ("enumeration".equals(value.getLocalPart()))
                     {
                         writer.write(
-                            "static const "
-                                + classname
-                                + " "
-                                + classname
-                                + "_"
-                                + value.getNamespaceURI()
-                                + " = \""
-                                + value.getNamespaceURI()
-                                + "\";\n");
+                            "static const " + classname + " "
+                                + classname + "_"
+                                + value.getNamespaceURI() + " = \""
+                                + value.getNamespaceURI() + "\";\n");
+                    }
+                    else if ("maxLength".equals(value.getLocalPart()))
+                    {
+                        writer.write(
+                            "static const " + classname + "_MaxLength = " 
+                            + value.getNamespaceURI() + ";\n");
+                    }
+                    else if ("minLength".equals(value.getLocalPart()))
+                    {
+                        writer.write(
+                            "static const " + classname + "_MinLength = " 
+                            + value.getNamespaceURI() + ";\n");
                     }
-                    else
-                        if ("maxLength".equals(value.getLocalPart()))
-                        {
-                            writer.write(
-                                "static const "
-                                    + classname
-                                    + "_MaxLength = "
-                                    + value.getNamespaceURI()
-                                    + ";\n");
-                        }
-                        else
-                            if ("minLength".equals(value.getLocalPart()))
-                            {
-                                writer.write(
-                                    "static const "
-                                        + classname
-                                        + "_MinLength = "
-                                        + value.getNamespaceURI()
-                                        + ";\n");
-                            }
                 }
             }
-            else
-                if ("int".equals(baseType.getLocalPart()))
-                {
-                    if (restrictionData.size() > 1)
-                    { //there are enumerations or [min|max]Inclusive
-                        boolean isEnum = false;
-                        boolean hasRestrictionItems = false;
-                        for (int i = 1; i < restrictionData.size(); i++)
+            else if ("int".equals(baseType.getLocalPart()))
+            {
+                if (restrictionData.size() > 1)
+                { 
+                    //there are enumerations or [min|max]Inclusive
+                    boolean isEnum = false;
+                    boolean hasRestrictionItems = false;
+                    
+                    for (int i = 1; i < restrictionData.size(); i++)
+                    {
+                        QName value = (QName) restrictionData.elementAt(i);
+                        if ("enumeration".equals(value.getLocalPart()))
                         {
-                            QName value = (QName) restrictionData.elementAt(i);
-                            if ("enumeration".equals(value.getLocalPart()))
-                            {
-                                isEnum = true;
-                                if (i > 1)
-                                    writer.write(", ");
-                                else
-                                    writer.write(" enum { ");
-                                writer.write(
-                                    "ENUM"
-                                        + classname.toUpperCase()
-                                        + "_"
-                                        + value.getNamespaceURI()
-                                        + "="
-                                        + value.getNamespaceURI());
-                            }
+                            isEnum = true;
+                            
+                            if (i > 1)
+                                writer.write(", ");
                             else
-                                if ("minInclusive"
-                                    .equals(value.getLocalPart()))
-                                {
-                                    hasRestrictionItems = true;
-                                    if (i <= 1)
-                                        writer.write(
-                                            langTypeName
-                                                + " "
-                                                + classname
-                                                + ";\n");
-                                    writer.write(
-                                        "static const int "
-                                            + classname
-                                            + "_MinInclusive = "
-                                            + value.getNamespaceURI()
-                                            + ";\n");
-                                }
-                                else
-                                    if ("maxInclusive"
-                                        .equals(value.getLocalPart()))
-                                    {
-                                        hasRestrictionItems = true;
-                                        if (i <= 1)
-                                            writer.write(
-                                                langTypeName
-                                                    + " "
-                                                    + classname
-                                                    + ";\n");
-                                        writer.write(
-                                            "static const int "
-                                                + classname
-                                                + "_MaxInclusive = "
-                                                + value.getNamespaceURI()
-                                                + ";\n");
-                                    }
+                                writer.write(" enum { ");
+                            
+                            writer.write(
+                                "ENUM"
+                                    + classname.toUpperCase() + "_" + value.getNamespaceURI()
+                                    + "=" + value.getNamespaceURI());
+                        }
+                        else if ("minInclusive".equals(value.getLocalPart()))
+                        {
+                            hasRestrictionItems = true;
+                            
+                            if (i <= 1)
+                                writer.write(langTypeName + " " + classname + ";\n");
+                            
+                            writer.write(
+                                "static const int "
+                                 + classname + "_MinInclusive = " + value.getNamespaceURI() + ";\n");
+                        }
+                        else if ("maxInclusive".equals(value.getLocalPart()))
+                        {
+                            hasRestrictionItems = true;
+                            
+                            if (i <= 1)
+                                writer.write(langTypeName + " " + classname + ";\n");
+                            
+                            writer.write(
+                                "static const int "
+                                 + classname + "_MaxInclusive = " + value.getNamespaceURI() + ";\n");
                         }
-                        if (isEnum)
-                            writer.write("} " + classname + ";\n");
-                        else
-                            if (!hasRestrictionItems)
-                                writer.write(
-                                    langTypeName + " " + classname + ";\n");
                     }
-                    else
+                    
+                    if (isEnum)
+                        writer.write("} " + classname + ";\n");
+                    else if (!hasRestrictionItems)
                         writer.write(langTypeName + " " + classname + ";\n");
                 }
                 else
-                {
                     writer.write(langTypeName + " " + classname + ";\n");
-                    for (int i = 1; i < restrictionData.size(); i++)
+            }
+            else
+            {
+                writer.write(langTypeName + " " + classname + ";\n");
+                for (int i = 1; i < restrictionData.size(); i++)
+                {
+                    QName value = (QName) restrictionData.elementAt(i);
+                    if ("enumeration".equals(value.getLocalPart()))
                     {
-                        QName value = (QName) restrictionData.elementAt(i);
-                        if ("enumeration".equals(value.getLocalPart()))
-                        {
-                            writer.write(
-                                "static const "
-                                    + classname
-                                    + " "
-                                    + classname
-                                    + "_"
-                                    + value.getNamespaceURI()
-                                    + " = "
-                                    + value.getNamespaceURI()
-                                    + ";\n");
-                        }
+                        writer.write(
+                            "static const "
+                                + classname + " " + classname
+                                + "_" + value.getNamespaceURI()
+                                + " = " + value.getNamespaceURI() + ";\n");
                     }
                 }
+            }
         }
         catch (IOException e)
         {
@@ -264,10 +224,13 @@
         {
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
+            
             writer.write("#include <axis/GDefine.h>\n");
             writer.write("#include <axis/AxisUserAPI.h>\n");
+            
             Vector typeSet = new Vector();
             String typeName = null;
+            
             while (types.hasNext())
             {
                 atype = (Type) types.next();
@@ -287,28 +250,23 @@
                     }
                 }
             }
+            
             Iterator itr = typeSet.iterator();
             while (itr.hasNext())
             {
                 writer.write(
-                    "#include \""
-                        + itr.next().toString()
-                        + CUtils.C_HEADER_SUFFIX
-                        + "\"\n");
+                    "#include \"" + itr.next().toString() + CUtils.C_HEADER_SUFFIX + "\"\n");
             }
+            
             writer.write("/*Local name and the URI for the type*/\n");
             writer.write(
                 "static const char* Axis_URI_"
-                    + classname
-                    + " = \""
-                    + type.getName().getNamespaceURI()
-                    + "\";\n");
+                    + classname + " = \""
+                    + type.getName().getNamespaceURI() + "\";\n");
             writer.write(
                 "static const char* Axis_TypeName_"
-                    + classname
-                    + " = \""
-                    + type.getName().getLocalPart()
-                    + "\";\n\n");
+                    + classname + " = \""
+                    + type.getName().getLocalPart() + "\";\n\n");
 
         }
         catch (IOException e)

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/WrapWriter.java?rev=386503&r1=386502&r2=386503&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/WrapWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/c/literal/WrapWriter.java Thu Mar 16 17:39:22 2006
@@ -57,8 +57,7 @@
     {
         try
         {
-            writer.write(
-                "#include \"" + classname + CUtils.C_HEADER_SUFFIX + "\"\n");
+            writer.write("#include \"" + classname + CUtils.C_HEADER_SUFFIX + "\"\n");
             //As there is no service header file for C the header files for types should be included here itself
             Type atype;
             Iterator types = this.wscontext.getTypemap().getTypes().iterator();
@@ -68,10 +67,7 @@
                 if (atype.getLanguageSpecificName().startsWith(">"))
                     continue;
                 writer.write(
-                    "#include \""
-                        + atype.getLanguageSpecificName()
-                        + CUtils.C_HEADER_SUFFIX
-                        + "\"\n");
+                        "#include \"" + atype.getLanguageSpecificName() + CUtils.C_HEADER_SUFFIX + "\"\n");
             }
             writer.write("\n");
         }
@@ -94,37 +90,29 @@
         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;
+
         String methodName = minfo.getMethodname();
         Collection params = minfo.getInputParameterTypes();
         Type retType = null;
         String outparamType = null;
         boolean returntypeissimple = false;
         boolean returntypeisarray = false;
+        
         if (returntype != null)
         {
-            retType =
-                wscontext.getTypemap().getType(returntype.getSchemaName());
+            retType = wscontext.getTypemap().getType(returntype.getSchemaName());
             if (retType != null)
             {
                 if (retType.isSimpleType())
-                { //schema defined simpleType possibly with restrictions
+                { 
+                    //schema defined simpleType possibly with restrictions
                     returntypeissimple = true;
                     outparamType = CUtils.getclass4qname(retType.getBaseType());
                 }
@@ -141,66 +129,48 @@
                 returntypeissimple = CUtils.isSimpleType(outparamType);
             }
         }
+        
         String paraTypeName;
         ArrayList paramsB = new ArrayList(params);
         Type type;
 
-        writer.write(
-            "\n/*forward declaration for the c method " + methodName + " */\n");
+        writer.write("\n/*forward declaration for the c method " + methodName + " */\n");
         //TODO forward declaration writing logic should be changed when arrays come into picture
         if (returntype == null)
-        {
             writer.write("extern void " + methodName + "(");
-        }
         else
         {
             writer.write(
-                "extern "
-                    + outparamType
+                "extern "  + outparamType
                     + ((returntypeissimple || returntypeisarray) ? " " : "* ")
-                    + methodName
-                    + "(");
+                    + methodName + "(");
         }
 
         for (int i = 0; i < paramsB.size(); i++)
         {
             if (i > 0)
                 writer.write(",");
-            type =
-                this.wscontext.getTypemap().getType(
-                    ((ParameterInfo) paramsB.get(i)).getSchemaName());
+            
+            type = this.wscontext.getTypemap().getType(((ParameterInfo) paramsB.get(i)).getSchemaName());
             paraTypeName = ((ParameterInfo) paramsB.get(i)).getLangName();
-            if ((CUtils.isSimpleType(paraTypeName))
-                || (type != null && type.isSimpleType()))
-            {
-                //for simple types    
+            if ((CUtils.isSimpleType(paraTypeName)) || (type != null && type.isSimpleType()))
+                writer.write(paraTypeName);
+            else if (type != null && type.isArray())
                 writer.write(paraTypeName);
-            }
             else
-                if (type != null && type.isArray())
-                {
-                    writer.write(paraTypeName);
-                }
-                else
-                {
-                    writer.write(paraTypeName + "*");
-                }
+                writer.write(paraTypeName + "*");
         }
+        
         if (isAllTreatedAsOutParams)
         {
             ArrayList paramsC = (ArrayList) minfo.getOutputParameterTypes();
             for (int i = 0; i < paramsC.size(); i++)
             {
-                type =
-                    wscontext.getTypemap().getType(
-                        ((ParameterInfo) paramsC.get(i)).getSchemaName());
+                type = wscontext.getTypemap().getType(((ParameterInfo) paramsC.get(i)).getSchemaName());
                 writer.write(
                     ", AXIS_OUT_PARAM "
-                        + WrapperUtils
-                            .getClassNameFromParamInfoConsideringArrays(
-                            (ParameterInfo) paramsC.get(i),
-                            wscontext)
-                        + "*");
+                    + WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo) paramsC.get(i),wscontext)
+                    + "*");
             }
         }
         writer.write(");\n");
@@ -209,10 +179,8 @@
         writer.write(" */\n");
         //method signature
         writer.write(
-            "int "
-                + methodName
-                + CUtils.WRAPPER_METHOD_APPENDER
-                + "(IWrapperSoapDeSerializer DZ, IWrapperSoapSerializer SZ)\n{\n");
+            "int " + methodName + CUtils.WRAPPER_METHOD_APPENDER
+            + "(IWrapperSoapDeSerializer DZ, IWrapperSoapSerializer SZ)\n{\n");
         writer.write("\tint nStatus;\n");
         boolean aretherearrayparams = false;
         String elementName;
@@ -222,57 +190,42 @@
             ParameterInfo param = (ParameterInfo) paramsB.get(i);
             type = this.wscontext.getTypemap().getType(param.getSchemaName());
             paraTypeName = param.getLangName();
-            if ((CUtils.isSimpleType(paraTypeName))
-                || (type != null && type.isSimpleType()))
+            if ((CUtils.isSimpleType(paraTypeName)) || (type != null && type.isSimpleType()))
+                writer.write("\t" + paraTypeName + " v" + i + ";\n");
+            else if (type != null && type.isArray())
             {
-                //for simple types    
+                aretherearrayparams = true;
                 writer.write("\t" + paraTypeName + " v" + i + ";\n");
             }
-            else
-                if (type != null && type.isArray())
-                {
-                    //for arrays
-                    aretherearrayparams = true;
-                    writer.write("\t" + paraTypeName + " v" + i + ";\n");
-                }
-                else
-                {
-                    //for complex types
-                    writer.write("\t" + paraTypeName + "* v" + i + ";\n");
-                }
+            else // for complex types
+                writer.write("\t" + paraTypeName + "* v" + i + ";\n");
         }
+        
         if (returntype != null)
         {
             writer.write(
-                "\t"
-                    + outparamType
+                "\t" + outparamType
                     + ((returntypeisarray || returntypeissimple) ? " " : "* ")
                     + "ret;\n");
         }
+        
         if (aretherearrayparams)
-        {
             writer.write("\tAxis_Array array;\n");
-        }
+        
         // Multiples parameters so fill the methods prototype
         if (isAllTreatedAsOutParams)
         {
             ArrayList paramsC = (ArrayList) minfo.getOutputParameterTypes();
             for (int i = 0; i < paramsC.size(); i++)
             {
-                type =
-                    wscontext.getTypemap().getType(
-                        ((ParameterInfo) paramsC.get(i)).getSchemaName());
+                type = wscontext.getTypemap().getType(((ParameterInfo) paramsC.get(i)).getSchemaName());
                 writer.write(
                     "\t"
-                        + WrapperUtils
-                            .getClassNameFromParamInfoConsideringArrays(
-                            (ParameterInfo) paramsC.get(i),
-                            wscontext)
-                        + " out"
-                        + i
-                        + ";\n");
+                    + WrapperUtils.getClassNameFromParamInfoConsideringArrays((ParameterInfo) paramsC.get(i),wscontext)
+                    + " out" + i + ";\n");
             }
         }
+        
         writer.write(
             "\tif (AXIS_SUCCESS != DZ._functions->checkMessageBody(DZ._object, \""
                 + minfo.getInputMessage().getLocalPart()
@@ -285,126 +238,95 @@
                 + "\", \""
                 + minfo.getOutputMessage().getNamespaceURI()
                 + "\");\n");
+        
         //create and populate variables for each parameter
         for (int i = 0; i < paramsB.size(); i++)
         {
             ParameterInfo param = (ParameterInfo) paramsB.get(i);
             type = this.wscontext.getTypemap().getType(param.getSchemaName());
+            
             if (type != null && type.isSimpleType())
-            { //schema defined simpleType possibly with restrictions
                 paraTypeName = CUtils.getclass4qname(type.getBaseType());
-                ;
-            }
             else
-            {
                 paraTypeName = param.getLangName();
-            }
+
             elementName = param.getElementName().getLocalPart();
             if (type != null && type.isSimpleType())
-            { //schema defined simpleType possibly with restrictions
+            { 
                 writer.write(
                     "\tv"
                         + i
                         + " = DZ._functions->"
-                        + CUtils.getParameterGetValueMethodName(
-                            paraTypeName,
-                            false)
+                        + CUtils.getParameterGetValueMethodName(paraTypeName,false)
                         + "(DZ._object,\""
                         + elementName
                         + "\", 0);\n");
             }
-            else
-                if ((CUtils.isSimpleType(param.getLangName())))
+            else if ((CUtils.isSimpleType(param.getLangName())))
+            {
+                //for simple types    
+                writer.write(
+                    "\tv"
+                        + i
+                        + " = DZ._functions->"
+                        + CUtils.getParameterGetValueMethodName(paraTypeName,false)
+                        + "(DZ._object,\""
+                        + elementName
+                        + "\", 0);\n");
+            }
+            else if (type != null && type.isArray())
+            {
+                QName qname = WrapperUtils.getArrayType(type).getName();
+                String containedType = null;
+                if (CUtils.isSimpleType(qname))
                 {
-                    //for simple types    
+                    containedType = CUtils.getclass4qname(qname);
                     writer.write(
-                        "\tv"
-                            + i
-                            + " = DZ._functions->"
-                            + CUtils.getParameterGetValueMethodName(
-                                paraTypeName,
-                                false)
-                            + "(DZ._object,\""
-                            + elementName
-                            + "\", 0);\n");
+                        "\tarray = DZ._functions->getBasicArray(DZ._object, "
+                            + CUtils.getXSDTypeForBasicType(containedType)
+                            + ", \"" + elementName + "\", 0);\n");
+                    writer.write("\tmemcpy(&v" + i + ", &array, sizeof(Axis_Array));\n");
                 }
                 else
-                    if (type != null && type.isArray())
-                    {
-                        QName qname = WrapperUtils.getArrayType(type).getName();
-                        String containedType = null;
-                        if (CUtils.isSimpleType(qname))
-                        {
-                            containedType = CUtils.getclass4qname(qname);
-                            writer.write(
-                                "\tarray = DZ._functions->getBasicArray(DZ._object, "
-                                    + CUtils.getXSDTypeForBasicType(
-                                        containedType)
-                                    + ", \""
-                                    + elementName
-                                    + "\", 0);\n");
-                            writer.write(
-                                "\tmemcpy(&v"
-                                    + i
-                                    + ", &array, sizeof(Axis_Array));\n");
-                        }
-                        else
-                        {
-                            containedType = qname.getLocalPart();
-                            writer.write(
-                                "\tarray = DZ._functions->getCmplxArray(DZ._object, (void*)Axis_DeSerialize_"
-                                    + containedType
-                                    + "\n\t\t, (void*)Axis_Create_"
-                                    + containedType
-                                    + ", (void*)Axis_Delete_"
-                                    + containedType
-                                    + "\n\t\t, (void*)Axis_GetSize_"
-                                    + containedType
-                                    + ", \""
-                                    + elementName
-                                    + "\", Axis_URI_"
-                                    + containedType
-                                    + ");\n");
-                            writer.write(
-                                "\tmemcpy(&v"
-                                    + i
-                                    + ", &array, sizeof(Axis_Array));\n");
-                        }
-                    }
-                    else
-                        if (param.isAnyType())
-                        {
-                            //for anyType
-                            writer.write(
-                                "\tv"
-                                    + i
-                                    + " = ("
-                                    + paraTypeName
-                                    + "*)DZ._functions->getAnyObject(DZ._object);\n");
-                        }
-                        else
-                        {
-                            //for complex types 
-                            writer.write(
-                                "\tv"
-                                    + i
-                                    + " = ("
-                                    + paraTypeName
-                                    + "*)DZ._functions->getCmplxObject(DZ._object, (void*)Axis_DeSerialize_"
-                                    + paraTypeName
-                                    + "\n\t\t, (void*)Axis_Create_"
-                                    + paraTypeName
-                                    + ", (void*)Axis_Delete_"
-                                    + paraTypeName
-                                    + "\n\t\t,\""
-                                    + elementName
-                                    + "\", Axis_URI_"
-                                    + paraTypeName
-                                    + ");\n");
-                        }
+                {
+                    containedType = qname.getLocalPart();
+                    writer.write(
+                        "\tarray = DZ._functions->getCmplxArray(DZ._object, (void*)Axis_DeSerialize_"
+                            + containedType
+                            + "\n\t\t, (void*)Axis_Create_" + containedType
+                            + ", (void*)Axis_Delete_" + containedType
+                            + "\n\t\t, (void*)Axis_GetSize_" + containedType
+                            + ", \""
+                            + elementName
+                            + "\", Axis_URI_" + containedType
+                            + ");\n");
+                    writer.write("\tmemcpy(&v" + i + ", &array, sizeof(Axis_Array));\n");
+                }
+            }
+            else if (param.isAnyType())
+            {
+                writer.write(
+                    "\tv" + i + " = (" + paraTypeName + "*)DZ._functions->getAnyObject(DZ._object);\n");
+            }
+            else
+            {
+                //for complex types 
+                writer.write(
+                    "\tv"
+                        + i + " = (" + paraTypeName
+                        + "*)DZ._functions->getCmplxObject(DZ._object, (void*)Axis_DeSerialize_" + paraTypeName
+                        + "\n\t\t, (void*)Axis_Create_" + paraTypeName
+                        + ", (void*)Axis_Delete_" + paraTypeName
+                        + "\n\t\t,\""
+                        + elementName
+                        + "\", Axis_URI_" + paraTypeName
+                        + ");\n");
+            }
         }
+        
         writer.write(
             "\tif (AXIS_SUCCESS != (nStatus = DZ._functions->getStatus(DZ._object))) return nStatus;\n");
+        
         if (returntype != null)
         {
             returnParamName = returntype.getElementName().getLocalPart();
@@ -413,9 +335,8 @@
             if (0 < paramsB.size())
             {
                 for (int i = 0; i < paramsB.size() - 1; i++)
-                {
                     writer.write("v" + i + ",");
-                }
+
                 writer.write("v" + (paramsB.size() - 1));
             }
             writer.write(");\n");
@@ -429,212 +350,172 @@
                         + CUtils.getXSDTypeForBasicType(outparamType)
                         + ");\n");
             }
-            else
-                if (returntypeisarray)
+            else if (returntypeisarray)
+            {
+                Type arrayType = WrapperUtils.getArrayType(retType);
+                QName qname = arrayType.getName();
+                String containedType = null;
+                if (CUtils.isSimpleType(qname))
                 {
-                    Type arrayType = WrapperUtils.getArrayType(retType);
-                    QName qname = arrayType.getName();
-                    String containedType = null;
-                    if (CUtils.isSimpleType(qname))
-                    {
-                        containedType = CUtils.getclass4qname(qname);
-                        writer.write(
-                            "\treturn SZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"
-                                + CUtils.getXSDTypeForBasicType(containedType)
-                                + ", \""
-                                + returnParamName
-                                + "\");\n");
-                    }
-                    else
-                        if (arrayType.isSimpleType())
-                        { //SimpleType in the schema 
-                            containedType =
-                                CUtils.getclass4qname(arrayType.getBaseType());
-                            writer.write(
-                                "\treturn SZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"
-                                    + CUtils.getXSDTypeForBasicType(
-                                        containedType)
-                                    + ", \""
-                                    + returnParamName
-                                    + "\");\n");
-                        }
-                        else
-                        {
-                            containedType = qname.getLocalPart();
-                            writer.write(
-                                "\treturn SZ._functions->addOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&ret), (void*) Axis_Serialize_"
-                                    + containedType
-                                    + ", (void*) Axis_Delete_"
-                                    + containedType
-                                    + ", (void*) Axis_GetSize_"
-                                    + containedType
-                                    + ", \""
-                                    + returnParamName
-                                    + "\", Axis_URI_"
-                                    + containedType
-                                    + ");\n");
-                        }
+                    containedType = CUtils.getclass4qname(qname);
+                    writer.write(
+                        "\treturn SZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"
+                            + CUtils.getXSDTypeForBasicType(containedType)
+                            + ", \""
+                            + returnParamName
+                            + "\");\n");
+                }
+                else if (arrayType.isSimpleType())
+                { 
+                    containedType = CUtils.getclass4qname(arrayType.getBaseType());
+                    writer.write(
+                        "\treturn SZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&ret),"
+                            + CUtils.getXSDTypeForBasicType(containedType)
+                            + ", \""
+                            + returnParamName
+                            + "\");\n");
                 }
                 else
-                    if (returntype.isAnyType())
+                {
+                    containedType = qname.getLocalPart();
+                    writer.write(
+                        "\treturn SZ._functions->addOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&ret), (void*) Axis_Serialize_"
+                            + containedType
+                            + ", (void*) Axis_Delete_" + containedType
+                            + ", (void*) Axis_GetSize_" + containedType
+                            + ", \""
+                            + returnParamName
+                            + "\", Axis_URI_" + containedType
+                            + ");\n");
+                }
+            }
+            else if (returntype.isAnyType())
+                writer.write("\treturn SZ._functions->addOutputAnyObject(SZ._object, ret);\n");
+            else
+            {
+                //complex type
+                writer.write(
+                    "\treturn SZ._functions->addOutputCmplxParam(SZ._object, ret, (void*)Axis_Serialize_"
+                        + outparamType
+                        + ", (void*)Axis_Delete_" + outparamType
+                        + ", \""
+                        + returnParamName
+                        + "\", Axis_URI_" + outparamType
+                        + ");\n");
+            }
+        }
+        else if (isAllTreatedAsOutParams)
+        {
+            writer.write("\t" + methodName + "(");
+            if (0 < paramsB.size())
+                for (int i = 0; i < paramsB.size(); i++)
+                    writer.write("v" + i + ",");
+
+            ArrayList paramsC = (ArrayList) minfo.getOutputParameterTypes();
+            for (int i = 0; i < paramsC.size() - 1; i++)
+                writer.write("&out" + i + ",");
+
+            writer.write("&out" + (paramsC.size() - 1));
+            writer.write(");\n");
+            paramsC = (ArrayList) minfo.getOutputParameterTypes();
+            for (int i = 0; i < paramsC.size(); i++)
+            {
+                ParameterInfo param = (ParameterInfo) paramsC.get(i);
+                retType = wscontext.getTypemap().getType(param.getSchemaName());
+                if (retType != null)
+                {
+                    if (retType.isSimpleType())
                     {
-                        writer.write(
-                            "\treturn SZ._functions->addOutputAnyObject(SZ._object, ret);\n");
+                        returntypeissimple = true;
+                        outparamType = CUtils.getclass4qname(retType.getBaseType());
                     }
                     else
                     {
-                        //complex type
-                        writer.write(
-                            "\treturn SZ._functions->addOutputCmplxParam(SZ._object, ret, (void*)Axis_Serialize_"
-                                + outparamType
-                                + ", (void*)Axis_Delete_"
-                                + outparamType
-                                + ", \""
-                                + returnParamName
-                                + "\", Axis_URI_"
-                                + outparamType
-                                + ");\n");
+                        outparamType = retType.getLanguageSpecificName();
+                        returntypeisarray = retType.isArray();
+                        returntypeissimple = CUtils.isSimpleType(outparamType);
                     }
-        }
-        else
-            if (isAllTreatedAsOutParams)
-            {
-                writer.write("\t" + methodName + "(");
-                if (0 < paramsB.size())
+                }
+                else
                 {
-                    for (int i = 0; i < paramsB.size(); i++)
-                    {
-                        writer.write("v" + i + ",");
-                    }
+                    outparamType = param.getLangName();
+                    returntypeissimple = CUtils.isSimpleType(outparamType);
                 }
-                ArrayList paramsC = (ArrayList) minfo.getOutputParameterTypes();
-                for (int i = 0; i < paramsC.size() - 1; i++)
+                
+                returnParamName = param.getElementName().getLocalPart();
+                
+                if (returntypeissimple)
                 {
-                    writer.write("&out" + i + ",");
+                    writer.write(
+                        "\tSZ._functions->addOutputParam(SZ._object, \""
+                            + returnParamName
+                            + "\", (void*)&out" + i + ", "
+                            + CUtils.getXSDTypeForBasicType(outparamType)
+                            + ");\n");
                 }
-                writer.write("&out" + (paramsC.size() - 1));
-                writer.write(");\n");
-                paramsC = (ArrayList) minfo.getOutputParameterTypes();
-                for (int i = 0; i < paramsC.size(); i++)
+                else if (returntypeisarray)
                 {
-                    ParameterInfo param = (ParameterInfo) paramsC.get(i);
-                    retType =
-                        wscontext.getTypemap().getType(param.getSchemaName());
-                    if (retType != null)
+                    QName qname = WrapperUtils.getArrayType(retType).getName();
+                    String containedType = null;
+                    if (CUtils.isSimpleType(qname))
                     {
-                        if (retType.isSimpleType())
-                        {
-                            returntypeissimple = true;
-                            outparamType =
-                                CUtils.getclass4qname(retType.getBaseType());
-                        }
-                        else
-                        {
-                            outparamType = retType.getLanguageSpecificName();
-                            returntypeisarray = retType.isArray();
-                            returntypeissimple =
-                                CUtils.isSimpleType(outparamType);
-                        }
+                        containedType = CUtils.getclass4qname(qname);
+                        writer.write(
+                            "\tSZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&out"
+                                + i + "), "
+                                + CUtils.getXSDTypeForBasicType(containedType)
+                                + ", \""
+                                + returnParamName
+                                + "\");\n");
                     }
                     else
                     {
-                        outparamType = param.getLangName();
-                        returntypeissimple = CUtils.isSimpleType(outparamType);
-                    }
-                    returnParamName = param.getElementName().getLocalPart();
-                    if (returntypeissimple)
-                    {
+                        containedType = qname.getLocalPart();
                         writer.write(
-                            "\tSZ._functions->addOutputParam(SZ._object, \""
+                            "\tSZ._functions->addOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&out"
+                                + i + "),"
+                                + "(void*) Axis_Serialize_" + containedType
+                                + ", (void*) Axis_Delete_" + containedType
+                                + ", (void*) Axis_GetSize_" + containedType
+                                + ", \""
                                 + returnParamName
-                                + "\", (void*)&out"
-                                + i
-                                + ", "
-                                + CUtils.getXSDTypeForBasicType(outparamType)
+                                + "\", Axis_URI_"  + containedType
                                 + ");\n");
                     }
-                    else
-                        if (returntypeisarray)
-                        {
-                            QName qname =
-                                WrapperUtils.getArrayType(retType).getName();
-                            String containedType = null;
-                            if (CUtils.isSimpleType(qname))
-                            {
-                                containedType = CUtils.getclass4qname(qname);
-                                writer.write(
-                                    "\tSZ._functions->addOutputBasicArrayParam(SZ._object, (Axis_Array*)(&out"
-                                        + i
-                                        + "), "
-                                        + CUtils.getXSDTypeForBasicType(
-                                            containedType)
-                                        + ", \""
-                                        + returnParamName
-                                        + "\");\n");
-                            }
-                            else
-                            {
-                                containedType = qname.getLocalPart();
-                                writer.write(
-                                    "\tSZ._functions->addOutputCmplxArrayParam(SZ._object, (Axis_Array*)(&out"
-                                        + i
-                                        + "),"
-                                        + "(void*) Axis_Serialize_"
-                                        + containedType
-                                        + ", (void*) Axis_Delete_"
-                                        + containedType
-                                        + ", (void*) Axis_GetSize_"
-                                        + containedType
-                                        + ", \""
-                                        + returnParamName
-                                        + "\", Axis_URI_"
-                                        + containedType
-                                        + ");\n");
-                            }
-                        }
-                        else
-                            if (param.isAnyType())
-                            {
-                                //anyType
-                                writer.write(
-                                    "\tSZ._functions->addOutputAnyObject(SZ._object, out"
-                                        + i
-                                        + ");\n");
-                            }
-                            else
-                            {
-                                //complex type
-                                writer.write(
-                                    "\tSZ._functions->addOutputCmplxParam(SZ._object, out"
-                                        + i
-                                        + ", (void*)Axis_Serialize_"
-                                        + outparamType
-                                        + ", (void*)Axis_Delete_"
-                                        + outparamType
-                                        + ", \""
-                                        + returnParamName
-                                        + "\", Axis_URI_"
-                                        + outparamType
-                                        + ");\n");
-                            }
                 }
-                writer.write("\treturn AXIS_SUCCESS;\n");
-            }
-            else
-            { //method does not return anything
-                /* Invoke the service when return type is void */
-                writer.write("\t" + methodName + "(");
-                if (0 < paramsB.size())
+                else if (param.isAnyType())
+                    writer.write("\tSZ._functions->addOutputAnyObject(SZ._object, out" + i + ");\n");
+                else
                 {
-                    for (int i = 0; i < paramsB.size() - 1; i++)
-                    {
-                        writer.write("v" + i + ",");
-                    }
-                    writer.write("v" + (paramsB.size() - 1));
+                    //complex type
+                    writer.write(
+                        "\tSZ._functions->addOutputCmplxParam(SZ._object, out"
+                            + i
+                            + ", (void*)Axis_Serialize_" + outparamType
+                            + ", (void*)Axis_Delete_" + outparamType
+                            + ", \""
+                            + returnParamName
+                            + "\", Axis_URI_" + outparamType
+                            + ");\n");
                 }
-                writer.write(");\n");
-                writer.write("\treturn AXIS_SUCCESS;\n");
             }
+            writer.write("\treturn AXIS_SUCCESS;\n");
+        }
+        else
+        { 
+            //method does not return anything
+            /* Invoke the service when return type is void */
+            writer.write("\t" + methodName + "(");
+            if (0 < paramsB.size())
+            {
+                for (int i = 0; i < paramsB.size() - 1; i++)
+                    writer.write("v" + i + ",");
+
+                writer.write("v" + (paramsB.size() - 1));
+            }
+            writer.write(");\n");
+            writer.write("\treturn AXIS_SUCCESS;\n");
+        }
         //write end of method
         writer.write("}\n");
     }
@@ -653,43 +534,36 @@
             while (types.hasNext())
             {
                 type = (Type) types.next();
+                
                 if (type.isSimpleType())
                     continue;
+                
                 if (type.isArray())
                     continue;
+                
                 typeName = type.getLanguageSpecificName();
                 if (typeName.startsWith(">"))
                     continue;
+                
                 typeSet.add(typeName);
             }
+            
             Iterator itr = typeSet.iterator();
             while (itr.hasNext())
             {
                 typeName = itr.next().toString();
                 writer.write(
-                    "extern int Axis_DeSerialize_"
-                        + typeName
-                        + "("
-                        + typeName
-                        + "* param, IWrapperSoapDeSerializer* pDZ);\n");
-                writer.write(
-                    "extern void* Axis_Create_"
-                        + typeName
-                        + "("
-                        + typeName
-                        + "* Obj, bool bArray, int nSize);\n");
-                writer.write(
-                    "extern void Axis_Delete_"
-                        + typeName
-                        + "("
-                        + typeName
-                        + "* param, bool bArray, int nSize);\n");
-                writer.write(
-                    "extern int Axis_Serialize_"
-                        + typeName
-                        + "("
-                        + typeName
-                        + "* param, IWrapperSoapSerializer* pSZ, bool bArray);\n");
+                    "extern int Axis_DeSerialize_" + typeName
+                        + "(" + typeName + "* param, IWrapperSoapDeSerializer* pDZ);\n");
+                writer.write(
+                    "extern void* Axis_Create_" + typeName
+                        + "(" + typeName + "* Obj, bool bArray, int nSize);\n");
+                writer.write(
+                    "extern void Axis_Delete_" + typeName
+                        + "(" + typeName + "* param, bool bArray, int nSize);\n");
+                writer.write(
+                    "extern int Axis_Serialize_" + typeName
+                        + "(" + typeName + "* param, IWrapperSoapSerializer* pSZ, bool bArray);\n");
                 writer.write("extern int Axis_GetSize_" + typeName + "();\n\n");
             }
         }



Mime
View raw message