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 sa...@apache.org on 2004/10/21 07:05:33 UTC

cvs commit: ws-axis/c/samples/client/ref RefClient.cpp

sanjaya     2004/10/20 22:05:33

  Modified:    c/samples/client/ref RefClient.cpp
  Log:
  argument format of client changed
  
  Revision  Changes    Path
  1.2       +30 -11    ws-axis/c/samples/client/ref/RefClient.cpp
  
  Index: RefClient.cpp
  ===================================================================
  RCS file: /home/cvs/ws-axis/c/samples/client/ref/RefClient.cpp,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- RefClient.cpp	17 Aug 2004 10:00:02 -0000	1.1
  +++ RefClient.cpp	21 Oct 2004 05:05:33 -0000	1.2
  @@ -5,28 +5,47 @@
   
   #include "RefTestPortType.h" 
   #include <axis/AxisGenException.h>
  +#include <iostream>
   
   #define ARRAYSIZE 2
   
  +static void
  +usage (char *programName, char *defaultURL)
  +{
  +    cout << "\nUsage:\n"
  +	<< programName << " [-? | service_url] " << endl
  +	<< "    -?             Show this help.\n"
  +	<< "    service_url    URL of the service.\n"
  +	<< "    Default service URL is assumed to be " << defaultURL
  +	<<
  +	"\n    Could use http://localhost:8080/axis/services/echo to test with Axis Java."
  +	<< endl;
  +}
  +
   int main(int argc, char* argv[])
   {
   	int x;
   	char buffer1[100];
   	char endpoint[256];
  -	const char* server="localhost";
  -	const char* port="80";
  -	try
  +
  +    // Set default service URL
  +    sprintf (endpoint, "http://localhost/axis/ref");
  +    // Could use http://localhost:8080/axis/services/echo to test with Axis Java
  +
  +    try
           {
  -	if (argc == 3)
  +	if (argc > 1)
   	{
  -		server = argv[1];
  -		port = argv[2];
  +	    // Watch for special case help request
  +	    if (!strncmp (argv[1], "-", 1)) // Check for - only so that it works for 
  +                                            //-?, -h or --help; -anything 
  +	    {
  +		usage (argv[0], endpoint);
  +		return 2;
  +	    }
  +	    sprintf (endpoint, argv[1]);
   	}
  -	printf("Usage :\n %s <server> <port>\n\n", argv[0]);
  -	printf("Sending Requests to Server http://%s:%s ........\n\n", server, port);
  -	sprintf(endpoint, "http://%s:%s/axis/ref", server, port);
  -	//endpoint for Axis Java sample
  -	//sprintf(endpoint, "http://%s:%s/axis/services/echo", server, port);
  +	cout << endl << " Using service at " << endpoint << endl << endl;
   	
   	RefTestPortType ws(endpoint);