Version 9 (modified by nickboz, 10 years ago) |
---|
ZOO Services Hello Worlds
Say hello in WPS using the language of your choice
ZOO Services is a growing collection of ready to use Web Processing Services built on top of reliable open source libraries such as GDAL, GRASS GIS, OrfeoToolbox, CGAL and more. It aims at using existing geospatial algorithms through standard WPS, and provides a number of significant examples to build your own.
Hello world
JavaScript
function hellojs(conf,inputs,outputs){
outputs["result"]["value"]="Hello "+inputs["S"]["value"]+" from the JS World !";
//SERVICE_SUCEEDED
return Array(3,outputs);
}
Python
import zoo
def HelloPy(conf,inputs,outputs):
outputs["Result"]["value"]="Hello "+inputs["a"]["value"]+" from Python World !"
return zoo.SERVICE_SUCCEEDED
C
printf
C
Integer FUNCTION HELLOF(zoo_main_cfg,zoo_inputs,zoo_outputs)
& RESULT (R)
Integer R, ls, iLenStr
CHARACTER*(1024) zoo_main_cfg(10,30),zoo_inputs(10,30),
& zoo_outputs(10,30)
CHARACTER*(1024) TMP
write(0,*) 'Hello '//zoo_inputs(4,1)//' from the Fortran world !'
ls = iLenStr(zoo_inputs(4,1))
TMP = zoo_inputs(4,1)
zoo_outputs(1,1) = 'name'//CHAR(0)
zoo_outputs(2,1) = 'result'//CHAR(0)
zoo_outputs(3,1) = 'value'//CHAR(0)
zoo_outputs(4,1) = 'Hello '//TMP(1:ls)//
& ' from the Fortran world !'//CHAR(0)
zoo_outputs(5,1) = 'datatype'//CHAR(0)
zoo_outputs(6,1) = 'string'//CHAR(0)
R = 3
Return
END
Integer Function iLenStr(cString)
Character*(*) cString
Integer iLen,i
iLen = Len(cString)
Do i=iLen,1,-1
If(ichar(cString(i:i)).NE.0) Goto 10
EndDo
i = 1
10 Continue
iLenStr = i
Return
End Function iLenStr/code>
Java
import java.lang.*;
import java.util.*;
public class HelloJava {
public static int HelloWorldJava(HashMap conf,HashMap inputs, HashMap outputs) {
HashMap tmp=(HashMap)(inputs.get("S"));
String v=tmp.get("value").toString();
HashMap hm1 = (HashMap)(outputs.get("Result"));
hm1.put("value",ZOO._("Hello "+v+" from JAVA World !!"));
return ZOO.SERVICE_SUCCEEDED;
}
}
PHP
function HelloPHP(&$main_conf,&$inputs,&$outputs){
$tmp="Hello ".$inputs["S"]["value"]." from the PHP world !!";
$outputs["Result"]["value"]=zoo_Translate($tmp);
zoo_UpdateStatus($main_conf,"Final step",99);
return zoo_SERVICE_SUCCEEDED();
}
Perl
sub HelloPL {
my ($main_conf,$real_inputs,$real_outputs) = @_;
$real_outputs->{"Result"}->{"value"}=$real_inputs->{"a"}->{"value"};
return 3;
}