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 sa...@apache.org on 2006/01/26 08:16:20 UTC
svn commit: r372470 - in /webservices/axis2/trunk/c/test/core/clientapi:
echo.xml test_client.c
Author: samisa
Date: Wed Jan 25 23:16:13 2006
New Revision: 372470
URL: http://svn.apache.org/viewcvs?rev=372470&view=rev
Log:
Added some improvements
Added:
webservices/axis2/trunk/c/test/core/clientapi/echo.xml
Modified:
webservices/axis2/trunk/c/test/core/clientapi/test_client.c
Added: webservices/axis2/trunk/c/test/core/clientapi/echo.xml
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/clientapi/echo.xml?rev=372470&view=auto
==============================================================================
--- webservices/axis2/trunk/c/test/core/clientapi/echo.xml (added)
+++ webservices/axis2/trunk/c/test/core/clientapi/echo.xml Wed Jan 25 23:16:13 2006
@@ -0,0 +1 @@
+<?xml version='1.0' encoding='UTF-8'?><soapenv:Envelope xmlns:soapenv="http://www.w3.org/2003/05/soap-envelope"><soapenv:Body><echoString><text>echo5</text></echoString></soapenv:Body></soapenv:Envelope>
Modified: webservices/axis2/trunk/c/test/core/clientapi/test_client.c
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/c/test/core/clientapi/test_client.c?rev=372470&r1=372469&r2=372470&view=diff
==============================================================================
--- webservices/axis2/trunk/c/test/core/clientapi/test_client.c (original)
+++ webservices/axis2/trunk/c/test/core/clientapi/test_client.c Wed Jan 25 23:16:13 2006
@@ -44,11 +44,11 @@
}
}
- write_to_socket(hostname, port, filename);
+ write_to_socket(hostname, port, filename, endpoint);
return 0;
}
-int write_to_socket(char *address, char* port, char* filename)
+int write_to_socket(char *address, char* port, char* filename, char* endpoint)
{
axis2_char_t buffer_l[4999];
int sockfd, portno, n, i;
@@ -80,17 +80,17 @@
stat(filename, &buf);
bufsize = buf.st_size* sizeof(char);
buffer = (char *) malloc(bufsize);
- strcpy(buffer_l, "POST /axis2/services/RMInteropService\r\nUser-Agent: Axis/2.0\r\nConnection: Keep-Alive\r\nHost: ");
+ sprintf(buffer_l, "POST %s HTTP/1.1\r\nUser-Agent: Axis/2.0/C\r\nConnection: Keep-Alive\r\nHost: ", endpoint);
strcat(buffer_l, address);
strcat(buffer_l, ":");
strcat(buffer_l, port);
strcat(buffer_l, "\r\n");
strcat(buffer_l, "Content-Length: ");
- sprintf(tmpstr, "%d", buf.st_size);
+ sprintf(tmpstr, "%d", buf.st_size - 1);
strcat(buffer_l, tmpstr);
strcat(buffer_l, "\r\n");
- strcat(buffer_l, "application/soap+xml; charset=UTF-8;action=\"http://127.0.0.1:8070/axis2/services/RMInteropService/__OPERATION_OUT_IN__\"");
- strcat(buffer_l, "\r\n\r\n");
+ strcat(buffer_l, "Content-Type: application/soap+xml;\r\n");
+ strcat(buffer_l, "\r\n");
int fd = open(filename, O_RDONLY, 0);
if (fd == -1)
@@ -101,28 +101,37 @@
else
printf("opened file %s\n", filename);
+ printf("Writing buffer_1...\n%s", buffer_l);
n = write(sockfd, buffer_l, strlen(buffer_l));
- while((i = read(fd, buffer, bufsize - 1)) > 0)
- {
+ /*while((i = read(fd, buffer, bufsize - 1)) > 0)
+ {*/
+ i = read(fd, buffer, bufsize - 1);
buffer[i] = '\0';
+ printf("%s...\n", buffer);
n = write(sockfd,buffer,strlen(buffer));
if (n < 0)
error("ERROR writing to socket");
- }
+ /*n = write(sockfd,"\r\n",2);
+ if (n < 0)
+ error("ERROR writing to socket");*/
+ /*}*/
printf("Done writing to server\n");
buffer[0] = '\0';
- while((n = read(sockfd, buffer, bufsize -1)) > 0)
+ while((n = read(sockfd, buffer, bufsize - 1)) > 0)
{
- buffer[i] = '\0';
- printf("%s\n", buffer);
+ buffer[n] = '\0';
+ printf("%s %d\n", buffer, n);
}
- if (n < 0)
- error("ERROR reading from socket");
+ if (n < 0)
+ {
+ error("ERROR reading from socket");
+ buffer[0] = '\0';
+ }
printf("%s\n",buffer);
free(buffer);
}