You are viewing a plain text version of this content. The canonical link for it is here.
Posted to axis-cvs@ws.apache.org by di...@apache.org on 2005/12/07 17:11:48 UTC
svn commit: r354788 - in /webservices/axis/trunk/c:
src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/
tests/auto_build/testcases/client/cpp/
Author: dicka
Date: Wed Dec 7 08:11:39 2005
New Revision: 354788
URL: http://svn.apache.org/viewcvs?rev=354788&view=rev
Log:
Correct problem for output parameters of simple types which are neither nillable nor optional (minOccurs="0").
These were being generated as pointer-to-pointer, however they should be pointer-to-value, to maintain consistency with input and return parameters. Particularly as these types cannot be NULL.
This change has required several testcases to be updated to match this, as they were written for the previous incorrect state.
Modified:
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ElementFormDefaultTestClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InOutClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MixedTextMessageClient.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MultiOutClient.cpp
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java?rev=354788&r1=354787&r2=354788&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubHeaderWriter.java Wed Dec 7 08:11:39 2005
@@ -137,31 +137,43 @@
for (int j = 0; params.hasNext(); j++)
{
ParameterInfo nparam = (ParameterInfo) params.next();
- String comma = ", ";
String paramType = WrapperUtils.getClassNameFromParamInfoConsideringArrays( nparam, wscontext);
boolean bTypeHasStar = paramType.endsWith( "*");
- if (!hasInputParms && 0==j)
- {
- comma = "";
- }
+ if (hasInputParms || 0!=j)
+ {
+ writer.write(", ");
+ }
- if( CUtils.isPointerType( paramType) || bTypeHasStar)
+ writer.write("AXIS_OUT_PARAM " + paramType);
+ if (CUtils.isSimpleType(paramType))
+ {
+ if ((nparam.isOptional() || nparam.isNillable()) && !CUtils.isPointerType(paramType))
+ {
+ if (bTypeHasStar)
+ {
+ writer.write(" *");
+ }
+ else
+ {
+ writer.write(" **");
+ }
+ }
+ else if (CUtils.isPointerType(paramType) || !bTypeHasStar)
+ {
+ writer.write(" *");
+ }
+ // Else we don't need to anymore '*'
+ }
+ else if(bTypeHasStar)
{
- writer.write(comma
- + "AXIS_OUT_PARAM "
- + paramType
- + " * OutValue"
- + j);
+ writer.write(" *");
}
else
{
- writer.write(comma
- + "AXIS_OUT_PARAM "
- + paramType
- + " ** OutValue"
- + j);
+ writer.write(" **");
}
+ writer.write(" OutValue" + j);
}
}
writer.write(");\n");
Modified: webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java?rev=354788&r1=354787&r2=354788&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java (original)
+++ webservices/axis/trunk/c/src/wsdl/org/apache/axis/wsdl/wsdl2ws/cpp/literal/ClientStubWriter.java Wed Dec 7 08:11:39 2005
@@ -363,23 +363,46 @@
wscontext.getTypemap ().getType (((ParameterInfo) paramsC.
get (i)).
getSchemaName ());
- String comma = ", ";
- if (paramsB.size()==0 && 0==i)
- {
- comma = "";
- }
+ ParameterInfo param = (ParameterInfo) paramsC.get (i);
+ String paramType = WrapperUtils.getClassNameFromParamInfoConsideringArrays (param, wscontext);
+
+ boolean bTypeHasStar = paramType.endsWith("*");
- String xsdType = WrapperUtils.getClassNameFromParamInfoConsideringArrays ((ParameterInfo) paramsC.get (i), wscontext);
+ if (paramsB.size()!=0 || 0!=i)
+ {
+ writer.write(", ");
+ }
- if( CUtils.isPointerType( xsdType) || xsdType.endsWith( "*"))
+ writer.write("AXIS_OUT_PARAM " + paramType);
+ if (CUtils.isSimpleType(paramType))
+ {
+ if ((param.isOptional() || param.isNillable()) && !CUtils.isPointerType(paramType))
+ {
+ if (bTypeHasStar)
+ {
+ writer.write(" *");
+ }
+ else
+ {
+ writer.write(" **");
+ }
+ }
+ else if (CUtils.isPointerType(paramType) || !bTypeHasStar)
+ {
+ writer.write(" *");
+ }
+ // Else we don't need to anymore '*'
+ }
+ else if(bTypeHasStar)
{
- writer.write (comma + "AXIS_OUT_PARAM " + xsdType + " * OutValue" + i);
+ writer.write(" *");
}
else
{
- writer.write (comma + "AXIS_OUT_PARAM " + xsdType + " ** OutValue" + i);
+ writer.write(" **");
}
-
+ writer.write(" OutValue" + i);
+
}
}
@@ -933,12 +956,20 @@
writer.write( "\n");
writer.write( "\t\t\tif( pReturn" + i + " != NULL && OutValue" + i + " != NULL)\n");
writer.write( "\t\t\t{\n");
- writer.write( "\t\t\t\tif( *OutValue" + i + " == NULL)\n");
- writer.write( "\t\t\t\t{\n");
- writer.write( "\t\t\t\t\t*OutValue" + i + " = new " + currentParaType + "();\n");
- writer.write( "\t\t\t\t}\n");
- writer.write( "\n");
- writer.write( "\t\t\t**OutValue" + i + " = *pReturn" + i + ";\n");
+ if (currentType.isNillable() || currentType.isOptional())
+ {
+ writer.write( "\t\t\t\tif( *OutValue" + i + " == NULL)\n");
+ writer.write( "\t\t\t\t{\n");
+ writer.write( "\t\t\t\t\t*OutValue" + i + " = new " + currentParaType + "();\n");
+ writer.write( "\t\t\t\t}\n");
+ writer.write( "\n");
+ writer.write( "\t\t\t\t*");
+ }
+ else
+ {
+ writer.write( "\t\t\t\t");
+ }
+ writer.write( "*OutValue" + i + " = *pReturn" + i + ";\n");
writer.write( "\t\t\t}\n");
writer.write( "\n");
writer.write( "\t\t\tAxis::AxisDelete( (void *) pReturn" + i + ", " + CUtils.getXSDTypeForBasicType( currentParaType) + ");\n");
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ElementFormDefaultTestClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ElementFormDefaultTestClient.cpp?rev=354788&r1=354787&r2=354788&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ElementFormDefaultTestClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ElementFormDefaultTestClient.cpp Wed Dec 7 08:11:39 2005
@@ -82,7 +82,7 @@
// Prepare output parameters
xsd__string outStringElement = NULL;
- xsd__integer * outIntegerElement = NULL;
+ xsd__integer outIntegerElement;
xsd__integer_Array * outIntegerArrayElement = NULL;
xsd__integer * outOptionalIntegerElement = NULL;
xsd__integer * outNillableIntegerElement = NULL;
@@ -126,8 +126,7 @@
// Print output values
cout << "String element = " << outStringElement << endl;
delete [] outStringElement;
- cout << "Integer element = " << *outIntegerElement << endl;
- delete outIntegerElement;
+ cout << "Integer element = " << outIntegerElement << endl;
cout << "Array of integer elements" << endl;
outputSize = 0;
const xsd__integer** outArrayOfIntegers = outIntegerArrayElement->get(outputSize);
@@ -212,7 +211,7 @@
// Prepare output parameters
xsd__string outStringElement = NULL;
- xsd__integer * outIntegerElement = NULL;
+ xsd__integer outIntegerElement;
xsd__integer_Array * outIntegerArrayElement = NULL;
xsd__integer * outOptionalIntegerElement = NULL;
xsd__integer * outNillableIntegerElement = NULL;
@@ -255,8 +254,7 @@
// Print output values
cout << "String element = " << outStringElement << endl;
delete [] outStringElement;
- cout << "Integer element = " << *outIntegerElement << endl;
- delete outIntegerElement;
+ cout << "Integer element = " << outIntegerElement << endl;
cout << "Array of integer elements" << endl;
outputSize = 0;
const xsd__integer** outArrayOfIntegers = outIntegerArrayElement->get(outputSize);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InOutClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InOutClient.cpp?rev=354788&r1=354787&r2=354788&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InOutClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InOutClient.cpp Wed Dec 7 08:11:39 2005
@@ -73,15 +73,12 @@
// test multiParametersMultiReturn
xsd__string outValue0 = "";
- xsd__int * pOutValue1 = 0;
- xsd__double * pOutValue2 = 0;
+ xsd__int outValue1 = 0;
+ xsd__double outValue2 = 0;
cout << "multiParametersMultiReturn" << endl;
- ws.multiParametersMultiReturn("Hey dude", 69, (xsd__double)17.19, &outValue0, &pOutValue1, &pOutValue2);
- cout << "multiParametersMultiReturn returned " << outValue0 << " , " << *pOutValue1 << " , " << *pOutValue2 <<endl;
-
- delete pOutValue1;
- delete pOutValue2;
+ ws.multiParametersMultiReturn("Hey dude", 69, (xsd__double)17.19, &outValue0, &outValue1, &outValue2);
+ cout << "multiParametersMultiReturn returned " << outValue0 << " , " << outValue1 << " , " << outValue2 <<endl;
//...........................................................
@@ -112,16 +109,13 @@
xsd__string OutValue0 = "";
ComplexType1* OutValue1;
- xsd__int * pOutValue22 = 0;
- xsd__double * pOutValue33 = 0;
+ xsd__int outValue22 = 0;
+ xsd__double outValue33 = 0;
cout << "multiComplexParametersMultiComplexReturn" << endl;
- ws.multiComplexParametersMultiComplexReturn("Hello", &ct, 27, 13.31, &stringArray, &OutValue0, &OutValue1, &pOutValue22, &pOutValue33);
+ ws.multiComplexParametersMultiComplexReturn("Hello", &ct, 27, 13.31, &stringArray, &OutValue0, &OutValue1, &outValue22, &outValue33);
cout << "multiComplexParametersMultiComplexReturn returned " << OutValue0 << " , " << OutValue1->ctString << endl;
- delete pOutValue22;
- delete pOutValue33;
-
//..............................................................................
@@ -197,8 +191,6 @@
ctr = ws.complexParameterComplexReturn(&ct2);
cout << "complexParameterComplexReturn with nil parameters returned " << ctr->ctLong << endl;
- delete pOutValue1;
- delete pOutValue2;
}
catch(AxisException& e)
{
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MixedTextMessageClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MixedTextMessageClient.cpp?rev=354788&r1=354787&r2=354788&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MixedTextMessageClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MixedTextMessageClient.cpp Wed Dec 7 08:11:39 2005
@@ -43,31 +43,29 @@
xsd__int * pxiOrderNumber = NULL;
xsd__string * psTo = &xsTo;
- xsd__date ** ppdDate = &pxdDate;
- xsd__int ** ppiOrderNumber = &pxiOrderNumber;
+ xsd__date * pdDate = new xsd__date();
+ xsd__int * piOrderNumber = new xsd__int();
- pWS->GetLetter( sLetterId, psTo, ppdDate, ppiOrderNumber);
+ pWS->GetLetter( sLetterId, psTo, pdDate, piOrderNumber);
cout << "The letter information for: " << sLetterId << endl;
cout << "To: " << *psTo << endl;
- cout << "Date: " << asctime( *ppdDate);
- cout << "OrderNo: " << **ppiOrderNumber << endl << endl;
+ cout << "Date: " << asctime( pdDate);
+ cout << "OrderNo: " << *piOrderNumber << endl << endl;
delete *psTo;
- delete *ppdDate;
- delete *ppiOrderNumber;
// Demonstrating references to pointers.
xsd__string sTo = NULL;
- xsd__date * pdDate = NULL;
- xsd__int * piOrderNumber = NULL;
+ xsd__date dDate;
+ xsd__int iOrderNumber;
- pWS->GetLetter( sLetterId, &sTo, &pdDate, &piOrderNumber);
+ pWS->GetLetter( sLetterId, &sTo, &dDate, &iOrderNumber);
cout << "The letter information for: " << sLetterId << endl;
cout << "To: " << sTo << endl;
- cout << "Date: " << asctime( pdDate);
- cout << "OrderNo: " << *piOrderNumber << endl;
+ cout << "Date: " << asctime( &dDate);
+ cout << "OrderNo: " << iOrderNumber << endl;
delete sLetterId;
delete sTo;
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MultiOutClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MultiOutClient.cpp?rev=354788&r1=354787&r2=354788&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MultiOutClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/MultiOutClient.cpp Wed Dec 7 08:11:39 2005
@@ -14,6 +14,7 @@
// limitations under the License.
#include "MultiOut.hpp"
+#include "CommonClientTestCode.hpp"
#include <axis/AxisException.hpp>
#include <ctype.h>
#include <iostream>
@@ -30,50 +31,48 @@
xsd__string OutValue0 = NULL;
xsd__integer * pOutValue1 = NULL;
- xsd__int * pOutValue2 = NULL;
- xsd__long * pOutValue3 = NULL;
- xsd__short * pOutValue4 = NULL;
- xsd__decimal * pOutValue5 = NULL;
- xsd__float * pOutValue6 = NULL;
- xsd__double * pOutValue7 = NULL;
- xsd__boolean * pOutValue8 = NULL;
- xsd__byte * pOutValue9 = NULL;
+ xsd__int outValue2;
+ xsd__long outValue3;
+ xsd__short outValue4;
+ xsd__decimal outValue5;
+ xsd__float outValue6;
+ xsd__double outValue7;
+ xsd__boolean outValue8;
+ xsd__byte outValue9;
ws.get(&OutValue0,
&pOutValue1,
- &pOutValue2,
- &pOutValue3,
- &pOutValue4,
- &pOutValue5,
- &pOutValue6,
- &pOutValue7,
- &pOutValue8,
- &pOutValue9);
+ &outValue2,
+ &outValue3,
+ &outValue4,
+ &outValue5,
+ &outValue6,
+ &outValue7,
+ &outValue8,
+ &outValue9);
char sInteger[128], sLong[128];
-#ifdef WIN32
- sprintf(sInteger,"%I64d",*pOutValue1);
- sprintf(sLong,"%I64d",*pOutValue3);
-#else
- sprintf(sInteger,"%lld",*pOutValue1);
- sprintf(sLong,"%lld",*pOutValue3);
-#endif
- const char *sBool = (*pOutValue8==false_)?"false":"true";
+
+ const char *sBool = (outValue8==false_)?"false":"true";
cout << OutValue0 << endl;
- cout << sInteger << endl;
- cout << *pOutValue2 << endl;
- cout << sLong << endl;
- cout << *pOutValue4 << endl;
- cout << *pOutValue5 << endl;
- cout << *pOutValue6 << endl;
- cout << *pOutValue7 << endl;
+ cout << *pOutValue1 << endl;
+ cout << outValue2 << endl;
+ cout << outValue3 << endl;
+ cout << outValue4 << endl;
+ cout << outValue5 << endl;
+ cout << outValue6 << endl;
+ cout << outValue7 << endl;
cout << sBool << endl;
#ifdef __OS400__
- if (*pOutValue9 == 0x41) // Ascii 'A'
- *pOutValue9 = 'A'; // Set to ebcdic A
+ if (outValue9 == 0x41) // Ascii 'A'
+ outValue9 = 'A'; // Set to ebcdic A
#endif
- cout << *pOutValue9 << endl;
+ cout << outValue9 << endl;
+
+ delete [] OutValue0;
+ delete pOutValue1;
+
bSuccess = true;
}
catch(AxisException& e)