Changeset 396 for trunk/docs
- Timestamp:
- Mar 26, 2013, 5:10:36 PM (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docs/services/howtos.txt
r348 r396 25 25 26 26 .. Note:: For each Service provided by your ZOO Python Services Provider, the ZCFG File 27 must be named the same as the Python module function name. 27 must be named the same as the Python module function name (also the case of 28 characters is important). 28 29 29 30 The ZCFG file should contain the following : … … 40 41 ************************** 41 42 42 The Python module's function to be used as a service must: 43 The Python module's function to be used take three arguments: the main configuration, inputs and outputs. 44 All this values are passed to the Python module as dictionaries. 43 45 44 - take three arguments : the main configuration, inputs and outputs maps are passed to the 45 Python module as dictionaries. 46 - return an integer : corresponding to the service status code. 46 Following you'll find an example for each parameters 47 47 48 Sample Data Structure 49 ********************* 48 Main configuration 49 ^^^^^^^^^^^^^^^^^^^^^ 50 Main configuration contains several informations, some of them are really useful to develop your service. 51 Following an example :: 50 52 51 In the following you'll find a sample argument passed to the Python module's function for 52 the two first main configuration file' sections. 53 { 54 'main': {'lang': 'en-UK', 55 'language': 'en-US', 56 'encoding': 'utf-8', 57 'dataPath': '/var/www/tmp', 58 'tmpPath': '/var/www/tmp', 59 'version': '1.0.0', 60 'mapserverAddress': 'http://localhost/cgi-bin/mapserv', 61 'isSoap': 'false', 62 'tmpUrl': 'http://localhost/tmp/', 63 'serverAddress': 'http://localhost/zoo' 64 }, 65 'identification': {'keywords': 'WPS,GIS', 66 'abstract': 'WPS services for testing ZOO', 67 'fees': 'None', 68 'accessConstraints': 'none', 69 'title': 'testing services' 70 }, 71 'lenv': {'status': '0', 72 'soap': 'false', 73 'cwd': '/usr/lib/cgi-bin', 74 'sid': '24709' 75 }, 76 'env': {'DISPLAY': 'localhost:0'}, 77 'provider': {'addressCountry': 'it', 78 'positionName': 'Developer', 79 'providerName': 'Name of provider', 80 'addressAdministrativeArea': 'False', 81 'phoneVoice': 'False', 82 'addressCity': 'City', 83 'providerSite': 'http://www.your.site', 84 'addressPostalCode': '38122', 85 'role': 'Developer', 86 'addressDeliveryPoint': 'False', 87 'phoneFacsimile': 'False', 88 'addressElectronicMailAddress': 'your@email.com', 89 'individualName': 'Your Name' 90 } 91 } 53 92 54 :: 93 Inputs 94 ^^^^^^^^^^^^ 95 The inputs are somethings like this :: 55 96 56 main={ 57 "main": {"encoding": "utf-8", 58 "version": "1.0.0", 59 "serverAddress": "http://www.zoo-project.org/zoo/", 60 "lang": "fr-FR,en-CA"}, 61 "identification": {"title": "The Zoo WPS Development Server", 62 "abstract": "Development version of ZooWPS.", 63 "fees": "None", 64 "accessConstraints": "none", 65 "keywords": "WPS,GIS,buffer"} 97 { 98 'variable_name': {'minOccurs': '1', 99 'DataType': 'string', 100 'value': 'this_is_the_value', 101 'maxOccurs': '1', 102 'inRequest': 'true' 103 } 66 104 } 105 106 The access to the value you have to require for the ``value`` parameter, something like this :: 107 108 yourVariable = inputs['variable_name']['value'] 109 110 Outputs 111 ^^^^^^^^^^^^^ 112 The outputs data as a structure really similar to the inputs one :: 113 114 { 115 'result': {'DataType': 'string', 116 'inRequest': 'true', 117 } 118 } 119 120 There is no ``'value'`` parameter before you assign it :: 121 122 inputs['result']['value'] = yourOutputDataVariable 123 124 The return statement has to be an integer: corresponding to the service status code. 125 126 The module should **return 3 if the process successfully ended otherwise it should return 4**. 127 To add a message for the wrong result you can add the massage to ``conf["lenv"]["message"]``, 128 for example: 129 130 .. code-block:: python 131 132 conf["lenv"]["message"] = 'Your module return an error' 67 133 68 134 Sample ZOO Python Services Provider
Note: See TracChangeset
for help on using the changeset viewer.