axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From prest...@apache.org
Subject svn commit: r370145 - in /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp: SimpleArrayClient.cpp SimpleRefClient.cpp
Date Wed, 18 Jan 2006 14:00:18 GMT
Author: prestonf
Date: Wed Jan 18 06:00:14 2006
New Revision: 370145

URL: http://svn.apache.org/viewcvs?rev=370145&view=rev
Log:
Tidy of two client test apps.  No problems solved, just made code more readable.

Modified:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArrayClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleRefClient.cpp

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArrayClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArrayClient.cpp?rev=370145&r1=370144&r2=370145&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArrayClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleArrayClient.cpp Wed
Jan 18 06:00:14 2006
@@ -12,53 +12,59 @@
 
 int main(int argc, char* argv[])
 {
-	int x;
-	char endpoint[256];
-	const char* url="http://localhost:80/axis/MathOps";
-	const char* server="localhost";
-	const char* port="80";
+	int		x;
+	char *	url="http://localhost:80/axis/MathOps";
+	bool	bSuccess = false;
+	int		iRetryIterationCount = 3;
+
 	url = argv[1];
-		bool bSuccess = false;
-		int	iRetryIterationCount = 3;
 
-		do
-		{
-	try
+	do
+	{
+		try
         {
-		sprintf(endpoint, "%s", url);
-		ArrayTestPortType ws(endpoint);
-		//testing echoIntArray
-		intArrayType arrin;
-		intArrayType* arrout;
-		xsd__int_Array arrayInput;		
-        int ** array= new int*[ARRAYSIZE];		
-		for (x=0;x<ARRAYSIZE;x++)
-		{
-            array[x] = new int(x + 1000);
-			//arrin.intItem.m_Array[x] = &intArray[x];
+			ArrayTestPortType	ws( url);
+			intArrayType		arrin;
+			intArrayType *		arrout;
+			xsd__int_Array		arrayInput;
+			int **				array = new int*[ARRAYSIZE];
+
+			for( x = 0; x < ARRAYSIZE; x++)
+			{
+				array[x] = new int(x + 1000);
+			}
+
+			arrayInput.set(array,ARRAYSIZE);
+			arrin.setintItem(&arrayInput);
+
+			cout << "invoking echoIntArray..." << endl;
+
+			int		outputSize = 0;
+
+			arrout = ws.echoIntArray( &arrin);
+
+			for( x = 0; x < ARRAYSIZE; x++)
+			{
+				cout << *(arrout->intItem->get(outputSize)[x])<<endl;
+			}
+
+			// Clear up input array        
+			for( int deleteIndex = 0; deleteIndex < ARRAYSIZE; deleteIndex++)
+			{
+				delete array[deleteIndex];
+			}
+
+			delete [] array;
+
+			bSuccess = true;
 		}
-		arrayInput.set(array,ARRAYSIZE);
-		arrin.setintItem(&arrayInput);		
-		cout << "invoking echoIntArray..."<<endl;
-		int outputSize=0;
-		arrout=ws.echoIntArray(&arrin);
-		for(x=0;x<ARRAYSIZE;x++)
-		   cout << *(arrout->intItem->get(outputSize)[x])<<endl;		
-		 // Clear up input array        
-        for (int deleteIndex = 0 ; deleteIndex < ARRAYSIZE ; deleteIndex++ )
-        {
-            delete array[deleteIndex];
-        }
-        delete [] array;
-		bSuccess = true;
-	}
-        catch(AxisException& e)
+        catch( AxisException& e)
         {
 			bool bSilent = false;
 
 			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
 			{
-				if( iRetryIterationCount > 0)
+				if( iRetryIterationCount > 1)
 				{
 					bSilent = true;
 				}
@@ -70,19 +76,22 @@
 
             if( !bSilent)
 			{
-            printf("Exception : %s\n", e.what());
+	            cout << "Exception : " << e.what() << endl;
 			}
         }
-        catch(exception& e)
+        catch( exception& e)
         {
-            printf("Unknown exception has occured : %s\n", e.what());
+            cout << "Unknown exception has occurred : " << e.what() <<
endl;
         }
         catch(...)
         {
-            printf("Unknown exception has occured\n");
+            cout << "Unknown exception has occurred" << endl;
         }
+
 		iRetryIterationCount--;
-		} while( iRetryIterationCount > 0 && !bSuccess);
-	cout << "---------------------- TEST COMPLETE -----------------------------"<<
endl;
+	} while( iRetryIterationCount > 0 && !bSuccess);
+
+	cout << "---------------------- TEST COMPLETE -----------------------------" <<
endl;
+
 	return 0;
 }

Modified: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleRefClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleRefClient.cpp?rev=370145&r1=370144&r2=370145&view=diff
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleRefClient.cpp (original)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/SimpleRefClient.cpp Wed
Jan 18 06:00:14 2006
@@ -23,70 +23,96 @@
 
 #define ARRAYSIZE 2
 
-int main(int argc, char* argv[])
+int main( int argc, char * argv[])
 {
-	int x;
-	char buffer1[100];
-	char endpoint[256];
-	const char* url="http://localhost:80/axis/MathOps";
-	const char* server="localhost";
-	const char* port="80";
+	char *	url = "http://localhost:80/axis/MathOps";
+	bool	bSuccess = false;
+	int		iRetryIterationCount = 3;
+
 	url = argv[1];
-		bool bSuccess = false;
-		int	iRetryIterationCount = 3;
 
 		do
 		{
-	try
-        {
-		sprintf(endpoint, "%s", url);
-	//endpoint for Axis Java sample
-	//sprintf(endpoint, "http://%s:%s/axis/services/echo", server, port);
-	
-	RefTestPortType ws(endpoint);
-
-	printf("invoking echoInt..\n");
-	intType refint;
-  	refint.intItem =56;
-
-        if ((ws.echoInt(&refint))->intItem == 56)
-        printf("successful\n");
-        else
-        printf("failed \n");
-
-
-		bSuccess = true;
-		}
-        catch(AxisException& e)
-        {
-			bool bSilent = false;
-
-			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+			try
 			{
-				if( iRetryIterationCount > 0)
+				RefTestPortType	ws( url);
+
+				printf( "invoking echoInt..\n");
+
+				intType	refint;
+
+				refint.intItem = 56;
+
+// The webservice call returns the following message (NB: The use of the
+// unsupported 'multiRef' tag):-
+// HTTP/1.1 200 OK
+// Server: WebSphere Application Server/5.1
+// Content-Type: text/xml; charset=utf-8
+// Content-Language: en-GB
+// Transfer-Encoding: chunked
+// 
+// 2fc
+// <?xml version="1.0" encoding="utf-8"?>
+// <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/"
+//                   xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/"
+//                       xmlns:xsd="http://www.w3.org/2001/XMLSchema"
+//                       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
+// <soapenv:Header/>
+// <soapenv:Body soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/">
+// <echoIntResponse xmlns="http://soapinterop.org/">
+// <return href="#id0" xmlns=""/>
+// </echoIntResponse>
+// <multiRef id="id0" soapenc:root="0" soapenv:encodingStyle="http://schemas.xmlsoap.org/soap/encoding/"
+//                                                  xsi:type="ns-73742416:intType"
+//                                         xmlns:ns-73742416="http://soapinterop.org/xsd"
+//                                                     xmlns="">
+// <ns-73742416:intItem xsi:type="xsd:int">56</ns-73742416:intItem>
+// </multiRef>
+// </soapenv:Body>
+// </soapenv:Envelope>
+				if( (ws.echoInt( &refint))->intItem == 56)
 				{
-					bSilent = true;
+					printf( "successful\n");
 				}
+				else
+				{
+					printf( "failed \n");
+				}
+
+				bSuccess = true;
 			}
-			else
+			catch( AxisException& e)
 			{
-				iRetryIterationCount = 0;
-			}
+				bool	bSilent = false;
 
-            if( !bSilent)
+				if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+				{
+					if( iRetryIterationCount > 0)
+					{
+						bSilent = true;
+					}
+				}
+				else
+				{
+					iRetryIterationCount = 0;
+				}
+
+				if( !bSilent)
+				{
+					printf( "Exception : %s\n", e.what());
+				}
+	        }
+			catch( exception& e)
+			{
+				printf( "Unknown exception has occured : %s\n", e.what());
+			}
+			catch( ...)
 			{
-            printf("Exception : %s\n", e.what());
+				printf( "Unknown exception has occured\n");
 			}
-        }
-        catch(exception& e)
-        {
-            printf("Unknown exception has occured\n");
-        }
-        catch(...)
-        {
-            printf("Unknown exception has occured\n");
-        }
-		iRetryIterationCount--;
+
+			iRetryIterationCount--;
 		} while( iRetryIterationCount > 0 && !bSuccess);
+
 	return 0;
 }



Mime
View raw message