You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2006/02/01 12:04:35 UTC
svn commit: r374043 - in /webservices/axis/trunk/c: src/common/ArrayBean.cpp
tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
tests/auto_build/testcases/output/InteropTestRound1_ServerResponse.expected
Author: prestonf
Date: Wed Feb 1 03:04:28 2006
New Revision: 374043
URL: http://svn.apache.org/viewcvs?rev=374043&view=rev
Log:
Upgrades for RPC.
Modified:
webservices/axis/trunk/c/src/common/ArrayBean.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
webservices/axis/trunk/c/tests/auto_build/testcases/output/InteropTestRound1_ServerResponse.expected
Modified: webservices/axis/trunk/c/src/common/ArrayBean.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/src/common/ArrayBean.cpp?rev=374043&r1=374042&r2=374043&view=diff
==============================================================================
--- webservices/axis/trunk/c/src/common/ArrayBean.cpp (original)
+++ webservices/axis/trunk/c/src/common/ArrayBean.cpp Wed Feb 1 03:04:28 2006
@@ -226,9 +226,10 @@
// outer element for the type. Also the type information is not
// added to the outer element as this object is part of an array
// (serialize function knows that when the 3rd parameter is 'true'.
- for (int x=0; x<m_nSize; x++)
+ for( int x = 0; x < m_nSize; x++)
{
- pItem = ptrval+x*itemsize;
+ pItem = ptrval[x];
+
TRACE_SERIALIZE_FUNCT_ENTRY(m_value.cta->pSZFunct, pItem, &pSZ, true);
int stat = AXIS_FAIL;
stat = m_value.cta->pSZFunct(pItem, &pSZ, true);
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp?rev=374043&r1=374042&r2=374043&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp Wed Feb 1 03:04:28 2006
@@ -16,6 +16,7 @@
// InteropBaseClient.cpp : Defines the entry point for the console application.
//
#include <string>
+#include <iostream>
using namespace std;
#include "InteropTestPortType.hpp"
@@ -23,223 +24,351 @@
#define ARRAYSIZE 2
-int main(int argc, char* argv[])
+int main( int argc, char * argv[])
{
- int x;
- char buffer1[100];
- char buffer2[100];
- char endpoint[256];
- const char* server="localhost";
- const char* port="80";
- sprintf(endpoint, "http://%s:%s/axis/InteropBase", server, port);
-
- if (argc > 1)
- strcpy(endpoint, argv[1]);
-
+ char buffer1[100];
+ char buffer2[100];
+ char endpoint[256];
- bool bSuccess = false;
- int iRetryIterationCount = 3;
+ if( argc > 1)
+ {
+ strcpy( endpoint, argv[1]);
+ }
+ else
+ {
+ const char * server = "localhost";
+ const char * port = "80";
+
+ sprintf( endpoint, "http://%s:%s/axis/InteropBase", server, port);
+ }
+
+ bool bSuccess = false;
+ int iRetryIterationCount = 3;
- do
- {
- try
+ do
+ {
+ try
{
- InteropTestPortType ws(endpoint, APTHTTP1_1);
+ InteropTestPortType ws( endpoint, APTHTTP1_1);
+ ws.setTransportTimeout( 5);
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoString");
+
+ cout << "invoking echoString..." << endl;
+//testing echoString
+
+ string bigString;
+
+ for (int ii = 0; ii < 2; ii++)
+ {
+ bigString += "hello world ";
+ }
+
+ strcpy( buffer1, bigString.c_str());
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoString");
+
+ cout << ws.echoString( buffer1) << endl;
+
+ if( 0 == strcmp( ws.echoString( "hello world"), "hello world"))
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
+
+// testing echoStringArray
+ xsd__string_Array arrstr;
+ xsd__string * sToSend = new xsd__string[ARRAYSIZE];
+
+ sprintf( buffer1, "%dth element of string array", 0);
+ sprintf( buffer2, "%dst element of string array", 1);
+
+ sToSend[0]= buffer1;
+ sToSend[1]= buffer2;
+
+ arrstr.set( sToSend, ARRAYSIZE);
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoStringArray");
+
+ cout << "invoking echoStringArray..." << endl;
+
+ int outputSize = 0;
+ xsd__string_Array * outPutStrArray = ws.echoStringArray( &arrstr);
+
+ if( outPutStrArray != NULL &&
+ outPutStrArray->get( outputSize) != NULL &&
+ outputSize == ARRAYSIZE)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed: outputsize=" << outputSize << endl;
+ }
+
+// testing echoInteger
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoInteger");
+
+ cout << "invoking echoInteger..." << endl;
+
+ if( ws.echoInteger( 56) == 56)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
- ws.setTransportTimeout(5);
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoString");
- printf("invoking echoString...\n");
- //testing echoString
- string bigstring;
- for (int ii=0;ii<2;ii++)
- {
- bigstring += "hello world ";
- }
- strcpy(buffer1, bigstring.c_str());
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoString");
- printf(ws.echoString(buffer1));
- if (0 == strcmp(ws.echoString("hello world"), "hello world"))
- printf("successful\n");
- else
- printf("failed\n");
- // testing echoStringArray
- xsd__string_Array arrstr;
- xsd__string* sToSend = new xsd__string[ARRAYSIZE];
- sprintf(buffer1, "%dth element of string array", 0);
- sprintf(buffer2, "%dst element of string array", 1);
- sToSend[0]= buffer1;
- sToSend[1]= buffer2;
-
- arrstr.set(sToSend, ARRAYSIZE);
-
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoStringArray");
- printf("invoking echoStringArray...\n");
- int outputSize = 0;
- xsd__string_Array* outPutStrArray = ws.echoStringArray(&arrstr);
- if (outPutStrArray != NULL && outPutStrArray->get(outputSize) != NULL && outputSize == ARRAYSIZE)
- printf("successful\n");
- else
- printf("failed: outputsize=%d\n", outputSize);
- // testing echoInteger
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoInteger");
- printf("invoking echoInteger...\n");
- if (ws.echoInteger(56) == 56)
- printf("successful\n");
- else
- printf("failed\n");
// testing echoIntegerArray
- xsd__int_Array arrint;
- xsd__int ** iToSend = new xsd__int*[ARRAYSIZE];
+ xsd__int_Array arrint;
+ xsd__int ** iToSend = new xsd__int*[ARRAYSIZE];
- for (x=0;x<ARRAYSIZE;x++)
- {
- iToSend[x] = new xsd__int(x);
- }
- arrint.set(iToSend,ARRAYSIZE);
+ for( int x = 0; x < ARRAYSIZE; x++)
+ {
+ iToSend[x] = new xsd__int(x);
+ }
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoIntegerArray");
- printf("invoking echoIntegerArray...\n");
- outputSize = 0;
- xsd__int_Array* outPutIntArray = ws.echoIntegerArray(&arrint);
- if (outPutIntArray != NULL && outPutIntArray->get(outputSize) != NULL && outputSize == ARRAYSIZE)
- printf("successful\n");
- else
- printf("failed: outputsize=%d\n", outputSize);
+ arrint.set( iToSend, ARRAYSIZE);
+
+ ws.setTransportProperty( "SOAPAction" , "InteropBase#echoIntegerArray");
+
+ cout << "invoking echoIntegerArray..." << endl;
+
+ outputSize = 0;
+
+ xsd__int_Array * outPutIntArray = ws.echoIntegerArray( &arrint);
+
+ if( outPutIntArray != NULL &&
+ outPutIntArray->get( outputSize) != NULL &&
+ outputSize == ARRAYSIZE)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed: outputsize=" << outputSize << endl;
+ }
// testing echoFloat
- printf("invoking echoFloat...\n");
- float fvalue = 1.4214;
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoFloat");
- if (ws.echoFloat(fvalue) > 1.42)
- printf("successful\n");
- else
- printf("failed\n");
+ cout << "invoking echoFloat..." << endl;
+
+ float fvalue = (float) 1.4214;
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoFloat");
+
+ if( ws.echoFloat( fvalue) > (xsd__float) 1.42)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
+
// testing echoFloatArray
- xsd__float_Array arrfloat;
- xsd__float** fToSend = new xsd__float*[ARRAYSIZE];
- for (x=0;x<ARRAYSIZE;x++)
- {
- fToSend[x] = new xsd__float(1.1111*x);
- }
- arrfloat.set(fToSend, ARRAYSIZE);
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoFloatArray");
- printf("invoking echoFloatArray...\n");
- outputSize = 0;
- xsd__float_Array* outPutFloatArray = ws.echoFloatArray(&arrfloat);
- if (outPutFloatArray != NULL && outPutFloatArray->get(outputSize) != NULL && outputSize == ARRAYSIZE)
- printf("successful\n");
- else
- printf("failed: outputsize=%d\n", outputSize);
+ xsd__float_Array arrfloat;
+ xsd__float ** fToSend = new xsd__float*[ARRAYSIZE];
+
+ for( int x = 0; x < ARRAYSIZE; x++)
+ {
+ fToSend[x] = new xsd__float( (xsd__float) 1.1111 * (xsd__float) x);
+ }
+
+ arrfloat.set( fToSend, ARRAYSIZE);
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoFloatArray");
+
+ cout << "invoking echoFloatArray..." << endl;
+
+ outputSize = 0;
+
+ xsd__float_Array * outPutFloatArray = ws.echoFloatArray( &arrfloat);
+
+ if( outPutFloatArray != NULL &&
+ outPutFloatArray->get( outputSize) != NULL &&
+ outputSize == ARRAYSIZE)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed: outputsize=" << outputSize << endl;
+ }
// testing echo Struct
- SOAPStruct stct;
- stct.varFloat = new float;
- stct.varInt = new int;
- *(stct.varFloat) = 12345.7346345;
- *(stct.varInt) = 5000;
- stct.varString = strdup("This is string in SOAPStruct");
- printf("invoking echoStruct...\n");
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoStruct");
- if (ws.echoStruct(&stct) != NULL)
- printf("successful\n");
- else
- printf("failed\n");
+ SOAPStruct stct;
+
+ stct.varFloat = new float;
+ stct.varInt = new int;
+
+ *(stct.varFloat) = (xsd__float) 12345.7346345;
+ *(stct.varInt) = 5000;
+
+ stct.varString = strdup( "This is string in SOAPStruct");
+
+ cout << "invoking echoStruct..." << endl;
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoStruct");
+
+ if( ws.echoStruct( &stct) != NULL)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
+
//testing echo Array of Struct
- SOAPStruct_Array arrstct;
- SOAPStruct** m_Array4 = new SOAPStruct *[ARRAYSIZE];
+ SOAPStruct_Array arrstct;
+ SOAPStruct ** m_Array4 = new SOAPStruct *[ARRAYSIZE];
+ SOAPStruct ssToSend[ARRAYSIZE];
+ xsd__float myFloat;
- SOAPStruct ssToSend[ARRAYSIZE];
- for (x=0;x<ARRAYSIZE;x++)
- {
- ssToSend[x].varFloat = new float;
- ssToSend[x].varInt = new int;
- *(ssToSend[x].varFloat) = 1.1111*x;
- *(ssToSend[x].varInt) = x;
- sprintf(buffer1, "varString of %dth element of SOAPStruct array", x);
- ssToSend[x].varString = buffer1;
+ for( int x = 0; x < ARRAYSIZE; x++)
+ {
+ myFloat = (xsd__float) (1.1111 * x);
- m_Array4[x] = &ssToSend[x];
- }
+ ssToSend[x].setvarFloat( &myFloat);
+ ssToSend[x].setvarInt( &x);
+
+ sprintf( buffer1, "varString of %dth element of SOAPStruct array", x);
+
+ ssToSend[x].setvarString( buffer1);
+
+ m_Array4[x] = &ssToSend[x];
+ }
+
+ arrstct.set( m_Array4, ARRAYSIZE);
- arrstct.set(m_Array4, ARRAYSIZE);
//testing echo Struct Array
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoStructArray");
- printf("invoking echoStructArray...\n");
- outputSize = 0;
- SOAPStruct_Array* outPutStructArray = ws.echoStructArray(&arrstct);
- if (outPutStructArray != NULL && outPutStructArray->get(outputSize) != NULL && outputSize == ARRAYSIZE)
- printf("successful\n");
- else
- printf("failed: outputsize=%d\n", outputSize);
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoStructArray");
+
+ cout << "invoking echoStructArray..." << endl;
+
+ outputSize = 0;
+
+ SOAPStruct_Array * outPutStructArray = ws.echoStructArray( &arrstct);
+
+ if( outPutStructArray != NULL &&
+ outPutStructArray->get( outputSize) != NULL &&
+ outputSize == ARRAYSIZE)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed: outputsize=" << outputSize << endl;
+ }
//testing echo void
- printf("invoking echoVoid...\n");
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoVoid");
- ws.echoVoid();
- printf("successful\n");
+ cout << "invoking echoVoid..." << endl;
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoVoid");
+ ws.echoVoid();
+
+ cout << "successful" << endl;
+
//testing echo base 64 binary
+ const char * bstr = stringToAscii( "some string that is sent encoded to either base64Binary or hexBinary");
+ xsd__base64Binary bb;
- const char* bstr = stringToAscii("some string that is sent encoded to either base64Binary or hexBinary");
+ cout << "invoking echoBase64..." << endl;
- printf("invoking echoBase64...\n");
- xsd__base64Binary bb;
- bb.set((unsigned char *) strdup(bstr), strlen(bstr));
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoBase64");
- xsd__base64Binary bbResult = ws.echoBase64(bb);
- xsd__int size = 0;
- const xsd__unsignedByte * data = bbResult.get(size);
- if (bb.getSize() == size)
- {
- printf("successful\n");
- printf("Returned String :\n%s\n", asciiToString((char *)data));
- }
- else
- printf("failed\n");
+ bb.set( (unsigned char *) strdup( bstr), (xsd__int) strlen( bstr));
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoBase64");
+
+ xsd__base64Binary bbResult = ws.echoBase64( bb);
+ xsd__int size = 0;
+ const xsd__unsignedByte * data = bbResult.get( size);
+
+ if( bb.getSize() == size)
+ {
+ cout << "successful" << endl;
+ cout << "Returned String :" << endl << asciiToString( (char *) data) << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
+
+ time_t timeToTest = 1100246323;
+ struct tm * temp = gmtime( &timeToTest);
+ struct tm time;
+
+ memcpy( &time, temp, sizeof( struct tm));
+
+ cout << "invoking echoDate..." << endl;
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoDate");
+
+ xsd__dateTime ed_temp = ws.echoDate( time);
+
+ if( memcmp( &ed_temp, &time, sizeof( struct tm)) == 0)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
- time_t timeToTest = 1100246323;
- struct tm *temp = gmtime(&timeToTest);
- struct tm time;
- memcpy(&time, temp, sizeof(struct tm));
-
- printf("invoking echoDate...\n");
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoDate");
-
- xsd__dateTime ed_temp = ws.echoDate(time);
- if (memcmp(&ed_temp, &time, sizeof(tm)) == 0)
- printf("successful\n");
- else
- printf("failed\n");
//testing echo hex binary
+ cout << "invoking echoHexBinary..." << endl;
+
+ xsd__hexBinary hb;
+
+ hb.set( (unsigned char *) strdup( bstr), (xsd__int) strlen( bstr));
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoHexBinary");
+
+ xsd__hexBinary hbResult = ws.echoHexBinary( hb);
+
+ size = 0;
+ data = hbResult.get( size);
+
+ if( hb.getSize() == size)
+ {
+ cout << "successful" << endl;
+ cout << "Returned String :" << endl << asciiToString( (char *) data) << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
- printf("invoking echoHexBinary...\n");
- xsd__hexBinary hb;
- hb.set((unsigned char*)strdup(bstr), strlen(bstr));
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoHexBinary");
- xsd__hexBinary hbResult = ws.echoHexBinary(hb);
- size = 0;
- data = hbResult.get(size);
- if (hb.getSize() == size)
- {
- printf("successful\n");
- printf("Returned String :\n%s\n", asciiToString((char *)data));
- }
- else
- printf("failed\n");
//testing echo decimal
- printf("invoking echoDecimal...\n");
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoDecimal");
- if (ws.echoDecimal(1234.567890) > 1234.56)
- printf("successful\n");
- else
- printf("failed\n");
+ cout << "invoking echoDecimal..." << endl;
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoDecimal");
+
+ if( ws.echoDecimal( 1234.567890) > 1234.56)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
+
//testing echo boolean
- printf("invoking echoBoolean...\n");
- ws.setTransportProperty("SOAPAction" , "InteropBase#echoBoolean");
- if (ws.echoBoolean(true_) == true_)
- printf("successful\n");
- else
- printf("failed\n");
+ cout << "invoking echoBoolean..." << endl;
+
+ ws.setTransportProperty( "SOAPAction", "InteropBase#echoBoolean");
+
+ if( ws.echoBoolean(true_) == true_)
+ {
+ cout << "successful" << endl;
+ }
+ else
+ {
+ cout << "failed" << endl;
+ }
bSuccess = true;
}
@@ -249,7 +378,7 @@
if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
{
- if( iRetryIterationCount > 0)
+ if( iRetryIterationCount > 1)
{
bSilent = true;
}
Modified: webservices/axis/trunk/c/tests/auto_build/testcases/output/InteropTestRound1_ServerResponse.expected
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/output/InteropTestRound1_ServerResponse.expected?rev=374043&r1=374042&r2=374043&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/output/InteropTestRound1_ServerResponse.expected (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/output/InteropTestRound1_ServerResponse.expected Wed Feb 1 03:04:28 2006
@@ -137,10 +137,12 @@
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:echoStructResponse xmlns:ns1="http://soapinterop.org/">
-<SOAPStruct xsi:type="ns2:SOAPStruct" xmlns:ns2="http://soapinterop.org/xsd"><varString xsi:type="xsd:string">This is string in SOAPStruct</varString>
+<return xsi:type="ns2:SOAPStruct" xmlns:ns2="http://soapinterop.org/xsd">
+<varString xsi:type="xsd:string">This is string in SOAPStruct</varString>
<varInt xsi:type="xsd:int">5000</varInt>
<varFloat xsi:type="xsd:float">12345.734375</varFloat>
-</SOAPStruct></ns1:echoStructResponse>
+</return>
+</ns1:echoStructResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>
0
@@ -156,14 +158,18 @@
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<SOAP-ENV:Body>
<ns1:echoStructArrayResponse xmlns:ns1="http://soapinterop.org/">
-<echoStructArrayReturnArray xmlns:enc="http://www.w3.org/2001/06/soap-encoding" xmlns:ns2="http://soapinterop.org/xsd" enc:arrayType="ns2:echoStructArrayReturn[2]">
-<SOAPStruct><varString xsi:type="xsd:string">varString of 1th element of SOAPStruct array</varString>
+<return xmlns:enc="http://www.w3.org/2001/06/soap-encoding" xmlns:ns2="http://soapinterop.org/xsd" enc:arrayType="ns2:echoStructArrayReturn[2]">
+<SOAPStruct>
+<varString xsi:type="xsd:string">varString of 1th element of SOAPStruct array</varString>
<varInt xsi:type="xsd:int">0</varInt>
<varFloat xsi:type="xsd:float">0.000000</varFloat>
-</SOAPStruct><SOAPStruct><varString xsi:type="xsd:string">varString of 1th element of SOAPStruct array</varString>
+</SOAPStruct>
+<SOAPStruct>
+<varString xsi:type="xsd:string">varString of 1th element of SOAPStruct array</varString>
<varInt xsi:type="xsd:int">1</varInt>
<varFloat xsi:type="xsd:float">1.111100</varFloat>
-</SOAPStruct></echoStructArrayReturnArray>
+</SOAPStruct>
+</return>
</ns1:echoStructArrayResponse>
</SOAP-ENV:Body>
</SOAP-ENV:Envelope>