Changes between Version 33 and Version 34 of ZooWorkshop/FOSS4GJapan/CreatingOGRBasedWebServices
- Timestamp:
- Oct 16, 2010, 12:55:36 AM (14 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
ZooWorkshop/FOSS4GJapan/CreatingOGRBasedWebServices
v33 v34 17 17 == Preparing ZOO metadata file == 18 18 19 A ZOO Service is a combination of a ZOO metadata file (.zcfg) and the runtime module for the corresponding implementation, which is commonly called ZOO Service Provider. We will first prepare a .zcfg file step-by-step. Please open your preferred text editor and edit a file named Boundary.zcfg in your /home/user/zoows/sources/zoo-services/ws_sp directory. First, you need to name the service between brackets at the top of the file, as the following:19 A ZOO Service is a combination of a ZOO metadata file (.zcfg) and the runtime module for the corresponding implementation, which is commonly called ZOO Service Provider. We will first prepare a .zcfg file step-by-step. Please open your preferred text editor and edit a file named Boundary.zcfg in your {{{/home/user/zoows/sources/zoo-services/ws_sp directory}}}. First, you need to name the service between brackets at the top of the file, as the following: 20 20 21 21 {{{ … … 34 34 Such metadata informations will be returned by a !GetCapabilities request. 35 35 36 You can also add other specific informations like the processVersion. You can set if your ZOO Service can store its results, by setting the storeSupported parameter to true or false. You can also decide if the function can be run as a background task and inform on its current status, according to the statusSupportedvalue :36 You can also add other specific informations like the {{{processVersion}}}. You can set if your ZOO Service can store its results, by setting the {{{storeSupported}}} parameter to {{{true}}} or {{{false}}}. You can also decide if the function can be run as a background task and inform on its current status, according to the {{{statusSupported}}} value : 37 37 38 38 {{{ … … 44 44 45 45 In the main section of the ZOO Service metadata file, you must also specify two important things: 46 * serviceProvider, which is the name of the C shared library containing the Service function or the Python module name.47 * serviceType, which defines the programming language to be used for the Service. (value can be C or Python depending on what language you have decided to use)46 * {{{serviceProvider}}}, which is the name of the C shared library containing the Service function or the Python module name. 47 * {{{serviceType}}}, which defines the programming language to be used for the Service. (value can be C or Python depending on what language you have decided to use) 48 48 49 49 C !ServicesProvider Example : … … 54 54 }}} 55 55 56 In this case you will get an ogr_ws_service_provider.zoshared library containing the Boundary function, placed in the same directory than ZOO Kernel.56 In this case you will get an {{{ogr_ws_service_provider.zo}}} shared library containing the Boundary function, placed in the same directory than ZOO Kernel. 57 57 58 58 Python !ServicesProvider Example : … … 64 64 }}} 65 65 66 In this case, you will get an ogr_ws_service_provider.pyfile containing the Python code of your Boundary function.66 In this case, you will get an {{{ogr_ws_service_provider.py}}} file containing the Python code of your Boundary function. 67 67 68 68 In the main section you can also add any other metadata information, as the following: … … 77 77 The main metadata informations have been declared, so you can now define data input which will be used by the ZOO Service. You can define any input needed by the Service. Please note that you can request ZOO Kernel using more data input than defined in the .zcfg file without any problem, those values will be passed to your service without filtering. In the Boundary Service example, a single polygon will be used as input, the one on which to apply the Boundary function. 78 78 79 The data input declarations are included in a !DataInputs block. They use the same syntax as the Service itself and the input name is between brackets. You can also fill a title, an abstract and a MetaData section for the input. You must set values for the minOccurs and maxOccursparameters, as they will inform ZOO Kernel which parameters are required to be able to run the Service function.79 The data input declarations are included in a !DataInputs block. They use the same syntax as the Service itself and the input name is between brackets. You can also fill a title, an abstract and a {{{MetaData}}} section for the input. You must set values for the {{{minOccurs}}} and {{{maxOccurs}}} parameters, as they will inform ZOO Kernel which parameters are required to be able to run the Service function. 80 80 81 81 {{{ … … 91 91 }}} 92 92 93 The metadata defines what type of data the Service supports. In the Boundary example, the input polygon can be provided as a GML file or as a JSON string. Next step is thus to define the default and supported input formats. Both formats should be declared in a LitteralData or ComplexData block depending on their types. For this first example we will use ComplexDatablocks only.93 The metadata defines what type of data the Service supports. In the Boundary example, the input polygon can be provided as a GML file or as a JSON string. Next step is thus to define the default and supported input formats. Both formats should be declared in a {{{LitteralData}}} or {{{ComplexData}}} block depending on their types. For this first example we will use {{{ComplexData}}} blocks only. 94 94 95 95 {{{ … … 107 107 }}} 108 108 109 Then, the same metadata information must be defined for the output of the Service, inside a DataOutputsblock, as the following:109 Then, the same metadata information must be defined for the output of the Service, inside a {{{DataOutputs}}} block, as the following: 110 110 111 111 {{{ … … 133 133 http://zoo-project.org/trac/browser/trunk/zoo-services/ogr/base-vect-ops/cgi-env/Boundary.zcfg 134 134 135 Once the ZOO metadata file is modified, you have to copy it in the same directory than your ZOO Kernel (so in your case /usr/lib/cgi-bin). Then you should be able to run the following request :135 Once the ZOO metadata file is modified, you have to copy it in the same directory than your ZOO Kernel (so in your case {{{/usr/lib/cgi-bin}}}). Then you should be able to run the following request : 136 136 137 137 http://localhost/zoo/?Request=DescribeProcess&Service=WPS&Identifier=Boundary&version=1.0.0 … … 141 141 [[Image(Practical introduction to ZOO - 4.png,width=550px,nolink)]] 142 142 143 Please note that the GetCapabilities and DescribeProcess only need a .zcfg file to be completed. Simple, isn't it ? At this step, if you request ZOO Kernel for an Execute, you will get an ExceptionReportdocument as response, looking as the following :143 Please note that the GetCapabilities and DescribeProcess only need a .zcfg file to be completed. Simple, isn't it ? At this step, if you request ZOO Kernel for an {{{Execute}}}, you will get an {{{ExceptionReport}}} document as response, looking as the following : 144 144 145 145 [[Image(Practical introduction to ZOO - 5.png,width=550px,nolink)]]