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 cm...@apache.org on 2005/11/25 11:48:30 UTC

svn commit: r348928 - /webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/

Author: cmanohar
Date: Fri Nov 25 02:48:05 2005
New Revision: 348928

URL: http://svn.apache.org/viewcvs?rev=348928&view=rev
Log:
Adding new tests for xsd:choice schema

Added:
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceArrayChildClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceComplexChildClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedChoiceClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedSequenceClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceSimpleClient.cpp
    webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeOptionalChoiceClient.cpp

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceArrayChildClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceArrayChildClient.cpp?rev=348928&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceArrayChildClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceArrayChildClient.cpp Fri Nov 25 02:48:05 2005
@@ -0,0 +1,207 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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.
+
+#include <axis/AxisException.hpp>
+#include "XSD_byte.hpp" 
+
+#include <stdlib.h> // For malloc(), calloc(), strdup() and free()
+#include <iostream>
+#include <fstream>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/ComplexTypeAll/services/Service"
+
+// If we re-direct cout it will be to this ofstream
+ofstream output_file;
+
+// Prototype
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
+void shift_args(int i, int *argc, char *argv[]);
+void setLogOptions(const char *output_filename);
+
+int main(int argc, char* argv[])
+{ 
+    XSD_byte* ws;
+
+  char *endpoint = WSDL_DEFAULT_ENDPOINT;
+  bool endpoint_set = false;
+  int returnValue = 1; // Assume Failure
+
+  endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+		bool bSuccess = false;
+		int	iRetryIterationCount = 3;
+
+		do
+		{
+  try {
+    if(endpoint_set) {
+      ws = new XSD_byte(endpoint);
+      free(endpoint);
+      endpoint_set = false;
+    } else
+      ws = new XSD_byte();
+
+	SimpleArray *simpleArray1 = new SimpleArray();
+	xsd__int_Array arrayIn;
+	xsd__int **array = new xsd__int*[3];
+	array[0]=new xsd__int(5);
+	array[1]=new xsd__int(6);
+	array[3]=new xsd__int(7);
+	arrayIn.set(array,3);
+	simpleArray1->setintArray(&arrayIn);	
+    SimpleComplexType1* input = new SimpleComplexType1();
+
+    input->arrayElement = simpleArray1;
+   // input->field2 = "I'm still here!";
+   // input->field3 = new xsd__int(123);
+
+    SimpleComplexType1* result = NULL;
+    result = ws->asComplexType(input);
+	int outputSize = 0;
+	const xsd__int ** arrayOut = result->arrayElement->intArray->get(outputSize);
+
+	cout << "Array Size = " << outputSize << endl; 
+
+	cout << "First element in Array =" << *arrayOut[0] << endl;
+	
+	bSuccess = true;
+
+    returnValue = 0; // Success
+
+  } catch(AxisException &e) {
+			bool bSilent = false;
+
+			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+			{
+				if( iRetryIterationCount > 0)
+				{
+					bSilent = true;
+				}
+			}
+			else
+			{
+				iRetryIterationCount = 0;
+			}
+
+            if( !bSilent)
+			{
+    cerr << e.what() << endl;
+			}
+  } catch(...) {
+    cerr << "Unknown Exception occured." << endl;
+  }
+  
+  // Samisa : clean up memory allocated for stub
+  try
+  {
+	  delete ws; 
+  }
+  catch(exception& exception)
+  {
+  	cout << "Exception on clean up of ws : " << exception.what()<<endl;
+  }
+  catch(...)
+  {
+  	cout << "Unknown exception on clean up of ws : " << endl;
+  }
+		iRetryIterationCount--;
+		} while( iRetryIterationCount > 0 && !bSuccess);
+    if(endpoint_set)
+      free(endpoint);
+  cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+  return returnValue;
+}
+
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'o':
+                setLogOptions(argv[i+1]);
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+
+void shift_args(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
+void setLogOptions(const char *output_filename) {
+    output_file.open(output_filename, ios::out);
+    if(output_file.is_open()){
+        cout.rdbuf( output_file.rdbuf() );
+    }
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceComplexChildClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceComplexChildClient.cpp?rev=348928&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceComplexChildClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceComplexChildClient.cpp Fri Nov 25 02:48:05 2005
@@ -0,0 +1,203 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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.
+
+#include <axis/AxisException.hpp>
+#include "XSD_byte.hpp" 
+
+#include <stdlib.h> // For malloc(), calloc(), strdup() and free()
+#include <iostream>
+#include <fstream>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/ComplexTypeAll/services/Service"
+
+// If we re-direct cout it will be to this ofstream
+ofstream output_file;
+
+// Prototype
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
+void shift_args(int i, int *argc, char *argv[]);
+void setLogOptions(const char *output_filename);
+
+int main(int argc, char* argv[])
+{ 
+	XSD_byte* ws;
+
+	char *endpoint = WSDL_DEFAULT_ENDPOINT;
+	bool endpoint_set = false;
+	int returnValue = 1; // Assume Failure
+
+	endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+	bool bSuccess = false;
+	int	iRetryIterationCount = 1;
+
+	do
+	{
+	 try {
+		if(endpoint_set) {
+			ws = new XSD_byte(endpoint);
+			free(endpoint);
+			 endpoint_set = false;
+		} else
+			ws = new XSD_byte();
+
+	
+	oneSimpleComplexType* onesimplecomplextype = new oneSimpleComplexType();
+	onesimplecomplextype->onecomplexTypeElement=xsd__byte(65);
+
+    SimpleComplexType* input = new SimpleComplexType();
+
+    input->complexTypeElement = onesimplecomplextype;
+    input->field2 = "I'm still here!";
+    input->field3 = new xsd__int(123);
+
+    SimpleComplexType* result = NULL;
+    result = ws->asComplexType(input);
+
+	if ( result == NULL )
+			cout << "Returned result object is NULL" << endl;
+
+    cout << "Result field1 is = " << result->complexTypeElement->onecomplexTypeElement << endl;
+	
+
+	bSuccess = true;
+
+    returnValue = 0; // Success
+
+  } catch(AxisException &e) {
+			bool bSilent = false;
+
+			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+			{
+				if( iRetryIterationCount > 0)
+				{
+					bSilent = true;
+				}
+			}
+			else
+			{
+				iRetryIterationCount = 0;
+			}
+
+            if( !bSilent)
+			{
+    cerr << e.what() << endl;
+			}
+  } catch(...) {
+    cerr << "Unknown Exception occured." << endl;
+  }
+  
+  // Samisa : clean up memory allocated for stub
+  try
+  {
+	  delete ws; 
+  }
+  catch(exception& exception)
+  {
+  	cout << "Exception on clean up of ws : " << exception.what()<<endl;
+  }
+  catch(...)
+  {
+  	cout << "Unknown exception on clean up of ws : " << endl;
+  }
+		iRetryIterationCount--;
+		} while( iRetryIterationCount > 0 && !bSuccess);
+    if(endpoint_set)
+      free(endpoint);
+  cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+  return returnValue;
+}
+
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'o':
+                setLogOptions(argv[i+1]);
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+
+void shift_args(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
+void setLogOptions(const char *output_filename) {
+    output_file.open(output_filename, ios::out);
+    if(output_file.is_open()){
+        cout.rdbuf( output_file.rdbuf() );
+    }
+}
+

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedChoiceClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedChoiceClient.cpp?rev=348928&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedChoiceClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedChoiceClient.cpp Fri Nov 25 02:48:05 2005
@@ -0,0 +1,205 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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.
+
+#include <axis/AxisException.hpp>
+#include "operations.hpp" 
+
+#include <stdlib.h> // For malloc(), calloc(), strdup() and free()
+#include <iostream>
+#include <fstream>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:80/ComplexTypeAll/services/Service"
+
+// If we re-direct cout it will be to this ofstream
+ofstream output_file;
+
+// Prototype
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
+void shift_args(int i, int *argc, char *argv[]);
+void setLogOptions(const char *output_filename);
+
+int main(int argc, char* argv[])
+{ 
+	
+  operations *ws;
+
+  char *endpoint = WSDL_DEFAULT_ENDPOINT;
+  bool endpoint_set = false;
+  int returnValue = 1; // Assume Failure
+
+  endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+		bool bSuccess = false;
+		int	iRetryIterationCount = 3;
+
+		do
+		{
+			try {
+	  
+					if(endpoint_set) {
+					ws = new operations(endpoint, APTHTTP1_1);
+					free(endpoint);
+					endpoint_set = false;
+					} else
+						ws = new operations();
+
+					aRecord* input=new aRecord(); 
+					
+					input->field1 = "hello";
+					input->field2 = "world";
+					input->field3 = "I am still here!";
+					input->field4 = "Bye";					
+
+					aRecord* result = NULL;
+					result = ws->myOperation(input);
+					if ( result == NULL )
+						cout << "result object is null" << endl;
+					
+					cout << "Result field1 is = " << result->field1 << endl;
+					
+
+					bSuccess = true;
+
+				    returnValue = 0; // Success
+
+			} catch(AxisException &e) {
+				bool bSilent = false;
+
+				if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+				{
+					if( iRetryIterationCount > 0)
+					{
+						bSilent = true;
+					}
+				}
+				else
+				{
+					iRetryIterationCount = 0;
+				}
+
+				if( !bSilent)
+				{
+					cerr << e.what() << endl;
+				}
+			} catch(exception& exception){
+
+  				cout << "Exception on clean up of ws : " << exception.what()<<endl;
+		
+			} catch(...) {
+				
+				cerr << "Unknown Exception occured 1 2 3" << endl;
+			}  
+  
+  // Samisa : clean up memory allocated for stub
+			try
+			{
+				delete ws; 
+
+			} catch(exception& exception){
+  				cout << "Exception on clean up of ws : " << exception.what()<<endl;
+			} catch(...){
+  				cout << "Unknown exception on clean up of ws : " << endl;
+			} 
+				iRetryIterationCount--;
+
+		} while( iRetryIterationCount > 0 && !bSuccess);
+
+		if(endpoint_set)
+		free(endpoint);
+
+  cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+	return returnValue;
+}
+
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'o':
+                setLogOptions(argv[i+1]);
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+
+void shift_args(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
+void setLogOptions(const char *output_filename) {
+    output_file.open(output_filename, ios::out);
+    if(output_file.is_open()){
+        cout.rdbuf( output_file.rdbuf() );
+    }
+}
\ No newline at end of file

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedSequenceClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedSequenceClient.cpp?rev=348928&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedSequenceClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceNestedSequenceClient.cpp Fri Nov 25 02:48:05 2005
@@ -0,0 +1,208 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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.
+
+#include <axis/AxisException.hpp>
+#include "operations.hpp" 
+
+#include <stdlib.h> // For malloc(), calloc(), strdup() and free()
+#include <iostream>
+#include <fstream>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:80/ComplexTypeAll/services/Service"
+
+// If we re-direct cout it will be to this ofstream
+ofstream output_file;
+
+// Prototype
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
+void shift_args(int i, int *argc, char *argv[]);
+void setLogOptions(const char *output_filename);
+
+int main(int argc, char* argv[])
+{ 
+	
+  operations *ws;
+
+  char *endpoint = WSDL_DEFAULT_ENDPOINT;
+  bool endpoint_set = false;
+  int returnValue = 1; // Assume Failure
+
+  endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+		bool bSuccess = false;
+		int	iRetryIterationCount = 3;
+
+		do
+		{
+			try {
+	  
+					if(endpoint_set) {
+					ws = new operations(endpoint, APTHTTP1_1);
+					free(endpoint);
+					endpoint_set = false;
+					} else
+						ws = new operations();
+
+					aRecord* input=new aRecord(); 
+				
+					
+					input->field1 = "hello";
+					input->field2 = "world";
+
+					input->field3 = "I am still here!";
+					input->field4 = "Bye";
+
+			
+					aRecord* result = NULL;
+					result = ws->myOperation(input);
+					if ( result == NULL )
+						cout << "result object is null" << endl;
+					cout << "Result field1 is = " << result->field1 << endl;
+					cout << "Result field2 is = " << result->field2 << endl;
+					cout << "Result field3 is = " << result->field3 << endl; 
+
+					bSuccess = true;
+
+				    returnValue = 0; // Success
+
+			} catch(AxisException &e) {
+				bool bSilent = false;
+
+				if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+				{
+					if( iRetryIterationCount > 0)
+					{
+						bSilent = true;
+					}
+				}
+				else
+				{
+					iRetryIterationCount = 0;
+				}
+
+				if( !bSilent)
+				{
+					cerr << e.what() << endl;
+				}
+			} catch(exception& exception){
+
+  				cout << "Exception on clean up of ws : " << exception.what()<<endl;
+		
+			} catch(...) {
+				
+				cerr << "Unknown Exception occured 1 2 3" << endl;
+			}  
+  
+  // Samisa : clean up memory allocated for stub
+			try
+			{
+				delete ws; 
+
+			} catch(exception& exception){
+  				cout << "Exception on clean up of ws : " << exception.what()<<endl;
+			} catch(...){
+  				cout << "Unknown exception on clean up of ws : " << endl;
+			} 
+				iRetryIterationCount--;
+
+		} while( iRetryIterationCount > 0 && !bSuccess);
+
+		if(endpoint_set)
+		free(endpoint);
+
+  cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+	return returnValue;
+}
+
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'o':
+                setLogOptions(argv[i+1]);
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+
+void shift_args(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
+void setLogOptions(const char *output_filename) {
+    output_file.open(output_filename, ios::out);
+    if(output_file.is_open()){
+        cout.rdbuf( output_file.rdbuf() );
+    }
+}
\ No newline at end of file

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceSimpleClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceSimpleClient.cpp?rev=348928&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceSimpleClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeChoiceSimpleClient.cpp Fri Nov 25 02:48:05 2005
@@ -0,0 +1,203 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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.
+
+#include <axis/AxisException.hpp>
+#include "operations.hpp" 
+
+#include <stdlib.h> // For malloc(), calloc(), strdup() and free()
+#include <iostream>
+#include <fstream>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:80/ComplexTypeAll/services/Service"
+
+// If we re-direct cout it will be to this ofstream
+ofstream output_file;
+
+// Prototype
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
+void shift_args(int i, int *argc, char *argv[]);
+void setLogOptions(const char *output_filename);
+
+int main(int argc, char* argv[])
+{ 
+	
+  operations *ws;
+
+  char *endpoint = WSDL_DEFAULT_ENDPOINT;
+  bool endpoint_set = false;
+  int returnValue = 1; // Assume Failure
+
+  endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+		bool bSuccess = false;
+		int	iRetryIterationCount = 1;
+
+		do
+		{
+			try {
+	  
+					if(endpoint_set) {
+						ws = new operations(endpoint, APTHTTP1_1);
+						free(endpoint);
+						endpoint_set = false;
+					} else
+						ws = new operations();
+
+					aRecord* input=new aRecord(); 
+
+					xsd__int* fieldone=new xsd__int();
+					*fieldone=12345;
+					input->field1=fieldone;
+					
+					aRecord* result = NULL;
+					result = ws->myOperation(input);
+					if ( result == NULL )
+						cout << "result object is null" << endl;
+					
+					cout << "Result field1 is = " << *(result->field1) << endl;
+					 
+
+					bSuccess = true;
+				    returnValue = 0; // Success
+
+			} catch(AxisException &e) {
+				bool bSilent = false;
+
+				if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+				{
+					if( iRetryIterationCount > 0)
+					{
+						bSilent = true;
+					}
+				}
+				else
+				{
+					iRetryIterationCount = 0;
+				}
+
+				if( !bSilent)
+				{
+					cerr << e.what() << endl;
+				}
+			} catch(exception& exception){
+
+  				cout << "Exception on clean up of ws : " << exception.what()<<endl;
+		
+			} catch(...) {
+				
+				cerr << "Unknown Exception occured 1 2 3" << endl;
+			}  
+  
+  // Samisa : clean up memory allocated for stub
+			try
+			{
+				delete ws; 
+
+			} catch(exception& exception){
+  				cout << "Exception on clean up of ws : " << exception.what()<<endl;
+			} catch(...){
+  				cout << "Unknown exception on clean up of ws : " << endl;
+			} 
+				iRetryIterationCount--;
+
+		} while( iRetryIterationCount > 0 && !bSuccess);
+
+		if(endpoint_set)
+		free(endpoint);
+
+  cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+	return returnValue;
+}
+
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'o':
+                setLogOptions(argv[i+1]);
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+
+void shift_args(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
+void setLogOptions(const char *output_filename) {
+    output_file.open(output_filename, ios::out);
+    if(output_file.is_open()){
+        cout.rdbuf( output_file.rdbuf() );
+    }
+}
\ No newline at end of file

Added: webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeOptionalChoiceClient.cpp
URL: http://svn.apache.org/viewcvs/webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeOptionalChoiceClient.cpp?rev=348928&view=auto
==============================================================================
--- webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeOptionalChoiceClient.cpp (added)
+++ webservices/axis/trunk/c/tests/auto_build/testcases/client/cpp/ComplexTypeOptionalChoiceClient.cpp Fri Nov 25 02:48:05 2005
@@ -0,0 +1,198 @@
+// Copyright 2003-2004 The Apache Software Foundation.
+// (c) Copyright IBM Corp. 2004, 2005 All Rights Reserved
+// 
+// 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.
+
+#include <axis/AxisException.hpp>
+#include "operations.hpp" 
+
+#include <stdlib.h> // For malloc(), calloc(), strdup() and free()
+#include <iostream>
+#include <fstream>
+
+#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/ComplexTypeAll/services/Service"
+
+// If we re-direct cout it will be to this ofstream
+ofstream output_file;
+
+// Prototype
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint);
+void shift_args(int i, int *argc, char *argv[]);
+void setLogOptions(const char *output_filename);
+
+int main(int argc, char* argv[])
+{ 
+  operations *ws;
+
+  char *endpoint = WSDL_DEFAULT_ENDPOINT;
+  bool endpoint_set = false;
+  int returnValue = 1; // Assume Failure
+
+  endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
+
+		bool bSuccess = false;
+		int	iRetryIterationCount = 3;
+
+		do
+		{
+  try {
+    if(endpoint_set) {
+      ws = new operations(endpoint, APTHTTP1_1);
+      free(endpoint);
+      endpoint_set = false;
+    } else
+      ws = new operations();
+
+    aRecord* input = new aRecord();
+    input->field1 = "Hello World!";
+    input->field2 = "I'm still here!";
+    input->field3 = "Now I go!";
+    aRecord* result = NULL;
+    result = ws->myOperation(input);
+
+	if ( result == NULL )
+		cout << "result object is null" << endl;
+
+    cout << "Result field1 is = " << result->field1 << endl;
+	/* cout << "Result field2 is = " << result->field2 << endl;
+	cout << "Result field3 is = " << result->field3 << endl; */ 
+
+	bSuccess = true;
+
+    returnValue = 0; // Success
+
+  } catch(AxisException &e) {
+			bool bSilent = false;
+
+			if( e.getExceptionCode() == CLIENT_TRANSPORT_OPEN_CONNECTION_FAILED)
+			{
+				if( iRetryIterationCount > 0)
+				{
+					bSilent = true;
+				}
+			}
+			else
+			{
+				iRetryIterationCount = 0;
+			}
+
+            if( !bSilent)
+			{
+    cerr << e.what() << endl;
+			}
+  } catch(...) {
+    cerr << "Unknown Exception occured." << endl;
+  }
+  
+  // Samisa : clean up memory allocated for stub
+  try
+  {
+	  delete ws; 
+  }
+  catch(exception& exception)
+  {
+  	cout << "Exception on clean up of ws : " << exception.what()<<endl;
+  }
+  catch(...)
+  {
+  	cout << "Unknown exception on clean up of ws : " << endl;
+  }
+		iRetryIterationCount--;
+		} while( iRetryIterationCount > 0 && !bSuccess);
+    if(endpoint_set)
+      free(endpoint);
+  cout << "---------------------- TEST COMPLETE -----------------------------"<< endl;
+
+  return returnValue;
+}
+
+/* Spin through args list and check for -e -p and -s options.
+   Option values are expected to follow the option letter as the next
+   argument.
+ 
+   These options and values are removed from the arg list.
+   If both -e and -s and or -p, then -e takes priority
+*/
+bool parse_args_for_endpoint(int *argc, char *argv[], char **endpoint) {
+
+    // We need at least 2 extra arg after program name
+    if(*argc < 3)
+        return false;
+
+    char *server = "localhost";
+    int  port = 80;
+    bool ep_set = false;
+    bool server_set = false;
+    bool port_set = false;
+
+    for(int i=1; i<*argc; i++) {
+        if(*argv[i] == '-') {
+            switch(*(argv[i]+1)) {
+            case 'e':
+                *endpoint = strdup(argv[i+1]);
+                ep_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 's':
+                server = strdup(argv[i+1]);
+                server_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'p':
+                port = atoi(argv[i+1]);
+                if(port >80) port_set = true;
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            case 'o':
+                setLogOptions(argv[i+1]);
+                shift_args(i, argc, argv);
+                i--;
+                break;
+            default:
+                break;
+            }
+        }
+    }
+
+    // use the supplied server and/or port to build the endpoint
+    if(ep_set == false && (server_set || port_set)) {
+        // Set p to the location of the first '/' after the http:// (7 chars)
+        // e.g. from http://localhost:80/axis/base gets /axis/base
+        char *ep_context = strpbrk(&(*endpoint)[7], "/");
+
+        // http://:/ is 9 characters + terminating NULL character so add 10.
+        // Allow space for port number upto 999999 6 chars
+        *endpoint = (char *)calloc(1, 10 + strlen(ep_context) + strlen(server) + 6);
+        sprintf(*endpoint, "http://%s:%d/%s", server, port, ep_context+1);
+        if(server_set) free(server);
+        ep_set = true;
+    }
+
+    return ep_set;
+}
+
+void shift_args(int i, int *argc, char *argv[]) {
+    for(int j=i, k=i+2; j<*(argc)-2; j++, k++)
+        argv[j]=argv[k];
+    *argc-=2;
+}
+void setLogOptions(const char *output_filename) {
+    output_file.open(output_filename, ios::out);
+    if(output_file.is_open()){
+        cout.rdbuf( output_file.rdbuf() );
+    }
+}
+