Testing PyWPS ************* Testing PyWPS can be done on the command line -- it is the easier way, how to get both -- standard error and standard output -- at once. Testing in the web server environment can be done later. Before we start to test, be aware that we assume the following: 1 - PyWPS is installed properly, see :ref:`installation` 2 - Configuration file is stored in :file:`/usr/local/wps/pywps.cfg`, see :ref:`configuration` 3 - At least one process is stored in the :file:`/usr/local/wps/processes` directory. 4 - There is a :file:`/usr/local/wps/processes/__init__.py` file, with at least:: __all__ = ['yourProcess'] text in it. For testing purposes, we assume that `yourProcess` is `ultimatequestionprocess`. For further reading about how to setup custom processes, see :ref:`custom-processes`. For testing, we are using HTTP GET KVP encoding of OGC WPS request parameters. If you require clarification of WPS request parameters, please consult the `OGC WPS 1.0.0 `_ standard. .. note:: Be aware that this document describes PyWPS, which is a *server* implementation of OGC WPS. There is some graphical user interface to the server (WPS Clients), but for testing purposes, they are not suitable. That is the reason, why following section will use command line tools and direct XML outputs. Testing PyWPS installation ========================== Find the location of :file:`cgiwps.py` and run it without any further configuration.:: $ ./cgiwps.py And you should get result like this (which is a mixture of standard output and standard error):: Content-type: text/xml PyWPS NoApplicableCode: Locator: None; Value: No query string found. No query string found. Testing PyWPS configuration =========================== Now we have to export two environment variables: location of the configuration file and location of processes directory:: $ export PYWPS_CFG=/usr/local/wps/pywps.cfg $ export PYWPS_PROCESSES=/usr/local/wps/processes Afterwards, you can run the PyWPS CGI script. We will use HTTP GET requests, because they are easy to follow and faster to construct. GetCapabilities --------------- On the command line:: $ ./cgiwps.py "service=wps&request=getcapabilities" You should obtain a Capabilities response:: Content-Type: text/xml [...] .. note:: Have a more detailed look at the `... part of the output XML. There should be at least `Process` DescribeProcess --------------- On the command line:: $ ./cgiwps.py "service=wps&version=1.0.0&request=describeprocess&identifier=Process" You should obtain a ProcessDescriptions response:: ultimatequestionprocess The numerical answer to Life, Universe and Everything [...] Execute ------- On the command line:: $ ./cgiwps.py "service=wps&version=1.0.0&request=execute&identifier=ultimatequestionprocess" You should obtain an ExecuteResponse response (this may take some time):: ultimatequestionprocess Answer to Life, the Universe and Everything Numerical solution that is the answer to Life, Universe and Everything. The process is an improvement to Deep Tought computer (therefore version 2.0) since it no longer takes 7.5 milion years, but only a few seconds to give a response, with an update of status every 10 seconds. PyWPS Process ultimatequestionprocess successfully calculated answer The numerical answer to Life, Universe and Everything 42 Issues ====== .. note:: A list of known problems follows. If you have seen something different, please let us know via the mailing list. .. note:: Every error you get, should have standard error and standard output part, but they are mixed together. We describe here the most important part, the general error description. *Could not store file in compiled form: [Errno 13] Permission denied: 'pywps/Templates/1_0_0/GetCapabilities.tmplc'* PyWPS tries to store precompiled templates to Templates directory and does not have rights for it (or the user, under which PyWPS is running, does not have the rights, e.g. www-data). Change permissions of the directory, so that other users can write in it as well. *Process executed. Failed to build final response for output [los]: [Errno 13] Permission denied: '/var/tmp/pywps/los-6165.tif'* *Process executed. Failed to build final response for output [los]: [Errno 2] No such file or directory: '/var/tmp/pywpsx/los-6217.tif'* PyWPS probably successfully calculated the process, but when it tried to store result file to output directory, it failed. Try to set read-write access to directory with output files or create the output directory. *[Errno 2] No such file or directory: '/tmp/'* *[Errno 13] Permission denied: '/tmp/'* PyWPS did not find some directory or file, configured in the configuration file, or the appropriate permissions are not set. *No process in ProcessOfferings listed* The :envvar:`PYWPS_PROCESSES` is not set properly or there is no:: __all__ = ['ultimatequestionprocess'] in the :file:`__init__.py` in the :envvar:`PYWPS_PROCESSES` directory.