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 wh...@apache.org on 2004/12/09 18:18:36 UTC
cvs commit: ws-axis/c/src/server/simple_axis_server SimpleAxisServer.cpp
whitlock 2004/12/09 09:18:36
Modified: c/build build.OS400.properties buildSimpleAxisServer.xml
buildTransport.xml
c/src/server/simple_axis_server SimpleAxisServer.cpp
Log:
Committing fixes for AXISCPP-315 on behalf on Nadir Amra
Revision Changes Path
1.6 +19 -31 ws-axis/c/build/build.OS400.properties
Index: build.OS400.properties
===================================================================
RCS file: /home/cvs/ws-axis/c/build/build.OS400.properties,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -r1.5 -r1.6
--- build.OS400.properties 18 Nov 2004 16:08:20 -0000 1.5
+++ build.OS400.properties 9 Dec 2004 17:18:36 -0000 1.6
@@ -17,20 +17,16 @@
#####################
# Typical values are:
-# For Xerces, on Windows:
-# xmlParser = xerces
-# xmlParserLibrary = xerces-c_2
-# For Xerces, on Unix:
-# xmlParser = xerces
-# xmlParserLibrary = xerces-c
-# For Expat, on Unix:
-# xmlParser = expat
-# xmlParserLibrary = expat
+# For Xerces, on Windows:
+# xmlParser = xerces
+# xmlParserLibrary = xerces-c_2
+# For Xerces, on Unix:
+# xmlParser = xerces
+# xmlParserLibrary = xerces-c
# Parsers to be used
xmlParser.xml4c = true
xmlParser.xerces = false
-xmlParser.expat = false
## Values used for XML4C
xml4c.xmlParserLibrary = xml4c
@@ -42,10 +38,6 @@
xerces.dir.xmlParser = ${env.XERCES_HOME}
xerces.xmlParserLibraryName = axis_xerces
-## Values used for Expat
-expat.xmlParserLibrary = expat
-expat.dir.xmlParser = ${env.EXPAT_HOME}
-expat.xmlParserLibraryName = axis_expat
# Name for compiled XML Parser library - excluding any prefix or suffix
# eg: For Windows : axis_xmlparser will produce axis_xmlparser.dll
@@ -57,18 +49,14 @@
########################
# Transports to be used
-transport.axis = false
transport.axis2 = true
-transport.libwww = false
-
-## Values used for axis
-axis.transportLibraryName = axis_transport
+transport.axis2.ipv6 = false
## Values used for axis2
axis2.transportLibraryName = axis2_transport
-## Values used for libwww
-libwww.transportLibraryName = libwww_transport
+## Values used for axis2
+axis2.ipv6.transportLibraryName = axis2ipv6_transport
# Name for compiled transport library - excluding any prefix or suffix
# eg: For Windows : axis_transport will produce axis_transport.dll
@@ -130,7 +118,7 @@
###########################
# Location of output tree #
###########################
-dir.obj = ${basedir}/../../../obj
+dir.obj = ${basedir}/obj
####################
# Trace Properties #
@@ -205,15 +193,15 @@
# Prefix and suffix used for executables and libraries
# Typical values are:
# For windows:
-# executableSuffix = .exe
-# librarySuffix = .dll
-# libraryPrefix =
-# For unix:
-# executableSuffix =
-# librarySuffix = .so
-# libraryPrefix = lib
-# For AIX (as Unix, except):
-# librarySuffix = .a
+# executableSuffix = .exe
+# librarySuffix = .dll
+# libraryPrefix =
+# For unix:
+# executableSuffix =
+# librarySuffix = .so
+# libraryPrefix = lib
+# For AIX (as Unix, except):
+# librarySuffix = .a
executableSuffix =
librarySuffix = .so
libraryPrefix = lib
1.2 +32 -29 ws-axis/c/build/buildSimpleAxisServer.xml
Index: buildSimpleAxisServer.xml
===================================================================
RCS file: /home/cvs/ws-axis/c/build/buildSimpleAxisServer.xml,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -r1.1 -r1.2
--- buildSimpleAxisServer.xml 2 Nov 2004 15:19:44 -0000 1.1
+++ buildSimpleAxisServer.xml 9 Dec 2004 17:18:36 -0000 1.2
@@ -1,32 +1,35 @@
<project name="Axis C Simple Axis Server" default="compileSimpleAxisServer" basedir="..">
- <!--
- Compile the Simple Axis Server
- -->
- <target name="compileSimpleAxisServer">
- <mkdir dir="${dir.objects}"/>
- <mkdir dir="${dir.bin}"/>
- <cc outfile="${dir.bin}/${simpleAxisServerExecutableName}" objdir="${dir.objects}"
- exceptions="true" outtype="executable" multithreaded="true">
- <!-- Compilers -->
- <compiler refid="SolarisCC"/>
- <compiler refid="Linuxgcc"/>
- <compiler extends="VisualC++"/>
- <compiler refid="AIXxlc"/>
+ <!--
+ Compile the Simple Axis Server
+ -->
+ <target name="compileSimpleAxisServer">
+ <mkdir dir="${dir.objects}"/>
+ <mkdir dir="${dir.bin}"/>
+ <cc outfile="${dir.bin}/${simpleAxisServerExecutableName}" objdir="${dir.objects}"
+ exceptions="true" outtype="executable" multithreaded="true">
+ <!-- Compilers -->
+ <compiler refid="SolarisCC"/>
+ <compiler refid="Linuxgcc"/>
+ <compiler extends="VisualC++"/>
+ <compiler refid="AIXxlc"/>
<compiler refid="OS400icc"/>
- <!-- Linkers -->
- <linker refid="SolarisLinker"/>
- <linker refid="LinuxLinker"/>
- <linker extends="VisualC++Linker">
- <syslibset libs="wsock32"/>
- </linker>
- <linker refid="AIXExecutableLinker"/>
- <linker refid="OS400Linker"/>
- <libset dir="${dir.bin}" libs="${serverEngineLibraryName}"/>
- <!-- Files to be compiled -->
- <fileset dir="${dir.src}">
- <include name="server/simple_axis_server/*.cpp"/>
- </fileset>
- </cc>
- </target>
-</project>
\ No newline at end of file
+ <!-- Linkers -->
+ <linker refid="SolarisLinker"/>
+ <linker refid="LinuxLinker"/>
+ <linker extends="VisualC++Linker">
+ <syslibset libs="wsock32"/>
+ </linker>
+ <linker refid="AIXExecutableLinker"/>
+ <linker extends="OS400Linker">
+ <linkerarg location="end" value="${dir.bin}/lib${serverEngineLibraryName}.so"/>
+ </linker>
+ <libset dir="${dir.bin}" libs="${serverEngineLibraryName}" unless="os400"/>
+ <!-- Files to be compiled -->
+ <fileset dir="${dir.src}">
+ <include name="server/simple_axis_server/*.cpp"/>
+ </fileset>
+ </cc>
+ </target>
+</project>
+
1.4 +49 -48 ws-axis/c/build/buildTransport.xml
Index: buildTransport.xml
===================================================================
RCS file: /home/cvs/ws-axis/c/build/buildTransport.xml,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -r1.3 -r1.4
--- buildTransport.xml 7 Dec 2004 08:38:10 -0000 1.3
+++ buildTransport.xml 9 Dec 2004 17:18:36 -0000 1.4
@@ -1,53 +1,54 @@
<project name="Axis C Transport" default="compileAxisTransport" basedir="..">
- <!--
- Compile the Axis Transport Library
- -->
- <target name="compileAxisTransport">
- <mkdir dir="${dir.objects}"/>
- <mkdir dir="${dir.bin}"/>
- <if>
- <not>
- <isset property="aix"/>
- </not>
- <then>
- <cc outfile="${dir.bin}/${transportLibraryName}" objdir="${dir.objects}"
- exceptions="true" outtype="shared" multithreaded="true">
- <!-- Compilers -->
- <compiler refid="SolarisCC"/>
- <compiler refid="Linuxgcc"/>
- <compiler extends="VisualC++">
- <defineset>
- <define name="AXISTRANSPORTDLL_EXPORTS"/>
- </defineset>
- </compiler>
+ <!--
+ Compile the Axis Transport Library
+ -->
+ <target name="compileAxisTransport">
+ <mkdir dir="${dir.objects}"/>
+ <mkdir dir="${dir.bin}"/>
+ <if>
+ <not>
+ <isset property="aix"/>
+ </not>
+ <then>
+ <cc outfile="${dir.bin}/${transportLibraryName}" objdir="${dir.objects}"
+ exceptions="true" outtype="shared" multithreaded="true">
+ <!-- Compilers -->
+ <compiler refid="SolarisCC"/>
+ <compiler refid="Linuxgcc"/>
+ <compiler extends="VisualC++">
+ <defineset>
+ <define name="AXISTRANSPORTDLL_EXPORTS"/>
+ </defineset>
+ </compiler>
<compiler refid="OS400icc"/>
- <!-- Linkers -->
- <linker refid="SolarisLinker"/>
- <linker refid="LinuxLinker"/>
- <linker extends="VisualC++Linker">
- <syslibset libs="wsock32"/>
- </linker>
+ <!-- Linkers -->
+ <linker refid="SolarisLinker"/>
+ <linker refid="LinuxLinker"/>
+ <linker extends="VisualC++Linker">
+ <syslibset libs="wsock32"/>
+ </linker>
<linker refid="OS400Linker"/>
- <!-- Files to compile -->
- <fileset dir="${dir.src}">
- <include name="transport/${transport}/*.cpp"/>
- </fileset>
- </cc>
- </then>
- <else>
- <cc outfile="${dir.bin}/${libraryPrefix}${transportLibraryName}${librarySuffix}" objdir="${dir.objects}"
- exceptions="true" multithreaded="true">
- <!-- Compilers -->
- <compiler refid="AIXxlc"/>
- <!-- Linkers -->
- <linker refid="AIXLinker"/>
- <!-- Files to compile -->
- <fileset dir="${dir.src}">
- <include name="transport/${transport}/*.cpp"/>
- </fileset>
- </cc>
- </else>
- </if>
- </target>
+ <!-- Files to compile -->
+ <fileset dir="${dir.src}">
+ <include name="transport/${transport}/*.cpp"/>
+ <include name="platforms/os400/PlatformSpecificOS400.cpp" if="os400"/>
+ </fileset>
+ </cc>
+ </then>
+ <else>
+ <cc outfile="${dir.bin}/${libraryPrefix}${transportLibraryName}${librarySuffix}" objdir="${dir.objects}"
+ exceptions="true" multithreaded="true">
+ <!-- Compilers -->
+ <compiler refid="AIXxlc"/>
+ <!-- Linkers -->
+ <linker refid="AIXLinker"/>
+ <!-- Files to compile -->
+ <fileset dir="${dir.src}">
+ <include name="transport/${transport}/*.cpp"/>
+ </fileset>
+ </cc>
+ </else>
+ </if>
+ </target>
</project>
1.32 +97 -94 ws-axis/c/src/server/simple_axis_server/SimpleAxisServer.cpp
Index: SimpleAxisServer.cpp
===================================================================
RCS file: /home/cvs/ws-axis/c/src/server/simple_axis_server/SimpleAxisServer.cpp,v
retrieving revision 1.31
retrieving revision 1.32
diff -u -r1.31 -r1.32
--- SimpleAxisServer.cpp 23 Nov 2004 04:00:16 -0000 1.31
+++ SimpleAxisServer.cpp 9 Dec 2004 17:18:36 -0000 1.32
@@ -1,33 +1,34 @@
/* -*- C++ -*- */
/*
- * Copyright 2003-2004 The Apache Software Foundation.
- *
- * 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.
- *
- *
- * @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
- * @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
- *
- */
+* Copyright 2003-2004 The Apache Software Foundation.
+*
+* 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.
+*
+*
+* @author Roshan Weerasuriya (roshan@opensource.lk, roshanw@jkcsworld.com)
+* @author Samisa Abeysinghe (sabeysinghe@virtusa.com)
+*
+*/
#ifdef WIN32
-#include <winsock2.h> // for socket(),...
+#include <winsock2.h> // for socket(),...
#else //Linux
#include <sys/socket.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/time.h>
#endif
#include "SimpleAxisTransport.h"
@@ -37,7 +38,7 @@
extern int process_request (SOAPTransport * str);
-#define MAXPENDING 5 // Maximum outstanding connection requests
+#define MAXPENDING 5 // Maximum outstanding connection requests
#ifdef WIN32
#define AXIS_SOCKET_ERROR SOCKET_ERROR
#else //Linux
@@ -47,34 +48,34 @@
#define AXIS_URI_EXTENSION "/axis"
/* Following is the character that should be used to separate the method name
- * in the SOAPAction header value. Ex: "http://localhost:80/axis/Calculator#Add"
- */
+* in the SOAPAction header value. Ex: "http://localhost:80/axis/Calculator#Add"
+*/
#define SOAPACTION_METHODNAME_SEPARATOR "#"
int
createTCPServerSocket (unsigned short port)
{
- int sock; /* socket to create */
- struct sockaddr_in echoServAddr; /* Local address */
+ int sock; /* socket to create */
+ struct sockaddr_in echoServAddr; /* Local address */
/* Create socket for incoming connections */
if ((sock = socket (PF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
- printf ("%s\n", "socket() failed");
+ printf ("%s\n", "socket() failed");
/* Construct local address structure */
- memset (&echoServAddr, 0, sizeof (echoServAddr)); /* Zero out structure */
- echoServAddr.sin_family = AF_INET; /* Internet address family */
- echoServAddr.sin_addr.s_addr = htonl (INADDR_ANY); /* Any incoming interface */
- echoServAddr.sin_port = htons (port); /* Local port */
+ memset (&echoServAddr, 0, sizeof (echoServAddr)); /* Zero out structure */
+ echoServAddr.sin_family = AF_INET; /* Internet address family */
+ echoServAddr.sin_addr.s_addr = htonl (INADDR_ANY); /* Any incoming interface */
+ echoServAddr.sin_port = htons (port); /* Local port */
/* Bind to the local address */
if (bind (sock, (struct sockaddr *) &echoServAddr,
- sizeof (echoServAddr)) < 0)
- printf ("%s\n", "bind() failed");
+ sizeof (echoServAddr)) < 0)
+ printf ("%s\n", "bind() failed");
/* Mark the socket so it will listen for incoming connections */
if (listen (sock, MAXPENDING) < 0)
- printf ("%s\n", "listen() failed");
+ printf ("%s\n", "listen() failed");
return sock;
}
@@ -82,14 +83,16 @@
int
acceptTCPConnection (int servSock)
{
- int clntSock; /* Socket descriptor for client */
- struct sockaddr_in echoClntAddr; /* Client address */
+ int clntSock; /* Socket descriptor for client */
+ struct sockaddr_in echoClntAddr; /* Client address */
#if defined WIN32
- int clntLen; /* Length of client address data structure */
+ int clntLen; /* Length of client address data structure */
#elif defined AIX
- unsigned long clntLen; /* Length of client address data structure */
+ unsigned long clntLen; /* Length of client address data structure */
+#elif defined __OS400__
+ socklen_t clntLen;
#else //Linux
- unsigned int clntLen; /* Length of client address data structure */
+ unsigned int clntLen; /* Length of client address data structure */
#endif
/* Set the size of the in-out parameter */
@@ -97,10 +100,10 @@
/* Wait for a client to connect */
if ((clntSock = accept (servSock, (struct sockaddr *) &echoClntAddr,
- &clntLen)) < 0)
+ &clntLen)) < 0)
{
- printf ("%s\n", "accept() failed");
- //AxisSocketUtils::printSocketErrorDescription ();
+ printf ("%s\n", "accept() failed");
+ //AxisSocketUtils::printSocketErrorDescription ();
}
/* clntSock is connected to a client! */
@@ -118,7 +121,7 @@
if (0 != process_request (pTransport))
{
- printf ("process_request FAILED\n");
+ printf ("process_request FAILED\n");
}
delete pTransport;
@@ -128,22 +131,22 @@
main (int argc, char *argv[])
{
- int *servSock; /* Socket descriptors for server */
+ int *servSock; /* Socket descriptors for server */
#ifdef WIN32
- WSADATA wsaData; /* Structure for WinSock setup communication */
+ WSADATA wsaData; /* Structure for WinSock setup communication */
#else //Linux
#endif
- fd_set sockSet; /* Set of socket descriptors for select() */
- int maxDescriptor; /* Maximum socket descriptor value */
- struct timeval selTimeout; /* Timeout for select() */
- long timeout = 1000; /* Timeout value given on command-line */
+ fd_set sockSet; /* Set of socket descriptors for select() */
+ int maxDescriptor; /* Maximum socket descriptor value */
+ struct timeval selTimeout; /* Timeout for select() */
+ long timeout = 1000; /* Timeout value given on command-line */
int running = 1;
int iServerPort;
int iPort;
- int noPorts = 1; /* Number of ports is argument count minus 2 */
+ int noPorts = 1; /* Number of ports is argument count minus 2 */
servSock = new int[noPorts];
/* Initialize maxDescriptor for use by select() */
maxDescriptor = -1;
@@ -151,15 +154,15 @@
if (argc < 2)
{
- printf ("Problem occured.\nUsage: %s <Server Port>", argv[0]);
- exit (1);
+ printf ("Problem occured.\nUsage: %s <Server Port>", argv[0]);
+ exit (1);
}
#ifdef WIN32
- if (WSAStartup (MAKEWORD (2, 0), &wsaData) != 0) /* Load Winsock 2.0 DLL */
+ if (WSAStartup (MAKEWORD (2, 0), &wsaData) != 0) /* Load Winsock 2.0 DLL */
{
- fprintf (stderr, "WSAStartup() failed");
- exit (1);
+ fprintf (stderr, "WSAStartup() failed");
+ exit (1);
}
#else //Linux
#endif
@@ -168,17 +171,17 @@
iServerPort = atoi (argv[1]);
if (iServerPort == 0)
{
- printf ("Problem occured. Error in specified server port");
- exit (1);
+ printf ("Problem occured. Error in specified server port");
+ exit (1);
}
else
{
- servSock[0] = createTCPServerSocket (iServerPort);
- /* Determine if new descriptor is the largest */
- if (servSock[0] > maxDescriptor)
- {
- maxDescriptor = servSock[0];
- }
+ servSock[0] = createTCPServerSocket (iServerPort);
+ /* Determine if new descriptor is the largest */
+ if (servSock[0] > maxDescriptor)
+ {
+ maxDescriptor = servSock[0];
+ }
}
///////////////
@@ -188,38 +191,38 @@
while (running)
{
- FD_ZERO (&sockSet);
- FD_SET (servSock[0], &sockSet);
+ FD_ZERO (&sockSet);
+ FD_SET (servSock[0], &sockSet);
- /* Timeout specification */
- /* This must be reset every time select() is called */
- selTimeout.tv_sec = timeout; /* timeout (secs.) */
- selTimeout.tv_usec = 0; /* 0 microseconds */
-
- if (select (maxDescriptor + 1, &sockSet, NULL, NULL, &selTimeout) ==
- 0)
- {
- /*
- * DEBUG line
- * printf("No echo requests for %ld secs...Server still alive\n",
- * timeout);
- */
- }
- else
- {
- if (FD_ISSET (servSock[0], &sockSet))
- {
- //initializeStuff ();
- /*
- * DEBUG line
- * printf("Request on port %d (cmd-line position): \n", 0);
- */
- handleTCPClient (acceptTCPConnection (servSock[0]));
- }
- }
+ /* Timeout specification */
+ /* This must be reset every time select() is called */
+ selTimeout.tv_sec = timeout; /* timeout (secs.) */
+ selTimeout.tv_usec = 0; /* 0 microseconds */
+
+ if (select (maxDescriptor + 1, &sockSet, NULL, NULL, &selTimeout) ==
+ 0)
+ {
+ /*
+ * DEBUG line
+ * printf("No echo requests for %ld secs...Server still alive\n",
+ * timeout);
+ */
+ }
+ else
+ {
+ if (FD_ISSET (servSock[0], &sockSet))
+ {
+ //initializeStuff ();
+ /*
+ * DEBUG line
+ * printf("Request on port %d (cmd-line position): \n", 0);
+ */
+ handleTCPClient (acceptTCPConnection (servSock[0]));
+ }
+ }
- // AXISTRACE3("end of main while");
+ // AXISTRACE3("end of main while");
}
//uninitializing Axis
@@ -229,9 +232,9 @@
for (iPort = 0; iPort < noPorts; iPort++)
{
#ifdef WIN32
- closesocket (servSock[iPort]);
+ closesocket (servSock[iPort]);
#else //Linux
- close (servSock[iPort]);
+ close (servSock[iPort]);
#endif
}
@@ -239,7 +242,7 @@
delete [] servSock;
#ifdef WIN32
- WSACleanup (); /* Cleanup Winsock */
+ WSACleanup (); /* Cleanup Winsock */
#else //Linux
#endif