Version 26 (modified by trac, 15 years ago) |
---|
ZooKernel description page
On this page you will find everything you need to know about the ZooKernel.
Current status
Acutaly, you could compile and use the code available on the svn server on your own GNU / LINUX platform this way :
Requirements
To be able to compile the current source, you need to have some library allready installed on your system :
- FastCGI (installed in /path/to/trunk/dist/, using --prefix=/path/to/trunk/dist configure option),
- cgic (same, use just make from the /path/to/trunk/../third/cgic/ ) .
- libxml2,
- cURL,
- Python.
Getting the source code
To get the source code and compile on your platform, use the following command :
cd zoo/trunk/
svn checkout svn+ssh://dev.cartography.st/mnt/data3/zoo-project/trunk/zoo-kernel zoo-kernel
Compiling the source code
First of all, you'll need to edit the Makefile and uncomment "-DLINUX_FREE_ISSUE" on the first line, then use the following commands :
cd zoo-kernel
make
make zoo_loader.cgi
make demo_service.zo
Now, you get the ZooKernel (Shell and Cgi version) and two "service providers" of different kind : demo_service.zo (C++) and test_service.py (Python), now use them together.
Using the code
From the command line
To run request with ZooKernel from command command line, use the following example :
./service_loader ./ test_service.zo GetCapabilities ./service_loader ./Buffer.zcfg test_service.zo DescribeProcess ./service_loader ./Buffer.zcfg ./demo_service.zo Execute helloworld ./service_loader ./Buffer.zcfg ./demo_service.zo Execute printAgrument 1 2 ./service_loader ./Buffer.zcfg ./demo_service.zo Execute printAgrument 1 2 bg PYTHONPATH=. ./service_loader ./Distance.zcfg test_service Execute helloworld
Using ZOO Kernel from the command line is very usefull in development phase, this way you don't have to publish a not working ZOO Service Provider to test and check your service. It can be also useful for ZOO Kernel debuging purpose.
From an apache web server
You could use the cgi version of zoo_loader on your own apache server. Do do this, use the following instruction.
Copy the cgi script, the demo service and the required files in your cgi-bin directory.
cp /path/to/trunk/zoo-kernel/zoo_loader.cgi /var/www/localhost/cgi-bin cp /path/to/trunk/zoo-services/demo/demo_service.zo /var/www/localhost/cgi-bin/test_service.zo cp /path/to/trunk/zoo-services/*/cgi-bin/*zcfg /var/www/localhost/cgi-bin cp /path/to/trunk/zoo-kernel/*cfg /var/www/localhost/cgi-bin
Create a file called .htaccess in a zoo directory from the directory index of your apache instalaltion.
cat > /var/www/localhost/htdocs/zoo/.htaccess << EOF
RewriteEngine on
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{DOCUMENT_ROOT}/%{REQUEST_FILENAME} !=%{DOCUMENT_ROOT}/login.php
RewriteRule (.*)/(.*)/(.*) /cgi-bin/zoo_loader.cgi?ServiceProvider=$2&metapath=$1 [L,QSA]
RewriteRule (.*)/(.*)/ /cgi-bin/zoo_loader.cgi?ServiceProvider=$2&metapath=$1 [L,QSA]
RewriteRule (.*)/(.*) /cgi-bin/zoo_loader.cgi?ServiceProvider=$1&metapath= [L,QSA]
EOF
Then you have to request your installation using your favorite browser. For instance, this link should work from your Apache web server.
You could also see the Cgi Version from Shilpa !
Some samples requests running on the Shilpa server (using KVP requests) :
- DescribeProcess? samples :
- Execute samples :
- Arithmetics Service Provider :
- Basic GDAL Service Provider :
- Using Gdal_Translate to convert a GeoTiff datasource to an AAIGrid datasource.
- Using Gdal_Translate to crop a GeoTiff datasource and potentialy convert datasource format
- Use an xlink:href value (this is the used url)
- Use a WFS Request as an xlink:href valur (the WFS request used). See here to see maps data structure extracted from the apache error log correspoding to this request)
- Basic OGR Service :
- The WKS (Well Known Service :) ) Buffer Operation :
- Sample using ResponseDocument using a xlink:href WFS query URL-Encoded as a DataInputs? value
- Same sample using lineage (usefull to display the data).
- Sample using RawDataOutput using a xlink:href the same WFS query URL-Encoded as a DataInputs? value than the first one
- Distance
- GetArea
- ConvexHull
- Boundary
- The WKS (Well Known Service :) ) Buffer Operation :
- Python samples :
- Java samples :
- Fortran samples :
Some sample (using POST XML requests), to use those examples you will have to put the following XML documents in the textare on this page, then press "run using XML Request" to see the ZooKernel process your query :
- A simple GetCapabilities? request :
<wps:GetCapabilities xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsGetCapabilities_request.xsd" language="en-CA" service="WPS"> <wps:AcceptVersions> <ows:Version>1.0.0</ows:Version> </wps:AcceptVersions> </wps:GetCapabilities>
- A simple DescribeProcess? request :
<DescribeProcess xmlns="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsDescribeProcess_request.xsd" service="WPS" version="1.0.0" language="en-CA"> <ows:Identifier>Buffer</ows:Identifier> <ows:Identifier>Boundary</ows:Identifier> <ows:Identifier>GetArea</ows:Identifier> </DescribeProcess>
- A sample Execute request using ResponseDocument? (same as previous example using Buffer from basic ogr service) :
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsd"> <ows:Identifier>Buffer</ows:Identifier> <wps:DataInputs> <wps:Input> <ows:Identifier>InputPolygon</ows:Identifier> <ows:Title>Playground area</ows:Title> <wps:Reference xlink:href="http://carto.languedoc-roussillon.ecologie.gouv.fr/webservices/wfs/diren_general/?VERSION=1.1.0&service=WFS&request=GetFeature&typename=Znieff1&maxfeatures=1"/> </wps:Input> <wps:Input> <ows:Identifier>BufferDistance</ows:Identifier> <ows:Title>Distance which people will walk to get to a playground.</ows:Title> <wps:Data> <wps:LiteralData>400</wps:LiteralData> </wps:Data> </wps:Input> </wps:DataInputs> <wps:ResponseForm> <wps:ResponseDocument> <wps:Output> <ows:Identifier>BufferedPolygon</ows:Identifier> <ows:Title>Area serviced by playground.</ows:Title> <ows:Abstract>Area within which most users of this playground will live.</ows:Abstract> </wps:Output> </wps:ResponseDocument> </wps:ResponseForm> </wps:Execute>
- A sample Execute request using RawData? (same as previous example using Buffer from basic ogr service) :
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsd"> <ows:Identifier>Buffer</ows:Identifier> <wps:DataInputs> <wps:Input> <ows:Identifier>InputPolygon</ows:Identifier> <ows:Title>Playground area</ows:Title> <wps:Reference xlink:href="http://carto.languedoc-roussillon.ecologie.gouv.fr/webservices/wfs/diren_general/?VERSION=1.1.0&service=WFS&request=GetFeature&typename=Znieff1&maxfeatures=1"/> </wps:Input> <wps:Input> <ows:Identifier>BufferDistance</ows:Identifier> <ows:Title>Distance which people will walk to get to a playground.</ows:Title> <wps:Data> <wps:LiteralData>400</wps:LiteralData> </wps:Data> </wps:Input> </wps:DataInputs> <wps:ResponseForm> <wps:RawDataOutput> <ows:Identifier>BufferedPolygon</ows:Identifier> </wps:RawDataOutput> </wps:ResponseForm> </wps:Execute>
- A sample using two different kind of entities (GML reference and JSON String) :
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsd"> <ows:Identifier>Union</ows:Identifier> <wps:DataInputs> <wps:Input> <ows:Identifier>InputEntity1</ows:Identifier> <wps:Reference xlink:href="http://carto.languedoc-roussillon.ecologie.gouv.fr/webservices/wfs/diren_general/?VERSION=1.1.0&service=WFS&request=GetFeature&typename=Znieff1&maxfeatures=1"/> </wps:Input> <wps:Input> <ows:Identifier>InputEntity2</ows:Identifier> <wps:Data> <wps:ComplexData mimeType="application/json"> {"type":"Polygon","coordinates":[[[-102.036758,36.988972],[-106.860657,36.989491],[-109.047821,36.996643],[-109.055199,38.24493],[-109.052864,39.518196],[-109.050591,40.210545],[-109.047638,40.998474],[-107.918037,41.00341],[-104.051201,41.003227],[-102.620789,41.000225],[-102.047279,40.998077],[-102.04557,40.697323],[-102.036758,36.988972]]]} </wps:ComplexData> </wps:Data> </wps:Input> </wps:DataInputs> <wps:ResponseForm> <wps:ResponseDocument> <wps:Output> <ows:Identifier>Result</ows:Identifier> </wps:Output> </wps:ResponseDocument> </wps:ResponseForm> </wps:Execute>
- same Union sample using 2 embedded JSON Strings :
<wps:Execute service="WPS" version="1.0.0" xmlns:wps="http://www.opengis.net/wps/1.0.0" xmlns:ows="http://www.opengis.net/ows/1.1" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wps/1.0.0 ../wpsExecute_request.xsd"> <ows:Identifier>Union</ows:Identifier> <wps:DataInputs> <wps:Input> <ows:Identifier>InputEntity1</ows:Identifier> <wps:Data> <wps:ComplexData mimeType="application/json"> {"type":"Polygon","coordinates":[[[-102.036758,36.988972],[-106.860657,36.989491],[-109.047821,36.996643],[-109.055199,38.24493],[-109.052864,39.518196],[-109.050591,40.210545],[-109.047638,40.998474],[-107.918037,41.00341],[-104.051201,41.003227],[-102.620789,41.000225],[-102.047279,40.998077],[-102.04557,40.697323],[-102.036758,36.988972]]]} </wps:ComplexData> </wps:Data> </wps:Input> <wps:Input> <ows:Identifier>InputEntity2</ows:Identifier> <wps:Data> <wps:ComplexData mimeType="application/json"> {"type":"Polygon","coordinates":[[[-102.036758,36.988972],[-106.860657,36.989491],[-109.047821,36.996643],[-109.055199,38.24493],[-109.052864,39.518196],[-109.050591,40.210545],[-109.047638,40.998474],[-107.918037,41.00341],[-104.051201,41.003227],[-102.620789,41.000225],[-102.047279,40.998077],[-102.04557,40.697323],[-102.036758,36.988972]]]} </wps:ComplexData> </wps:Data> </wps:Input> </wps:DataInputs> <wps:ResponseForm> <wps:RawDataOutput> <wps:Output> <ows:Identifier>Result</ows:Identifier> </wps:Output> </wps:RawDataOutput> </wps:ResponseForm> </wps:Execute>