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 du...@apache.org on 2005/05/18 07:44:55 UTC
cvs commit: ws-axis/c/tests/auto_build/testcases/wsdls RPCAllTest.wsdl
dushshantha 2005/05/17 22:44:55
Modified: c/tests/auto_build/testcases/client/cpp
BasicAllTestClient.cpp CombinedAllTestClient.cpp
InteropTestRound1Client.cpp
LimitedAllTestlClient.cpp
Added: c/tests/auto_build/testcases/client/cpp RPCAllTestClient.cpp
c/tests/auto_build/testcases/output RPCAll.expected
c/tests/auto_build/testcases/server/cpp ADEC_MAST_Port.cpp
c/tests/auto_build/testcases/tests RPCAll.xml
c/tests/auto_build/testcases/tests/server RPCAll.xml
c/tests/auto_build/testcases/wsdls RPCAllTest.wsdl
Log:
Add a test for test frame work to test 'all' construct in RPC style. And made some modifications to the some client files due to fix for AXISCPP-652.
Revision Changes Path
1.2 +4 -5 ws-axis/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp
Index: BasicAllTestClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/BasicAllTestClient.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- BasicAllTestClient.cpp 16 May 2005 05:18:42 -0000 1.1
+++ BasicAllTestClient.cpp 18 May 2005 05:44:55 -0000 1.2
@@ -48,22 +48,21 @@
AllTestSoap ws (endpoint, APTHTTP1_1);
AllComplexType* inParam = new AllComplexType();
-
- inParam->IntValue = 5;
+ inParam->IntValue = new int;
+ *(inParam->IntValue) = 5;
inParam->StringValue = "HELLO";
printf("\nSending.................");
- printf("\nIntValue = %d",inParam->IntValue);
+ printf("\nIntValue = %d",*(inParam->IntValue));
printf("\nStringValue= %s",inParam->StringValue);
-
ws.setTransportProperty("SOAPAction" , "BasicAll#echoAll");
AllComplexType* outParam = ws.echoAll(inParam);
if (outParam != NULL)
{
printf("\n\nReceived................");
- printf("\nIntValue = %d",outParam->IntValue);
+ printf("\nIntValue = %d",*(outParam->IntValue));
printf("\nStringValue= %s",outParam->StringValue);
printf("\n\nSuccessfull\n");
}
1.2 +4 -3 ws-axis/c/tests/auto_build/testcases/client/cpp/CombinedAllTestClient.cpp
Index: CombinedAllTestClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/CombinedAllTestClient.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- CombinedAllTestClient.cpp 16 May 2005 05:18:42 -0000 1.1
+++ CombinedAllTestClient.cpp 18 May 2005 05:44:55 -0000 1.2
@@ -49,13 +49,14 @@
AllComplexType* inParam = new AllComplexType();
inParam->NonAllIntValue = 3;
- inParam->Value0 = 5;
+ inParam->Value0 = new int;
+ *(inParam->Value0) = 5;
inParam->Value2 = "TINTIN";
inParam->NonAllStringValue = "HELLO";
printf("\nSending.................");
printf("\nNonAllIntValue = %d",inParam->NonAllIntValue);
- printf("\nAllValue0 = %d",inParam->Value0);
+ printf("\nAllValue0 = %d",*(inParam->Value0));
printf("\nAllValue2 = %s",inParam->Value2);
printf("\nNonAllStringValue = %s",inParam->NonAllStringValue);
@@ -66,7 +67,7 @@
{
printf("\n\nReceived................");
printf("\nNonAllIntValue = %d",outParam->NonAllIntValue);
- printf("\nAllValue0 = %d",outParam->Value0);
+ printf("\nAllValue0 = %d",*(outParam->Value0));
printf("\nAllValue2 = %s",outParam->Value2);
printf("\nNonAllStringValue = %s",outParam->NonAllStringValue);
printf("\n\nSuccessfull\n");
1.9 +27 -10 ws-axis/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp
Index: InteropTestRound1Client.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/InteropTestRound1Client.cpp,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -r1.8 -r1.9
--- InteropTestRound1Client.cpp 5 Apr 2005 04:54:24 -0000 1.8
+++ InteropTestRound1Client.cpp 18 May 2005 05:44:55 -0000 1.9
@@ -29,14 +29,13 @@
char endpoint[256];
const char* server="localhost";
const char* port="80";
- sprintf(endpoint, "http://%s:%s/axis/base", server, port);
-
- // Set the endpoint from command line argument if set
+ sprintf(endpoint, "http://%s:%s/axis/InteropBase", server, port);
+
if (argc > 1)
strcpy(endpoint, argv[1]);
-
- bool bSuccess = false;
+
+ bool bSuccess = false;
int iRetryIterationCount = 3;
do
@@ -47,7 +46,7 @@
ws.setTransportTimeout(5);
-
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoString");
printf("invoking echoString...\n");
//testing echoString
string bigstring;
@@ -56,6 +55,7 @@
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");
@@ -72,12 +72,14 @@
arrstr.m_Array[i] = buffer1;
}
//arrstr.m_Array[1] = buffer2;
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoStringArray");
printf("invoking echoStringArray...\n");
if (ws.echoStringArray(arrstr).m_Array != NULL)
printf("successful\n");
else
printf("failed\n");
// testing echoInteger
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoInteger");
printf("invoking echoInteger...\n");
if (ws.echoInteger(56) == 56)
printf("successful\n");
@@ -94,6 +96,7 @@
iToSend[x] = x;
arrint.m_Array[x] = &iToSend[x];
}
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoIntegerArray");
printf("invoking echoIntegerArray...\n");
if (ws.echoIntegerArray(arrint).m_Array != NULL)
printf("successful\n");
@@ -102,6 +105,7 @@
// 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
@@ -116,6 +120,7 @@
fToSend[x] = 1.1111*x;
arrfloat.m_Array[x] = &fToSend[x];
}
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoFloatArray");
printf("invoking echoFloatArray...\n");
if (ws.echoFloatArray(arrfloat).m_Array != NULL)
printf("successful\n");
@@ -123,10 +128,13 @@
printf("failed\n");
// testing echo Struct
SOAPStruct stct;
- stct.varFloat = 12345.7346345;
- stct.varInt = 5000;
+ 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
@@ -137,12 +145,15 @@
arrstct.m_Size = ARRAYSIZE;
for (x=0;x<ARRAYSIZE;x++)
{
- arrstct.m_Array[x].varFloat = 1.1111*x;
- arrstct.m_Array[x].varInt = x;
+ arrstct.m_Array[x].varFloat = new float;
+ arrstct.m_Array[x].varInt = new int;
+ *(arrstct.m_Array[x].varFloat) = 1.1111*x;
+ *(arrstct.m_Array[x].varInt) = x;
sprintf(buffer1, "varString of %dth element of SOAPStruct array", x);
arrstct.m_Array[x].varString = buffer1;
}
//testing echo Struct Array
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoStructArray");
printf("invoking echoStructArray...\n");
if (ws.echoStructArray(arrstct).m_Array != NULL)
printf("successful\n");
@@ -150,6 +161,7 @@
printf("failed\n");
//testing echo void
printf("invoking echoVoid...\n");
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoVoid");
ws.echoVoid();
printf("successful\n");
//testing echo base 64 binary
@@ -160,6 +172,7 @@
xsd__base64Binary bb;
bb.__ptr = (unsigned char*)strdup(bstr);
bb.__size = strlen(bstr);
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoBase64");
if (bb.__size == ws.echoBase64(bb).__size)
{
printf("successful\n");
@@ -172,6 +185,7 @@
time(&tim);
tm* lt = gmtime(&tim);
printf("invoking echoDate...\n");
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoDate");
if (memcmp(&ws.echoDate(*lt), lt, sizeof(tm)) == 0)
printf("successful\n");
else
@@ -182,6 +196,7 @@
xsd__hexBinary hb;
hb.__ptr = (unsigned char*)strdup(bstr);
hb.__size = strlen(bstr);
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoHexBinary");
if (hb.__size == ws.echoHexBinary(hb).__size)
{
printf("successful\n");
@@ -191,12 +206,14 @@
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");
//testing echo boolean
printf("invoking echoBoolean...\n");
+ ws.setTransportProperty("SOAPAction" , "InteropBase#echoBoolean");
if (ws.echoBoolean(true_) == true_)
printf("successful\n");
else
1.2 +5 -4 ws-axis/c/tests/auto_build/testcases/client/cpp/LimitedAllTestlClient.cpp
Index: LimitedAllTestlClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/LimitedAllTestlClient.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- LimitedAllTestlClient.cpp 16 May 2005 05:18:42 -0000 1.1
+++ LimitedAllTestlClient.cpp 18 May 2005 05:44:55 -0000 1.2
@@ -49,20 +49,21 @@
AllComplexType* inParam = new AllComplexType();
- inParam->Value0 = 5;
+ inParam->Value0 = new int;
+ *(inParam->Value0) = 5;
inParam->Value2 = "HELLO";
printf("\nSending.................");
- printf("\nValue0 = %d",inParam->Value0);
+ printf("\nValue0 = %d",*(inParam->Value0));
printf("\nValue2 = %s",inParam->Value2);
- ws.setTransportProperty("SOAPAction" , "LimitedAll#echoAll");
+ ws.setTransportProperty("SOAPAction" , "AllComplexType#echoAll");
AllComplexType* outParam = ws.echoAll(inParam);
if (outParam != NULL)
{
printf("\n\nReceived................");
- printf("\nValue0 = %d",outParam->Value0);
+ printf("\nValue0 = %d",*(outParam->Value0));
printf("\nValue2 = %s",outParam->Value2);
printf("\n\nSuccessfull\n");
}
1.1 ws-axis/c/tests/auto_build/testcases/client/cpp/RPCAllTestClient.cpp
Index: RPCAllTestClient.cpp
===================================================================
#include "ADEC_MAST_Port.hpp"
#include "SummaryResult.hpp"
#include <iostream>
#include <axis/AxisException.hpp>
#include <ctype.h>
#define WSDL_DEFAULT_ENDPOINT "http://localhost:80/axis/RPCAll"
void PrintUsage();
static void
usage (char *programName, char *defaultURL)
{
cout << "\nUsage:\n"
<< programName << " [-? | service_url] " << endl
<< " -? Show this help.\n"
<< " service_url URL of the service.\n"
<< " Default service URL is assumed to be " << defaultURL << endl;
}
int
main (int argc, char *argv[])
{
char endpoint[256];
sprintf (endpoint, "%s", WSDL_DEFAULT_ENDPOINT);
int returnValue = 1; // Assume Failure
if (argc > 1)
{
// Watch for special case help request
if (!strncmp (argv[1], "-", 1)) // Check for - only so that it works for
//-?, -h or --help; -anything
{
usage (argv[0], endpoint);
return 2;
}
sprintf (endpoint, argv[1]);
}
bool bSuccess = false;
int iRetryIterationCount = 3;
do
{
try
{
ADEC_MAST_Port ws (endpoint, APTHTTP1_1);
SummaryResult* outParam = new SummaryResult();
xsd__string Value0 = "RED";
xsd__int Value1 = 3;
xsd__int Value3 = 5;
xsd__double Value2 = 2.5;
printf("\nSending................\n");
printf("\nLength = %d",Value1);
printf("\nWidth = %d",Value3);
printf("\nDepth = %f",Value2);
printf("\nColor = %s",Value0);
ws.setTransportProperty("SOAPAction" , "RPCAll#doGetSummary");
outParam = ws.doGetSummary(Value0, Value1, Value2, Value3);
if (outParam != NULL)
{
printf("\n\nReceived................\n");
printf("\nNon All Int Value = %d",outParam->NonAllIntValue);
printf("\nNon All Double Value = %f",outParam->NonAllDoubleValue);
printf("\n\nAll Values are...");
printf("\n\tLength = %d",*(outParam->length));
printf("\n\tDepth = %f",*(outParam->depth));
printf("\n\tColor = %s",outParam->color);
printf("\n\nNon All String Value = %s\n\n",outParam->NonAllStringValue);
}
else
printf("\n\nFault\n");
bSuccess = true;
delete outParam;
}
catch (AxisException & e)
{
bool bSilent = false;
if (e.getExceptionCode () ==
CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
{
if (iRetryIterationCount > 0)
{
bSilent = true;
}
}
else
{
iRetryIterationCount = 0;
}
if (!bSilent)
{
printf ("%s\n", e.what ());
}
}
catch (exception & e)
{
printf ("%s\n", e.what ());
}
catch (...)
{
cerr << "Unknown Exception occured." << endl;
}
iRetryIterationCount--;
}while (iRetryIterationCount > 0 && !bSuccess);
cout <<
"---------------------- TEST COMPLETE -----------------------------"
<< endl;
return returnValue;
}
1.1 ws-axis/c/tests/auto_build/testcases/output/RPCAll.expected
Index: RPCAll.expected
===================================================================
Sending................
Length = 3
Width = 5
Depth = 2.500000
Color = RED
Received................
Non All Int Value = 15
Non All Double Value = 37.500000
All Values are...
Length = 3
Depth = 2.500000
Color = RED
Non All String Value = Success
---------------------- TEST COMPLETE -----------------------------
1.1 ws-axis/c/tests/auto_build/testcases/server/cpp/ADEC_MAST_Port.cpp
Index: ADEC_MAST_Port.cpp
===================================================================
/*
* 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 "ADEC_MAST_Port.hpp"
ADEC_MAST_Port::ADEC_MAST_Port()
{
}
ADEC_MAST_Port::~ADEC_MAST_Port()
{
}
/* 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 ADEC_MAST_Port::onFault()
{
}
/* This function is called by the AxisEngine when this web service
library is first loaded. So here we can initialize any global/static
data structures of this web service or open database connections */
void ADEC_MAST_Port::init()
{
}
/* This function is called by the AxisEngine when this web service
library is unloaded. So we can deallocate any global/static data structures
and close database connections etc here. */
void ADEC_MAST_Port::fini()
{
}
SummaryResult* ADEC_MAST_Port::doGetSummary(xsd__string Value0, xsd__int Value1, xsd__double Value2, xsd__int Value3)
{
SummaryResult* outParam = new SummaryResult();
int square = 0;
double cal = 0;
square = (Value1 * Value3);
cal = (Value1 * Value2 * Value3);
outParam->NonAllIntValue = square;
outParam->NonAllDoubleValue = cal;
outParam->length = Value1;
outParam->depth = Value2;
outParam->color = Value0;
if(cal != 0)
outParam->NonAllStringValue = "Success";
else
outParam->NonAllStringValue = "Failed";
return outParam;
}
1.1 ws-axis/c/tests/auto_build/testcases/tests/RPCAll.xml
Index: RPCAll.xml
===================================================================
<test>
<name>RPCAll</name>
<description>RPCAllTest</description>
<clientLang>cpp</clientLang>
<clientCode>RPCAllTestClient.cpp</clientCode>
<wsdl>RPCAllTest.wsdl</wsdl>
<expected>
<output>
RPCAll.expected
</output>
</expected>
<endpoint>http://localhost:80/axis/RPCAll</endpoint>
</test>
1.1 ws-axis/c/tests/auto_build/testcases/tests/server/RPCAll.xml
Index: RPCAll.xml
===================================================================
<service>
<name>RPCAll</name>
<description>RPCAllTest</description>
<serviceLang>cpp</serviceLang>
<serviceCode>ADEC_MAST_Port.cpp</serviceCode>
<wsdl>RPCAllTest.wsdl</wsdl>
<servicename></servicename>
</service>
1.1 ws-axis/c/tests/auto_build/testcases/wsdls/RPCAllTest.wsdl
Index: RPCAllTest.wsdl
===================================================================
<?xml version="1.0"?>
<!-- WSDL description of the MAST ADEC TWIG api. -->
<definitions name="urn:ADEC_MAST"
targetNamespace="urn:ADEC_MAST"
xmlns:typens="urn:ADEC_MAST"
xmlns:xsd="http://www.w3.org/2001/XMLSchema"
xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/"
xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/"
xmlns="http://schemas.xmlsoap.org/wsdl/">
<!-- Types for search - result elements, directory categories -->
<types>
<xsd:schema xmlns="http://www.w3.org/2001/XMLSchema" targetNamespace="urn:ADEC_MAST">
<xsd:complexType name="SummaryResult">
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="NonAllIntValue" type="xsd:int" />
<xsd:element minOccurs="1" maxOccurs="1" name="NonAllDoubleValue" type="xsd:double" />
</xsd:sequence>
<xsd:all>
<xsd:element name="length" type="xsd:int"/>
<xsd:element minOccurs="0" name="width" type="xsd:int"/>
<xsd:element minOccurs="0" name="depth" type="xsd:double"/>
<xsd:element minOccurs="0" name="color" type="xsd:string"/>
</xsd:all>
<xsd:sequence>
<xsd:element minOccurs="1" maxOccurs="1" name="NonAllStringValue" type="xsd:string" />
</xsd:sequence>
</xsd:complexType>
<xsd:complexType name="SummaryResultArray">
<xsd:complexContent>
<xsd:restriction base="soapenc:Array">
<xsd:attribute ref="soapenc:arrayType" wsdl:arrayType="typens:SummaryResult[]"/>
</xsd:restriction>
</xsd:complexContent>
</xsd:complexType>
</xsd:schema>
</types>
<!-- Messages for ADEC MAST Web APIs - get summary by position. -->
<message name="doGetSummary">
<part name="length" type="xsd:int"/>
<part name="width" type="xsd:int"/>
<part name="depth" type="xsd:double"/>
<part name="color" type="xsd:string"/>
</message>
<message name="doGetSummaryResponse">
<part name="return" type="typens:SummaryResult"/>
</message>
<!-- Port for ADEC MAST Web APIs, "ADEC_MAST" -->
<portType name="ADEC_MAST_Port">
<operation name="doGetSummary">
<input message="typens:doGetSummary"/>
<output message="typens:doGetSummaryResponse"/>
</operation>
</portType>
<!-- Binding for ADEC MAST Web APIs - RPC, SOAP over HTTP -->
<binding name="ADEC_MAST_Binding" type="typens:ADEC_MAST_Port">
<soap:binding style="rpc"
transport="http://schemas.xmlsoap.org/soap/http"/>
<operation name="doGetSummary">
<soap:operation soapAction="urn:ADEC_MAST#doGetSummary"/>
<input>
<soap:body use="encoded"
namespace="urn:ADEC_MAST"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</input>
<output>
<soap:body use="encoded"
namespace="urn:ADEC_MAST"
encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"/>
</output>
</operation>
</binding>
<!-- Endpoint for ADEC MAST Web APIs -->
<service name="ADEC_MAST_Service">
<port name="ADEC_MAST_Port" binding="typens:ADEC_MAST_Binding">
<soap:address location="http://faxafloi.stsci.edu:4547/soap/"/>
</port>
</service>
</definitions>