axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From di...@apache.org
Subject svn commit: r377395 - in /webservices/axis/trunk/c: src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ tests/auto_build/testcases/server/cpp/ tests/auto_build/testcases/tests/server/
Date Mon, 13 Feb 2006 15:32:37 GMT
Author: dicka
Date: Mon Feb 13 07:32:35 2006
New Revision: 377395

URL: http://svn.apache.org/viewcvs?rev=377395&view=rev
Log:
Include server-side support for optional (minOccurs="0") elements.
Also including a new service, MinOccursIsZero.

This change also includes some fixes for nillable, so also updating the MultiOut service implementation.

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MinOccursIsZero.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/tests/server/MinOccursIsZero.xml
Modified:
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
    webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
    webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MultiOut.cpp

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java?rev=377395&r1=377394&r2=377395&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceHeaderWriter.java
Mon Feb 13 07:32:35 2006
@@ -238,16 +238,29 @@
                     for (int j = 0; params.hasNext(); j++)
                     {
                         ParameterInfo nparam = (ParameterInfo) params.next();
-                        String comma = ", ";
-                        if (!hasInputParms && 0==j) comma = "";
-                        writer.write(comma
-                            + "AXIS_OUT_PARAM "
-                                + WrapperUtils
-                                    .getClassNameFromParamInfoConsideringArrays(
-                                    nparam,
-                                    wscontext)
-                                + " *OutValue"
-                                + j);
+                        
+                        if (0 != j || hasInputParms)
+                        {
+                            writer.write(",");
+                        }
+                        
+                        String typeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+                                        	nparam, wscontext);
+                        
+                        writer.write(" AXIS_OUT_PARAM "
+                                + typeName + " ");
+                        
+                        
+                        
+                        if (( nparam.isOptional() || nparam.isNillable())
+                                && CUtils.isSimpleType(typeName)
+                                && !CUtils.isPointerType(typeName)
+                                && !nparam.isArray())
+                        {
+                            writer.write("*");
+                        }
+                        
+                        writer.write("* OutValue" + j);
                     }
                 }
                 writer.write(");\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java?rev=377395&r1=377394&r2=377395&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/ServiceWriter.java
Mon Feb 13 07:32:35 2006
@@ -232,7 +232,7 @@
                     	writer.write(
     	                        ","
     	                            + paramType
-    	                            + " * Value "
+    	                            + " * Value"
     	                            + j);
                     }
                     else
@@ -251,16 +251,28 @@
                     {
                         ParameterInfo nparam = (ParameterInfo) params.next();
                         
-                        String comma = ", ";
-                        if (!hasInputParms && 0==j) comma = "";
-                        writer.write(comma
-                            + "AXIS_OUT_PARAM "
-                                + WrapperUtils
-                                    .getClassNameFromParamInfoConsideringArrays(
-                                    nparam,
-                                    wscontext)
-                                + " *OutValue"
-                                + j);
+                        if (0 != j || hasInputParms)
+                        {
+                            writer.write(",");
+                        }
+                        
+                        String typeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+                                        	nparam, wscontext);
+                        
+                        writer.write(" AXIS_OUT_PARAM "
+                                + typeName + " ");
+                        
+                        
+                        
+                        if (( nparam.isOptional() || nparam.isNillable() )
+                                && CUtils.isSimpleType(typeName)
+                                && !CUtils.isPointerType(typeName)
+                                && !nparam.isArray())
+                        {
+                            writer.write("*");
+                        }
+                        
+                        writer.write("* OutValue" + j);
                     }
                 }
                 writer.write(")  \n{\n}\n\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java?rev=377395&r1=377394&r2=377395&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/WrapWriter.java Mon
Feb 13 07:32:35 2006
@@ -500,18 +500,16 @@
             ArrayList paramsC = (ArrayList) minfo.getOutputParameterTypes();
             for (int i = 0; i < paramsC.size(); i++)
             {
-                type =
-                    wscontext.getTypemap().getType(
-                        ((ParameterInfo) paramsC.get(i)).getSchemaName());
-                writer.write(
-                    "\t"
-                        + WrapperUtils
-                            .getClassNameFromParamInfoConsideringArrays(
-                            (ParameterInfo) paramsC.get(i),
-                            wscontext)
-                        + " out"
-                        + i
-                        + ";\n");
+                ParameterInfo param = (ParameterInfo) paramsC.get(i);
+                String typeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+                        			(ParameterInfo) paramsC.get(i), wscontext);
+                writer.write("\t" + typeName);
+                
+                if ( (param.isOptional() || param.isNillable()) && CUtils.isSimpleType(typeName)
&& !CUtils.isPointerType(typeName) && !param.isArray())
+                {
+                    writer.write(" *");
+                }
+                writer.write(" out" + i + ";\n");
             }
         }
         writer.write("\ttry\n\t{\n");
@@ -635,6 +633,7 @@
                 paramsC = (ArrayList) minfo.getOutputParameterTypes();
                 for (int i = 0; i < paramsC.size(); i++)
                 {
+                    ParameterInfo param = (ParameterInfo) paramsC.get(i);
                     retType =
                         wscontext.getTypemap().getType(
                             ((ParameterInfo) paramsC.get(i)).getSchemaName());
@@ -652,14 +651,39 @@
                         ((ParameterInfo) paramsC.get(i)).getParamName();
                     if (returntypeissimple)
                     {
-                        writer.write(
-                            "\t\tpIWSSZ->addOutputParam(\""
-                                + returnParamName
-                                + "\", (void*)&out"
-                                + i
-                                + ", "
-                                + CUtils.getXSDTypeForBasicType(outparamType)
-                                + ");\n");
+                        
+                        if (CUtils.isPointerType(outparamType) || param.isOptional() || param.isNillable())
+                    	{
+                            if (param.isOptional())
+                            {
+                                writer.write("\tif (out" + i + ")\n");
+                                writer.write("\t{\n");
+                                writer.write("\t");
+                            }
+                    		writer.write(
+                                    "\tpIWSSZ->addOutputParam(\""
+                                        + returnParamName.substring(returnParamName.lastIndexOf(">")+1)
+                                        + "\", (void*)out"
+                                        + i
+                                        + ", "
+                                        + CUtils.getXSDTypeForBasicType(outparamType)
+                                        + ");\n");
+                    		if (param.isOptional())
+                    		{
+                    		    writer.write("\t}\n");
+                    		}
+                    	}
+                    	else
+                    	{
+                    		writer.write(
+                                    "\tpIWSSZ->addOutputParam(\""
+                    				    + returnParamName.substring(returnParamName.lastIndexOf(">")+1)
+                                        + "\", (void*)&out"
+                                        + i
+                                        + ", "
+                                        + CUtils.getXSDTypeForBasicType(outparamType)
+                                        + ");\n");
+                    	}
                     }
                     else
                         if (returntypeisarray)
@@ -703,6 +727,12 @@
                         else
                         {
                             //complex type
+                            if (param.isOptional())
+                            {
+                                writer.write("\tif (out" + i + ")\n");
+                                writer.write("\t{\n");
+                                writer.write("\t");
+                            }
                             writer.write(
                                 "\t\tpIWSSZ->addOutputCmplxParam(out"
                                     + i
@@ -715,6 +745,10 @@
                                     + "\", Axis_URI_"
                                     + outparamType
                                     + ");\n");
+                            if (param.isOptional())
+                            {
+                                writer.write("\t}\n");
+                            }
                         }
                 }
                 writer.write("\treturn AXIS_SUCCESS;\n");

Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java?rev=377395&r1=377394&r2=377395&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
(original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/WrapWriter.java
Mon Feb 13 07:32:35 2006
@@ -258,11 +258,18 @@
                     {
                     	if (CUtils.isPointerType(paraTypeName))
                     	{
+
                     		writer.write("\n\t"
                                 + paraTypeName
                                 + " v"
                                 + i
                                 + " = NULL;\n");
+                    	    if (param.isOptional())
+                    	    {
+                    	        writer.write("\tconst char * elementName" + i + " = pIWSDZ->peekNextElementName();\n");
+                    	        writer.write("\tif ( strcmp( elementName" + i + ", \"" + elementName
+ "\" ) == 0)\n");
+                    	        writer.write("\t{\n");
+                    	    }
                     		writer.write("\t" + paraTypeName + " value" + i + " = pIWSDZ->"
                                 + CUtils.getParameterGetValueMethodName(
                                     paraTypeName,
@@ -276,12 +283,22 @@
                     		writer.write("\t\tstrcpy( v" + i + ", value" + i + ");\n");
                     		writer.write("\t\tAxis::AxisDelete( (void *) value" + i + ", " + CUtils.getXSDTypeForBasicType(paraTypeName)
+ " );\n");
                     		writer.write("\t}\n");
+                    		if (param.isOptional())
+                    		{
+                    		    writer.write("\t}\n");
+                    		}
                     	}
                     	else
                     	{
-                    		if (param.isNillable())
+                    		if (param.isNillable()  || param.isOptional())
                     		{
                     		    writer.write("\n\t" + paraTypeName + " * v" + i + " = NULL;\n");
+                    		    if (param.isOptional())
+                    		    {
+                    		        writer.write("\tconst char * elementName" + i + " = pIWSDZ->peekNextElementName();\n");
+                    		        writer.write("\tif (strcmp( elementName" + i + ", \"" + elementName
+ "\" ) == 0)\n");
+                    		        writer.write("\t{\n");
+                    		    }
                     		    writer.write("\t" + paraTypeName + " * pValue" + i
                                         + " = pIWSDZ->"
                                         + CUtils.getParameterGetValueMethodName(
@@ -296,6 +313,10 @@
                     		    writer.write("\t\t*v" + i + " = *pValue" + i + ";\n");
                     		    writer.write("\t\tAxis::AxisDelete( (void *) pValue" + i + ", "
+ CUtils.getXSDTypeForBasicType(paraTypeName) + ");\n");
                     		    writer.write("\t}\n");
+                    		    if (param.isOptional())
+                    		    {
+                    		        writer.write("\t}\n");
+                    		    }
                     		}
                     		else
                     		{
@@ -447,18 +468,16 @@
             ArrayList paramsC = (ArrayList) minfo.getOutputParameterTypes();
             for (int i = 0; i < paramsC.size(); i++)
             {
-                type =
-                    wscontext.getTypemap().getType(
-                        ((ParameterInfo) paramsC.get(i)).getSchemaName());
-                writer.write(
-                    "\t"
-                        + WrapperUtils
-                            .getClassNameFromParamInfoConsideringArrays(
-                            (ParameterInfo) paramsC.get(i),
-                            wscontext)
-                        + " out"
-                        + i
-                        + ";\n");
+                ParameterInfo param = (ParameterInfo) paramsC.get(i);
+                String typeName = WrapperUtils.getClassNameFromParamInfoConsideringArrays(
+                        			(ParameterInfo) paramsC.get(i), wscontext);
+                writer.write("\t" + typeName);
+                
+                if ( (param.isOptional() || param.isNillable()) && CUtils.isSimpleType(typeName)
&& !CUtils.isPointerType(typeName) && !param.isArray())
+                {
+                    writer.write(" *");
+                }
+                writer.write(" out" + i + ";\n");
             }
         }
         writer.write("\ttry\n\t{\n"); //nithya
@@ -696,8 +715,14 @@
                         	 */
                         	
                         	
-                        	if (CUtils.isPointerType(outparamType))
+                        	if (CUtils.isPointerType(outparamType) || param.isOptional() ||
param.isNillable())
                         	{
+                                if (param.isOptional())
+                                {
+                                    writer.write("\tif (out" + i + ")\n");
+                                    writer.write("\t{\n");
+                                    writer.write("\t");
+                                }
                         		writer.write(
                                         "\tpIWSSZ->addOutputParam(\""
                                             + returnParamName.substring(returnParamName.lastIndexOf(">")+1)
@@ -706,6 +731,10 @@
                                             + ", "
                                             + CUtils.getXSDTypeForBasicType(outparamType)
                                             + ");\n");
+                        		if (param.isOptional())
+                        		{
+                        		    writer.write("\t}\n");
+                        		}
                         	}
                         	else
                         	{
@@ -792,6 +821,12 @@
                             }
                             else
                             {
+                                if (param.isOptional())
+                                {
+                                    writer.write("\tif (out" + i + ")\n");
+                                    writer.write("\t{\n");
+                                    writer.write("\t");
+                                }
                                 //complex type
                                 writer.write(
                                     "\tpIWSSZ->addOutputCmplxParam(out"
@@ -805,6 +840,10 @@
                                         + "\", Axis_URI_"
                                         + outparamType
                                         + ");\n");
+                                if (param.isOptional())
+                                {
+                                    writer.write("\t}\n");
+                                }
                             }
                         }
                     }

Added: webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MinOccursIsZero.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MinOccursIsZero.cpp?rev=377395&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MinOccursIsZero.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MinOccursIsZero.cpp Mon
Feb 13 07:32:35 2006
@@ -0,0 +1,45 @@
+/*
+ * Copyright 2003-2004 The Apache Software Foundation.
+
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *		http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ * This file was auto-generated by the Axis C++ Web Service Generator (WSDL2Ws)
+ * This file contains definitions of the web service
+ */
+
+#include "MinOccursIsZero.hpp"
+
+
+MinOccursIsZero::MinOccursIsZero()
+{
+}
+
+MinOccursIsZero::~MinOccursIsZero()
+{
+}
+
+/* This function is called by the AxisEngine when something went wrong
+ with the current web service request processing. Appropriate actions should
+ be taken here.*/
+void MinOccursIsZero::onFault()
+{
+}
+
+void MinOccursIsZero::optionalElements(xsd__string Value0, xsd__integer * Value1, SimpleComplexType
* Value2, AXIS_OUT_PARAM xsd__string * OutValue0, AXIS_OUT_PARAM xsd__integer ** OutValue1,
AXIS_OUT_PARAM SimpleComplexType ** OutValue2)  
+{
+	OutValue0 = &Value0;
+	OutValue1 = &Value1;
+	OutValue2 = &Value2;
+}
+

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MultiOut.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MultiOut.cpp?rev=377395&r1=377394&r2=377395&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MultiOut.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/server/cpp/MultiOut.cpp Mon Feb 13
07:32:35 2006
@@ -36,15 +36,15 @@
 {
 }
 
-void MultiOut::get(AXIS_OUT_PARAM xsd__string *OutValue0, AXIS_OUT_PARAM xsd__integer *OutValue1,
AXIS_OUT_PARAM xsd__int *OutValue2, AXIS_OUT_PARAM xsd__long *OutValue3, AXIS_OUT_PARAM xsd__short
*OutValue4, AXIS_OUT_PARAM xsd__decimal *OutValue5, AXIS_OUT_PARAM xsd__float *OutValue6,
AXIS_OUT_PARAM xsd__double *OutValue7, AXIS_OUT_PARAM xsd__boolean *OutValue8, AXIS_OUT_PARAM
xsd__byte *OutValue9)  
+void MultiOut::get(AXIS_OUT_PARAM xsd__string *OutValue0, AXIS_OUT_PARAM xsd__integer **OutValue1,
AXIS_OUT_PARAM xsd__int *OutValue2, AXIS_OUT_PARAM xsd__long *OutValue3, AXIS_OUT_PARAM xsd__short
*OutValue4, AXIS_OUT_PARAM xsd__decimal *OutValue5, AXIS_OUT_PARAM xsd__float *OutValue6,
AXIS_OUT_PARAM xsd__double *OutValue7, AXIS_OUT_PARAM xsd__boolean *OutValue8, AXIS_OUT_PARAM
xsd__byte *OutValue9)  
 {
 	*OutValue0 = "Hello Mark";
-	*OutValue1 = 23;
+	*OutValue1 = new xsd__integer(23);
 	*OutValue2 = 23;
 	*OutValue3 = 23;
 	*OutValue4 = 23;
 	*OutValue5 = 23;
-	*OutValue6 = 23.1;
+	*OutValue6 = (float) 23.1;
 	*OutValue7 = 23.1;
 	*OutValue8 = true_;
 	*OutValue9 = 'A';

Added: webservices/axis/trunk/c/tests/auto_build/testcases/tests/server/MinOccursIsZero.xml
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/tests/server/MinOccursIsZero.xml?rev=377395&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/tests/server/MinOccursIsZero.xml (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/tests/server/MinOccursIsZero.xml Mon
Feb 13 07:32:35 2006
@@ -0,0 +1,8 @@
+<service>
+    <name>MinOccursIsZero</name>
+    <description>MinOccursIsZero Service</description>
+    <serviceLang>cpp</serviceLang>
+    <serviceCode>MinOccursIsZero.cpp</serviceCode>
+    <wsdl>MinOccursIsZero.wsdl</wsdl>
+	<servicename></servicename>
+</service>



Mime
View raw message