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 ha...@apache.org on 2004/09/08 13:07:49 UTC

cvs commit: ws-axis/c/tests/auto_build/testcases/client/cpp CalculatorClient.cpp ComplexTypeAllClient.cpp EnumerationClient.cpp LargeReturningStringClient.cpp ManyTypeRefRootClient.cpp RecurseTypesClient.cpp SimpleTypeArrayClient.cpp SimpleTypeInnerUnboundedClient.cpp SimpleTypeInnerUnboundedInOutputClient.cpp TradeServicesClient.cpp

hawkeye     2004/09/08 04:07:49

  Modified:    c/tests/auto_build/testcases/client/cpp CalculatorClient.cpp
                        ComplexTypeAllClient.cpp EnumerationClient.cpp
                        LargeReturningStringClient.cpp
                        ManyTypeRefRootClient.cpp RecurseTypesClient.cpp
                        SimpleTypeArrayClient.cpp
                        SimpleTypeInnerUnboundedClient.cpp
                        SimpleTypeInnerUnboundedInOutputClient.cpp
                        TradeServicesClient.cpp
  Log:
  Added option to specify an output file rather than just writing to stdout.
  CVS: ----------------------------------------------------------------------
  CVS: PR:
  CVS:   If this change addresses a PR in the problem report tracking
  CVS:   database, then enter the PR number(s) here.
  CVS: Obtained from:
  CVS:   If this change has been taken from another system, such as NCSA,
  CVS:   then name the system in this line, otherwise delete it.
  CVS: Submitted by:
  CVS:   If this code has been contributed to Apache by someone else; i.e.,
  CVS:   they sent us a patch or a new module, then include their name/email
  CVS:   address here. If this is your work then delete this line.
  CVS: Reviewed by:
  CVS:   If we are doing pre-commit code reviews and someone else has
  CVS:   reviewed your changes, include their name(s) here.
  CVS:   If you have not had it reviewed then delete this line.
  
  Revision  Changes    Path
  1.2       +133 -45   ws-axis/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp
  
  Index: CalculatorClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/CalculatorClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- CalculatorClient.cpp	30 Aug 2004 10:52:28 -0000	1.1
  +++ CalculatorClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,66 +1,154 @@
   #include "Calculator.h"
   #include <axis/AxisGenException.h>
  -#include <ctype.h>
  +#include <iostream>
  +#include <fstream>
   
  -void PrintUsage();
  -bool IsNumber(const char* p);
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/Calculator/services/Calculator"
  +
  +// 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);
  +
  +// If we re-direct cout it will be to this ofstream
  +ofstream output_file;
   
   int main(int argc, char* argv[])
   {
  -	char endpoint[256];
  -	const char* url="http://192.168.101.4:80/axis/Calculator";
  -	const char* op = 0;
  -	int i1=0, i2=0;
  -        int iResult;
  -        char* pcDetail;
  -        pcDetail = 0;
  +    Calculator *ws;
   
  -	url = argv[1];
  +    char *endpoint = WSDL_DEFAULT_ENDPOINT;
  +    bool endpoint_set = false;
  +    int returnValue = 1; // Assume Failure
  +
  +    endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
  +
  +    try {
  +        if(endpoint_set) {
  +            ws = new Calculator(endpoint, APTHTTP);
  +            free(endpoint);
  +            endpoint_set = false;
  +        } else
  +            ws = new Calculator();
   
  -	try
  +        const char* op = "add";
  +        int i1=2, i2=2;
  +        int iResult;
  +        char* pcDetail = 0;
  +    
  +        if (strcmp(op, "add") == 0)
  +        {
  +            iResult = ws->add(i1, i2);
  +            cout << iResult << endl;
  +        }
  +        else     if (strcmp(op, "sub") == 0)
           {
  -		printf("Sending Requests to Server %s .......\n\n", url);
  -		sprintf(endpoint, "%s", url);
  -		Calculator ws(endpoint);
  -
  -		op = "add";
  -		i1 = 2;
  -		i2 = 3;
  -
  -		if (strcmp(op, "add") == 0)
  -		{
  -        	        iResult = ws.add(i1, i2);
  -                	ws.getFaultDetail(&pcDetail);
  -	                printf("%d\n", iResult);
  -        	        /*printf("pcDetail:%s\n", pcDetail);*/
  -		}
  +            iResult = ws->sub(i1, i2);
  +            cout << iResult << endl;
           }
  -        catch(AxisException& e)
  +        else     if (strcmp(op, "mul") == 0)
           {
  -            printf("Exception : %s\n", e.what());
  +            iResult = ws->mul(i1, i2);
  +            cout << iResult << endl;
           }
  -        catch(exception& e)
  +        else     if (strcmp(op, "div") == 0)
           {
  -            printf("Unknown exception has occured\n" );
  +            iResult = ws->div(i1, i2);
  +            cout << iResult << endl;
           }
  -	catch(...)
  +        else 
           {
  -            printf("Unknown exception has occured\n" );
  +            cout << "Invalid operation " << op << endl;
           }
  -	return 0;
  +        returnValue = 0; // Success
  +    } catch(AxisException &e) {
  +        cerr << e.what() << endl;
  +        if(endpoint_set)
  +          free(endpoint);
  +    } catch(...) {
  +        cerr << "Unknown Exception occurred." << endl;
  +        if(endpoint_set)
  +          free(endpoint);
  +    }
  +    return returnValue;
   }
   
  -void PrintUsage()
  -{
  -	printf("Usage :\n Calculator <server> <port> <operation> <parameter> <parameter>\n\n");
  -	exit(1);
  +/* 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;
   }
   
  -bool IsNumber(const char* p)
  -{
  -	for (int x=0; x < strlen(p); x++)
  -	{
  -		if (!isdigit(p[x])) return false;
  -	}
  -	return true;
  +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() );
  +    }
   }
  
  
  
  1.2       +96 -66    ws-axis/c/tests/auto_build/testcases/client/cpp/ComplexTypeAllClient.cpp
  
  Index: ComplexTypeAllClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/ComplexTypeAllClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ComplexTypeAllClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ ComplexTypeAllClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,38 +1,56 @@
  -#include <stdio.h>
   #include <axis/server/AxisException.h>
   #include "operations.h" 
  +
   #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[])
   { 
  -//  setSignals();
     operations *ws;
  -  aRecord* input = new aRecord();
  -  xsd__boolean result = (xsd__boolean)0;
   
  -  char *endpoint = "http://localhost:9080/ComplexTypeAll/services/Service";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
  +  int returnValue = 1; // Assume Failure
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new operations(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new operations();
   
  +    aRecord* input = new aRecord();
  +    xsd__boolean result = (xsd__boolean)0;
       result = ws->myOperation(input);
  -  } catch (AxisException &e) {
  -    fprintf(stderr, "EXCEPTION: %s\n", e.what());
  -  }
   
  -  printf ("Result %d\n", result);
  +    cout << "Result " << result << endl;
  +
  +    returnValue = 0; // Success
   
  -  return 0;
  +  } catch(AxisException &e) {
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  }
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -44,62 +62,74 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
  +}
  +
  
  
  
  1.2       +107 -87   ws-axis/c/tests/auto_build/testcases/client/cpp/EnumerationClient.cpp
  
  Index: EnumerationClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/EnumerationClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- EnumerationClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ EnumerationClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,61 +1,69 @@
   
   #include "EnumerationWS.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:80/Enumeration/services/sampleWS"
   
   // 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);
  +
  +// If we re-direct cout it will be to this ofstream
  +ofstream output_file;
   
   int main(int argc, char* argv[])
   {
     EnumerationWS *ws;
   
  -  char *endpoint = "http://localhost:9080/Enumeration/services/sampleWS";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
  +  int returnValue = 1; // Assume Failure
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new EnumerationWS(endpoint, APTHTTP);
  -    else
  -      ws = new EnumerationWS();
  -  } catch(AxisException &e) {
  -    fprintf(stderr, "Exception %s\n", e.what());
  -    fflush(stderr);
  -    if(endpoint_set)
         free(endpoint);
  -    return 1;
  -  }
  -  if(endpoint_set) free(endpoint);
  +      endpoint_set = false;
  +    } else
  +      ws = new EnumerationWS();
   
  -  Type1* input = new Type1();
  -  Type1* result = NULL;
  +    Type1* input = new Type1();
  +    Type1* result = NULL;
   
  -  input->enum_string="one";
  -  input->att_enum_string="one";
  -  input->enum_int=ENUMTYPEINT_0;
  -  input->att_enum_int=ENUMTYPEINT_1;
  -  input->att_enum_kind="CHEQUE";
  +    input->enum_string="one";
  +    input->att_enum_string="one";
  +    input->enum_int=ENUMTYPEINT_0;
  +    input->att_enum_int=ENUMTYPEINT_1;
  +    input->att_enum_kind="CHEQUE";
   
  -  try {
       result = ws->getInput(input);
  -  } catch(AxisException &e) {
  -    fprintf(stderr, "Exception %s\n", e.what());
  -    fflush(stderr);
  -  }
   
  -  printf ("Result\n");
  -  if ( result == NULL ) {
  -    printf ("  result = NULL\n");
  -  } else {
  -    printf ("att_enum_int %d\n", result->att_enum_int);
  -    printf ("att_enum_string %s\n", result->att_enum_string);
  -    printf ("enum_int %d\n", result->enum_int);
  -    printf ("enum_string %s\n", result->enum_string);
  -    printf ("enum_kind %s\n", result->att_enum_kind);
  +    cout << "Result" << endl;
  +    if ( result == NULL ) {
  +      cout << "  result = NULL" << endl;
  +    } else {
  +      cout << "att_enum_int " << result->att_enum_int << endl;
  +      cout << "att_enum_string " << result->att_enum_string << endl;
  +      cout << "enum_int " << result->enum_int << endl;
  +      cout << "enum_string " << result->enum_string << endl;
  +      cout << "enum_kind " << result->att_enum_kind << endl;
  +      returnValue = 0; // Success
  +    }
  +  } catch(AxisException &e) {
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
     }
  -  return 0;
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -67,62 +75,74 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
  +}
  +
  
  
  
  1.2       +97 -68    ws-axis/c/tests/auto_build/testcases/client/cpp/LargeReturningStringClient.cpp
  
  Index: LargeReturningStringClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/LargeReturningStringClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- LargeReturningStringClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ LargeReturningStringClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,41 +1,58 @@
   
   #include "LargeReturningString.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://bora.hursley.ibm.com:9080/DSServiceWebProject/services/LargeReturningString"
  +
  +// 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[])
   {
     LargeReturningString *ws;
   
  -  char *endpoint = "http://bora.hursley.ibm.com:9080/DSServiceWebProject/services/LargeReturningString";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
  +  int returnValue = 1; // Assume Failure
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
  -  xsd__string result;
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new LargeReturningString(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new LargeReturningString();
   
       int input = 20000;
  +    xsd__string result = "";
       result = ws->getLargeString(input);
  -  } catch(AxisException &e) {
  -    fprintf(stderr, "Exception %s\n", e.what());
  -    fflush(stderr);
  -  }
   
  -  printf ("Result\n");
  -  if ( result == NULL ) {
  -    printf ("  result = NULL\n");
  -  } else {
  -    printf ("%s\n", result);
  +    cout << "Result" << endl
  +    if ( result == NULL ) {
  +      cout << "NULL" << endl
  +    } else {
  +      cout << strlen(result) << endl;
  +      returnValue = 0; // Success
  +    }
  +  } catch(AxisException &e) {
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
     }
  -  return 0;
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -47,62 +64,74 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
  +}
  +
  
  
  
  1.2       +129 -106  ws-axis/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp
  
  Index: ManyTypeRefRootClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/ManyTypeRefRootClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ManyTypeRefRootClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ ManyTypeRefRootClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,128 +1,151 @@
  -#include "ManyTypeRefRootWS.h" 
  +#include "ManyTypeRefRoot.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/ManyTypeRefRoot/services/sampleWS"
  +
  +// 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[])
   {
  -  ManyTypeRefRootWS *ws;
  -
  -  char *endpoint = "http://localhost:9080/ManyTypeRefRootWS/services/sampleWS";
  -  bool endpoint_set = false;
  -
  -  endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
  -
  -  try {
  -    if(endpoint_set)
  -      ws = new ManyTypeRefRootWS(endpoint, APTHTTP);
  -    else
  -      ws = new ManyTypeRefRootWS();
  -  } catch(AxisException &e) {
  -    fprintf(stderr, "%s\n", e.what());
  -  }
  -
  -  Type1_Array input;
  -  Type1_Array result;
  -  int i;
  -
  -  Type1 types[10];
  -
  -
  -  Type1* current;
  +    ManyTypeRefRoot *ws;
   
  -
  -  for ( i = 0; i < 10; i++ ) {
  -    current = new Type1 ();
  -    current->kind = "Test type";
  -    current->index = i;
  -    types[i] = *current;
  -  }
  -
  -  input.m_Array = types;
  -  input.m_Size = 10;
  -
  -	result = ws->getInput(input);
  -
  -  printf ("Success \n");
  -  Type1 *arrayResult = result.m_Array;
  -  for ( i = 0; i < 10; i++ ) {
  -    printf (" Result %d : %s \n" ,
  -           arrayResult->index,
  -           arrayResult->kind);
  -           arrayResult++;
  -  }
  -
  -  return 0;
  +    char *endpoint = WSDL_DEFAULT_ENDPOINT;
  +    bool endpoint_set = false;
  +    int returnValue = 1; // Assume Failure
  +
  +    endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
  +
  +    try {
  +        if(endpoint_set) {
  +            ws = new ManyTypeRefRoot(endpoint, APTHTTP);
  +            free(endpoint);
  +            endpoint_set = false;
  +        } else
  +            ws = new ManyTypeRefRoot();
  +
  +        Type1_Array input;
  +        Type1_Array result;
  +        Type1 types[10];
  +        Type1* current;
  +        int i;
  +
  +        for ( i = 0; i < 10; i++ ) {
  +            current = new Type1 ();
  +            current->kind = "Test type";
  +            current->index = i;
  +            types[i] = *current;
  +        }
  +
  +        input.m_Array = types;
  +        input.m_Size = 10;
  +
  +        result = ws->getInput(input);
  +
  +        cout << "Success " << endl;
  +        Type1 *arrayResult = result.m_Array;
  +        for ( i = 0; i < 10; i++, arrayResult++ ) {
  +            cout << " Result " << arrayResult->index << " : " << arrayResult->kind << endl;
  +        }
  +        returnValue = 0; // Success
  +    } catch(AxisException &e) {
  +        cerr << e.what() << endl;
  +        if(endpoint_set)
  +            free(endpoint);
  +    } catch(...) {
  +        cerr << "Unknown Exception occured." << endl;
  +        if(endpoint_set)
  +            free(endpoint);
  +    }
  +    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.
  +     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
  +     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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
   }
  +
  
  
  
  1.2       +99 -71    ws-axis/c/tests/auto_build/testcases/client/cpp/RecurseTypesClient.cpp
  
  Index: RecurseTypesClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/RecurseTypesClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RecurseTypesClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ RecurseTypesClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,32 +1,42 @@
   #include "RecurseTypesWS.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/RecurseTypes/services/sampleWS"
  +
  +// 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);
   
   extern void* Axis_Create_Type1(Type1 *Obj, bool bArray = false, int nSize=0);
   
   int main(int argc, char* argv[])
   { 
  -  Kind inputAtt,*outputAtt;
  -  Type1 *input,*output,*pTemp;
  -  void * pStub;
  -  int i;
  -
     RecurseTypesWS *ws;
   
  -  char *endpoint = "http://localhost:9080/RecurseTypes/services/sampleWS";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
  +  int returnValue = 1; // Assume Failure
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new RecurseTypesWS(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new RecurseTypesWS();
   
  +    Kind inputAtt,*outputAtt;
  +    Type1 *input,*output,*pTemp;
  +    int i;
  +
       input = new Type1 ();
       input->att_kind = Kind_CHEQUE;
       input->kind = "Check In";
  @@ -40,23 +50,29 @@
   
       output = ws->getInput(input);
   
  -    printf ("Result\n");
  +    cout << "Result" << endl;
       if ( output == NULL )
  -      printf ("Invoke failed\n");
  +      cout << "Invoke failed" << endl;
       else {
  -      printf ("\tAtt_kind = %s\n", output->att_kind);
  -      printf ("\tKind = %s\n", output->kind);
  +      cout << "\tAtt_kind = " << output->att_kind << endl;
  +      cout << "\tKind = " << output->kind << endl;
         pTemp = output->followings.m_Array;
         for ( i = 0; i < output->followings.m_Size; i++ ) {
  -        printf ("\tKind [%d] = %s\n",i, pTemp->kind);
  +        cout << "\tKind [" << i << "] = " << pTemp->kind << endl;
           pTemp++;
         }
  +      returnValue = 0; // Success
       }
  -  } catch (AxisException &e) {
  -    fprintf(stderr, "%s\n", e.what());
  +  } catch(AxisException &e) {
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
     }
  -  delete output;
  -  return 0;
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -68,62 +84,74 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
  +}
  +
  
  
  
  1.2       +96 -67    ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleTypeArrayClient.cpp
  
  Index: SimpleTypeArrayClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleTypeArrayClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleTypeArrayClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ SimpleTypeArrayClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,31 +1,41 @@
   #include "SimpleTypeArrayWS.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/SimpleTypeArray/services/sampleWS"
   
   // 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);
  +
  +// If we re-direct cout it will be to this ofstream
  +ofstream output_file;
   
   int main(int argc, char* argv[])
  -{ 
  -  Type *input;
  -  Type *output;
  +{
     SimpleTypeArrayWS *ws;
  -  xsd__int_Array array_input;
  -  xsd__int_Array array_output;
  -  int entries[100];
  -  int i;
   
  -  char *endpoint = "http://localhost:9080/SimpleTypeArray/services/sampleWS";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
  +  int returnValue = 1; // Assume Failure
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new SimpleTypeArrayWS(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new SimpleTypeArrayWS();
   
  +    Type *input;
  +    Type *output;
  +    xsd__int_Array array_input;
  +    int entries[100];
  +    int i;
   
       array_input.m_Array = entries;
       array_input.m_Size  = 100;
  @@ -40,12 +50,19 @@
       output = ws->getInput(input);
   
       for ( i = 0; i < 100; i++ ) {
  -      printf ("item [%d] = %d\n",i,output->item.m_Array[i]);
  +      cout << "item [" << i << "] = " << output->item.m_Array[i] << endl;
       }
  +    returnValue = 0; // Success
     } catch(AxisException &e) {
  -    fprintf(stderr, "%s\n", e.what());
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
     }
  -  delete output;
  +  return returnValue;
   
   }
   
  @@ -58,62 +75,74 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +            }
  +        }
  +    }
   
  -	return ep_set;
  +    // 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;
  +    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() );
  +    }
   }
  
  
  
  1.2       +97 -70    ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleTypeInnerUnboundedClient.cpp
  
  Index: SimpleTypeInnerUnboundedClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleTypeInnerUnboundedClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleTypeInnerUnboundedClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ SimpleTypeInnerUnboundedClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,31 +1,40 @@
   #include "SimpleTypeInnerUnboundedWS.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/SimpleTypeInnerUnbounded/services/sampleWS"
   
   // 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);
  +
  +// If we re-direct cout it will be to this ofstream
  +ofstream output_file;
   
   int main(int argc, char* argv[])
   { 
  -  int i;
  -
     SimpleTypeInnerUnboundedWS *ws;
   
  -  char *endpoint = "http://localhost:9080/SimpleTypeInnerUnbounded/services/sampleWS";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
  +  int returnValue = 1; // Assume Failure
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new SimpleTypeInnerUnboundedWS(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new SimpleTypeInnerUnboundedWS();
   
       Type1 *input =  new Type1();
  -    xsd__string idents[10];
  -  
       Type1* result;
  +    char *idents[10];
  +    int i;
   
       input->enum_int = ENUMTYPEINT_1;
       input->enum_string = strdup("one");
  @@ -41,20 +50,27 @@
   
       result = ws->getInput(input);
   
  -    printf ("Result\n");
  +    cout << "Result" << endl;
       if ( result == NULL )
  -      printf ("NULL\n");
  +      cout << "NULL" << endl;
       else {
  -      printf ("att_enum_int %d\n", result->att_enum_int);
  -      printf ("att_enum_string %s\n", result->att_enum_string);
  -      printf ("enum_int %d\n", result->enum_int);
  -      printf ("enum_string %s\n", result->enum_string);
  -      printf ("enum_kind %s\n", result->att_enum_kind);
  +      cout << "att_enum_int " << result->att_enum_int << endl;
  +      cout << "att_enum_string " << result->att_enum_string << endl;
  +      cout << "enum_int " << result->enum_int << endl;
  +      cout << "enum_string " << result->enum_string << endl;
  +      cout << "enum_kind " << result->att_enum_kind << endl;
  +      returnValue = 0; // Success
       }
     } catch(AxisException &e) {
  -    fprintf(stderr, "%s\n", e.what());
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
     }
  -  return 0;
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -66,62 +82,73 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
   }
  
  
  
  1.2       +96 -64    ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleTypeInnerUnboundedInOutputClient.cpp
  
  Index: SimpleTypeInnerUnboundedInOutputClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/SimpleTypeInnerUnboundedInOutputClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- SimpleTypeInnerUnboundedInOutputClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ SimpleTypeInnerUnboundedInOutputClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -1,43 +1,64 @@
   #include "SimpleTypeInnerUnboundedInOutputWS.h" 
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http://localhost:9080/SimpleTypeInnerUnboundedInOutput/services/sampleWS"
   
   // 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);
  +
  +// If we re-direct cout it will be to this ofstream
  +ofstream output_file;
   
   int main(int argc, char* argv[])
   { 
  -  int i;
  -  int size;
     SimpleTypeInnerUnboundedInOutputWS *ws;
  +  int returnValue = 1; // Assume failure
   
  -  char *endpoint = "http://localhost:9080/SimpleTypeInnerUnboundedInOutput/services/sampleWS";
  +  char *endpoint = WSDL_DEFAULT_ENDPOINT;
     bool endpoint_set = false;
   
     endpoint_set = parse_args_for_endpoint(&argc, argv, &endpoint);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new SimpleTypeInnerUnboundedInOutputWS(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new SimpleTypeInnerUnboundedInOutputWS();
   
       Type1* result;
  -    size = 10;
  +    int i;
  +    int size = 10;
  +
       result = ws->getInput(size);
   
       if ( result == NULL )
  -      printf ("NULL\n");
  +      cout << "NULL" << endl;
       else {
  +      char **pTemp = result->ident.m_Array;
         for ( i = 0; i < result->ident.m_Size; i++ ) {
  -        printf ("Result [%d] : %s\n",i,result->ident.m_Array[i]);
  +        cout << "Result [" << i << "] : " << pTemp[i] << endl;
         }
  +      returnValue = 0; // Success
       }
     } catch(AxisException &e) {
  -    fprintf(stderr, "%s\n", e.what());
  +    cerr << e.what() << endl;
  +    if(endpoint_set) {
  +        free(endpoint);
  +    }
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set) {
  +        free(endpoint);
  +    }
     }
   
  -  return 0;
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -49,62 +70,73 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +    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;
  +    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() );
  +    }
   }
  
  
  
  1.2       +109 -86   ws-axis/c/tests/auto_build/testcases/client/cpp/TradeServicesClient.cpp
  
  Index: TradeServicesClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/tests/auto_build/testcases/client/cpp/TradeServicesClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- TradeServicesClient.cpp	27 Aug 2004 12:08:15 -0000	1.1
  +++ TradeServicesClient.cpp	8 Sep 2004 11:07:48 -0000	1.2
  @@ -12,80 +12,92 @@
   #include <stdio.h>
   #include "operations.h"
   #include <stdlib.h> // For malloc(), calloc(), strdup() and free()
  +#include <iostream>
  +#include <fstream>
  +
  +#define WSDL_DEFAULT_ENDPOINT "http:///"
   
   // 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);
   
  +// If we re-direct cout it will be to this ofstream
  +ofstream output_file;
   
  -int main(int argc, char* argv[]){
  -  int i;
  -  xsd__string userid;
  +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);
   
     try {
  -    if(endpoint_set)
  +    if(endpoint_set) {
         ws = new operations(endpoint, APTHTTP);
  -    else
  +      free(endpoint);
  +      endpoint_set = false;
  +    } else
         ws = new operations();
   
  -    userid = "Durand";
  -
  -    // we are changing the EndpointURI here to redirect requests toward the TCP/IP Monitor
  -    // uncomment the following if using any TCP/IP traffic monitoring tool
  -    // ws->SetEndpointURI("http://localhost:9081/TradeApplication/services/Service");
  +    int i;
  +    xsd__string userid = "Durand";
   
  -    printf("Requesting new ticket for user %s\n",userid);
  +    cout << "Requesting new ticket for user " << userid << endl;
       long ticket = ws->getTicket(userid);
  -    printf("-> received ticket: %ld\n",ticket);
  +    cout << "-> received ticket: " << ticket << endl;
   
  -    printf("Requesting the Quote list\n");
  +    cout << "Requesting the Quote list" << endl;
       Quote_Array arrayOfQuote = ws->getAllQuotes(userid,ticket);
  -    printf("-> received %d Quotes\n",arrayOfQuote.m_Size);
  +    cout << "-> received " << arrayOfQuote.m_Size << " Quotes" << endl;
   
       for(i=0;i<arrayOfQuote.m_Size;i++){
         Quote quote = arrayOfQuote.m_Array[i];
  -      printf("    - %s %s $%f\n",quote.symbol,quote.label,quote.price);
  +      cout << "    - " << quote.symbol << " " << quote.label << " $" << quote.price << endl;
       }
   
  -    printf("Requesting orders to buy some Stocks...\n");
  -    printf("Order 1: 10 * q:3\n");
  +    cout << "Requesting orders to buy some Stocks..." << endl;
  +    cout << "Order 1: 10 * q:3" << endl;
       Order *order = ws->buyQuote(userid,ticket,10,arrayOfQuote.m_Array+3);
  -    printf("-> transaction ok. id:%d\n",order->reference);
  +    cout << "-> transaction ok. id:" << order->reference << endl;
   
  -    printf("Order 2: 7 * q:6\n");
  +    cout << "Order 2: 7 * q:6" << endl;
       order = ws->buyQuote(userid,ticket,7,arrayOfQuote.m_Array+6);
  -    printf("-> transaction ok. id:%d\n",order->reference);
  +    cout << "-> transaction ok. id:" << order->reference << endl;
   
  -    printf("Order 3: 3 * q:9\n");
  +    cout << "Order 3: 3 * q:9" << endl;
       order = ws->buyQuote(userid,ticket,3,arrayOfQuote.m_Array+9);
  -    printf("-> transaction ok. id:%d\n",order->reference);
  +    cout << "-> transaction ok. id:" << order->reference << endl;
   
  -    printf("Requesting my Orders list\n");
  +    cout << "Requesting my Orders list" << endl;
       Order_Array arrayOfOrder = ws->getAllOrders(userid,ticket);
  -    printf("-> received %d Orders\n",arrayOfOrder.m_Size);
  +    cout << "-> received " << arrayOfOrder.m_Size << " Orders" << endl;
   
       for(i=0;i<arrayOfOrder.m_Size;i++){
         Order anOrder = arrayOfOrder.m_Array[i];
  -      printf("    - %d %s $%f %d\n",anOrder.reference,anOrder.symbol,anOrder.price,anOrder.quantity);
  +      cout << "    - " << anOrder.reference << " " << anOrder.symbol << " $" << anOrder.price << " " << anOrder.quantity << endl;
       }
   
  -    printf("Requesting my portfolio value\n");
  +    cout << "Requesting my portfolio value" << endl;
       xsd__decimal total = ws->computePortfolio(userid,ticket);
  -    printf("-> value = $%f\n",total);
  +    cout << "-> value = $" << total << endl;
       
  -    printf ("Compilation success\n");   
  +    cout << "SUCCESS" << endl;   
  +
  +    returnValue = 0; // Success
  +
     } catch(AxisException &e) {
  -    fprintf(stderr, "%s\n", e.what());
  +    cerr << e.what() << endl;
  +    if(endpoint_set)
  +      free(endpoint);
  +  } catch(...) {
  +    cerr << "Unknown Exception occured." << endl;
  +    if(endpoint_set)
  +      free(endpoint);
     }
  -
  -  return 0;
  +  return returnValue;
   }
   
   /* Spin through args list and check for -e -p and -s options.
  @@ -97,62 +109,73 @@
   */
   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;
  -			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;
  -	}
  +    // 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;
  +            }
  +        }
  +    }
   
  -	return ep_set;
  +    // 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;
  +    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() );
  +    }
   }