This page presents the procedure to install, setup and test on CentOS6 or CentOS7 the Ophidia WPS interface for Ophidia Server.
Basically, the interface is a web proxy that translates the WPS Requests into JSON Requests, sends them to the Ophidia Server, waits for the corresponding JSON Responses, translates them into WPS Responses and, finally, sends the outputs to the WPS client.
Note
Before proceeding with the following steps, check that you have all the pre-requisites installed. In particular the web server and the WPS requirements.
Download PyWPS 3.2.4 from https://github.com/geopython/pywps/archive/pywps-3.2.4.tar.gz into /usr/local/ophidia/extra/src/pywps/.
mkdir -p /usr/local/ophidia/extra/src
cd /usr/local/ophidia/extra/src
wget https://github.com/geopython/pywps/archive/pywps-3.2.4.tar.gz
tar xzf /usr/local/ophidia/extra/src/pywps-3.2.4.tar.gz
mv /usr/local/ophidia/extra/src/pywps-pywps-3.2.4 /usr/local/ophidia/extra/src/pywps
Replace the main Python script /usr/local/ophidia/extra/src/pywps/wps.py with the script /usr/local/ophidia/extra/src/pywps/webservices/mod_python/wps.py adapted for mod_python and, then, install PyWPS (see section below for known issues).
cd /usr/local/ophidia/extra/src/pywps
cp -f /usr/local/ophidia/extra/src/pywps/webservices/mod_python/wps.py /usr/local/ophidia/extra/src/pywps
sudo python setup.py install
Create a folder /usr/local/ophidia/extra/wps and copy both the folders processes and etc inside:
mkdir -p /usr/local/ophidia/extra/src
cd /usr/local/ophidia/extra/src
git clone https://github.com/OphidiaBigData/ophidia-wps-module.git
mkdir -p /usr/local/ophidia/extra/wps
cp -R /usr/local/ophidia/extra/src/ophidia-wps-module/processes /usr/local/ophidia/extra/wps/
cp -R /usr/local/ophidia/extra/src/ophidia-wps-module/etc /usr/local/ophidia/extra/wps/
Install and configure mod_python by cloning it from https://github.com/grisha/mod_python.git. The following command list should be enough:
mkdir -p /usr/local/ophidia/extra/src
git clone https://github.com/grisha/mod_python.git
cd /usr/local/ophidia/extra/src/mod_python
./configure
make
sudo make install
Create the folder /var/www/wps, configure mod_python for Apache, by saving the following specification in /etc/httpd/conf.d/python.conf, and restart the service:
LoadModule python_module modules/mod_python.so
Alias /wps "/var/www/wps"
<Directory "/var/www/wps">
AllowOverride None
Order allow,deny
Allow from all
SetEnv PYWPS_PROCESSES /usr/local/ophidia/extra/wps/processes/
SetEnv PYWPS_CFG /usr/local/ophidia/extra/wps/etc/pywps.cfg
SetHandler python-program
PythonHandler wps
PythonAuthenHandler wps
PythonDebug On
PythonPath "sys.path+['/usr/local/ophidia/extra/src/pywps/']"
PythonAutoReload On
</Directory>
By default it is assumed that Ophidia Server is running on the same node where PyWPS works and listening to port 11732. Otherwise, change service address (IP address and port number) by editing /usr/local/ophidia/extra/wps/processes/ophidia.py.
Create the folders for PyWPS log file and WPS Responses (based on parameters set in /usr/local/ophidia/extra/wps/etc/pywps.cfg):
sudo mkdir -p /var/www/html/wpsoutputs
sudo mkdir -p /var/log/wps
sudo chown root:apache /var/www/html/wpsoutputs
sudo chmod 775 /var/www/html/wpsoutputs
sudo chown root:apache /var/log/wps
sudo chmod 775 /var/log/wps
Finally, enable Apache to open new connections in case SELinux is enabled as follows
sudo setsebool -P httpd_can_network_connect on
and restart the web server.
If PyWPS runs as an extension of Apache, default port to access Ophidia WPS is 443.
Ophidia WPS configuration is written in /usr/local/ophidia/extra/wps/etc/pywps.cfg. An example is the following file:
[wps]
encoding=utf-8
title=Ophidia WPS
version=1.0.0
serveraddress=https://server.hostname/wps/
keywords=WPS
lang=en-CA
[server]
maxoperations=30
maxinputparamlength=1024
maxfilesize=3mb
tempPath=/tmp
outputUrl=https://server.hostname/wpsoutputs
outputPath=/var/www/html/wpsoutputs
logFile=/var/log/wps/wps.log
logLevel=INFO
Change server metadata (for instance serveraddress and outputUrl) and, if needed, provide additional information.
Check the WPS interface by sending the requests “GetCababilities” and “DescribeProcess” as follows:
curl -k https://server.hostname/wps/?service=WPS&version=1.0.0&request=getcapabilities
curl -k https://server.hostname/wps/?service=WPS&version=1.0.0&request=describeprocess&identifier=ophexecutemain
Requested resources are XML documents with a number of details about the service and the process ophexecutemain, which is used by Ophidia Terminal to submit commands to Ophidia Server. See Ophidia Terminal Installation for additional information about the installation and configuration of Ophidia Terminal in order to submit commands to WPS interface.
Issue
After sending a WPS Request, Apache returns the following error:
Traceback (most recent call last):
File "/usr/local/ophidia/extra/src/pywps/wps.py", line 75, in handler
wps.parser.isSoap, self.wps.parser.isSoapExecute,contentType = wps.request.contentType)
NameError: global name 'self' is not defined
Solution
Delete the prefix self. in /usr/local/ophidia/extra/src/pywps/wps.py.