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:04:17 UTC
cvs commit: ws-axis/c/samples/client/array ArrayClient.cpp
sanjaya 2004/10/20 22:04:17
Modified: c/samples/client/array ArrayClient.cpp
Log:
argument format of client changed
Revision Changes Path
1.2 +32 -10 ws-axis/c/samples/client/array/ArrayClient.cpp
Index: ArrayClient.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/samples/client/array/ArrayClient.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- ArrayClient.cpp 17 Aug 2004 06:53:58 -0000 1.1
+++ ArrayClient.cpp 21 Oct 2004 05:04:17 -0000 1.2
@@ -5,28 +5,50 @@
#include "ArrayTestPortType.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";
+
+ // Set default service URL
+ sprintf (endpoint, "http://localhost/axis/array");
+ // 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/array", 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;
+
ArrayTestPortType ws(endpoint);
//testing echoIntArray
intArrayType arrin;