Linux Notes: gSOAP on CentOS-7 (and higher)

  1. The information presented here is intended for educational use by qualified computer technologists.
  2. The information presented here is provided free of charge, as-is, with no warranty of any kind.
Edit: 2024-03-16

Introduction

Official gsoap instructions are provided only for UNIX and Windows.

The following instructions are specific to Linux (CentOS, RHEL, Rocky).

Installing gsoap

Many self-help sites instruct you to build a second copy of Apache from source files just so you can gain access to apxs (APache eXtenSion tool). While this is possible on UNIX or Linux and can make initial development easier, it is not necessary on Linux since most distros can add apxs to your system via the "httpd-devel" package.

caveat: yum is the package manager on CentOS-7 and RHEL-7. Starting with version 8, yum commands are translated into dnf commands

command notes
yum list \*-release\* display all available distros
yum install epel-release
install yum support for the epel distro (required for gsoap)
yum list gsoap\*
display all available gsoap packages (usually three)
  1. gsoap
  2. gsoap-devel
  3. gsoap-doc
yum install gsoap\*
install all three gsoap packages
yum install zlib-devel some builds of mod_gsoap may require zlib
yum list httpd\*
display available Apache packages
yum install httpd-devel
install the Apache development package (required for apxs)

Installing mod_gsoap

Building mod_gsoap

caveats:

command notes
cd $HOME
navigate to your home folder
mkdir gsoap/apache
create sub folders gsoap with apache underneath it

[[[ use sftp to drop your folder here ]]]
cd gsoap/apache/mod_gsoap-0.6/apache_20
place to build mod_gsoap.so for Apache2
sudo apxs -i -c mod_gsoap.c -DWITH_GZIP -lz will first create hidden working folder .libs
will produce .libs/mod_gsoap.so (shared object)
"-i" will install the object in: /usr/lib64/https/modules/
Do not use "-a" which will mess around with /etc/httpd/conf/httpd.conf

[neil@kawc4n apache_20]$ sudo apxs -i -c mod_gsoap.c
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -std=gnu99 -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexcep
tions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic  -DLINUX -D_REENTRANT -D_GNU_SOUR
CE -pthread -I/usr/include/httpd  -I/usr/include/apr-1   -I/usr/include/apr-1   -c -o mod_gsoap.lo mod_gsoap.c && touch mod_gsoap.sl
o
mod_gsoap.c:57:0: warning: "TRUE" redefined [enabled by default]
 #define TRUE ((int)0xffff)
 ^
In file included from /usr/include/apr-1/apr_pools.h:45:0,
                 from /usr/include/apr-1/apr_strings.h:50,
                 from mod_gsoap.c:28:
/usr/include/apr-1/apr_general.h:55:0: note: this is the location of the previous definition
 #define TRUE (!FALSE)
 ^
mod_gsoap.c: In function 'SoapSharedLibrary_unload':
mod_gsoap.c:261:13: warning: unused variable 'nClose' [-Wunused-variable]
         int nClose = dlclose(This->m_hLibrary);
             ^
mod_gsoap.c: In function 'gsoap_handler':
mod_gsoap.c:927:11: warning: variable 'pszResponse' set but not used [-Wunused-but-set-variable]
     char *pszResponse = NULL;
           ^
mod_gsoap.c: At top level:
mod_gsoap.c:1303:24: warning: "/*" within comment [-Wcomment]
      "http://www.w3.org/*\//soap-envelope"},
 ^
mod_gsoap.c:1305:24: warning: "/*" within comment [-Wcomment]
      "http://www.w3.org/*\/soap-encoding"},
 ^
mod_gsoap.c:1307:24: warning: "/*" within comment [-Wcomment]
      "http://www.w3.org/*\//XMLSchema-instance"},
 ^
mod_gsoap.c:1309:24: warning: "/*" within comment [-Wcomment]
      "http://www.w3.org/*\//XMLSchema"},
 ^
mod_gsoap.c:438:1: warning: 'SoapSharedLibraries_clear' defined but not used [-Wunused-function]
 SoapSharedLibraries_clear(SoapSharedLibraries *This)
 ^
mod_gsoap.c:1142:13: warning: 'gsoap_child_init' defined but not used [-Wunused-function]
 static void gsoap_child_init(server_rec *s, apr_pool_t*p)
             ^
mod_gsoap.c:1155:13: warning: 'gsoap_child_exit' defined but not used [-Wunused-function]
 static void gsoap_child_exit(server_rec *s, apr_pool_t*p)
             ^
/usr/lib64/apr-1/build/libtool --silent --mode=link gcc -std=gnu99 -Wl,-z,relro,-z,now   -o mod_gsoap.la  -rpath /usr/lib64/httpd/mo
dules -module -avoid-version    mod_gsoap.lo
/usr/lib64/httpd/build/instdso.sh SH_LIBTOOL='/usr/lib64/apr-1/build/libtool' mod_gsoap.la /usr/lib64/httpd/modules
/usr/lib64/apr-1/build/libtool --mode=install install mod_gsoap.la /usr/lib64/httpd/modules/
libtool: install: install .libs/mod_gsoap.so /usr/lib64/httpd/modules/mod_gsoap.so
libtool: install: install .libs/mod_gsoap.lai /usr/lib64/httpd/modules/mod_gsoap.la
libtool: install: install .libs/mod_gsoap.a /usr/lib64/httpd/modules/mod_gsoap.a
libtool: install: chmod 644 /usr/lib64/httpd/modules/mod_gsoap.a
libtool: install: ranlib /usr/lib64/httpd/modules/mod_gsoap.a
libtool: finish: PATH="/sbin:/bin:/usr/sbin:/usr/bin:/sbin" ldconfig -n /usr/lib64/httpd/modules
----------------------------------------------------------------------
Libraries have been installed in:
   /usr/lib64/httpd/modules

If you ever happen to want to link against installed libraries
in a given directory, LIBDIR, you must either use libtool, and
specify the full pathname of the library, or use the `-LLIBDIR'
flag during linking and do at least one of the following:
   - add LIBDIR to the `LD_LIBRARY_PATH' environment variable
     during execution
   - add LIBDIR to the `LD_RUN_PATH' environment variable
     during linking
   - use the `-Wl,-rpath -Wl,LIBDIR' linker flag
   - have your system administrator add LIBDIR to `/etc/ld.so.conf'

See any operating system documentation about shared libraries for
more information, such as the ld(1) and ld.so(8) manual pages.
----------------------------------------------------------------------
chmod 755 /usr/lib64/httpd/modules/mod_gsoap.so
[neil@kawc4n apache_20]$ sudo find / -name mod_gsoap.so -exec ls -la {} \;
-rwxr-xr-x. 1 root root 83944 Mar  3 09:12 /home/neil/gsoap/apache/mod_gsoap-0.6/apache_20/.libs/mod_gsoap.so
-rwxr-xr-x. 1 root root 83944 Mar  3 09:12 /usr/lib64/httpd/modules/mod_gsoap.so
[neil@kawc4n apache_20]$

Editing /etc/httpd/conf/httpd/conf

<VirtualHost *:80>
	DocumentRoot "/var/www/html"
	ErrorLog "logs/kawc4n_80_error_log"
	AddType image/x-icon .ico
...
... snip ...
... # ================================================================ # I need this to serve up "index.html" # <Directory "/var/www/html"> Options Indexes FollowSymLinks AllowOverride None Require all granted </Directory> # ================================================================ ScriptAlias /cgi-bin/ "/var/www/cgi-bin/" # ================================================================ # # NSR gsoap experiments # # notes: # 1) this area is only for gsoap services run via plugin mod_gsoap (not executables run from cgi-bin) # 2) these gsoap services must have been built using 'apxs' (see my notes) # 3) the plugin mod_gsoap for Apache-2.x works differently than Apache-1.x # 4) <Location /soap> is used in the connect string like so: http://kawc4n.on.bell.ca/soap # 5) make sure calcserver3.so has privs which can be used by Apache # 6) reminders: # 6a apachectl configtest -AND- apachectl -l -AND- apachectl -M # 6b apachectl graceful -OR- apachectl restart # 6c systemctl status httpd.service # 7) requires mod_authz_core.so (loaded many lines before this place) # LogLevel debug LogLevel trace8 LoadModule gsoap_module modules/mod_gsoap.so #<IfModule mod_gsoap.c> <Location "/soap"> SetHandler gsoap_handler SOAPLibrary /usr/lib64/httpd/modules/some-demo.so #Require all granted Order allow,deny Allow from all </Location>
<Location "/calcserver3"> SetHandler gsoap_handler SOAPLibrary /usr/lib64/httpd/modules/calcserver3.so #Require all granted Order allow,deny Allow from all </Location> #</IfModule> </VirtualHost>

Links


Back to Home
Neil Rieck
Waterloo, Ontario, Canada.