Changeset 406


Ignore:
Timestamp:
Mar 28, 2013, 12:51:45 PM (11 years ago)
Author:
lucadelu
Message:

add more information about Javascript services

Location:
trunk/docs/services
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/services/debug.txt

    r398 r406  
    33How To Debug ZOO Services
    44=========================
     5
     6:Authors: Luca Delucchi
     7:Last Updated: $Date: 2013-03-27 00:06:12 +0100 (Wed, 27 Mar 2013) $
    58
    69There are different ways to debug your services, the most used solutions are via web
     
    3235  sys.stderr.write("My message")
    3336
     37.. _web_javascript:
     38
     39Javascript
     40************
     41
     42You can user ``alert`` to print a string to the standard error.
     43
     44.. code-block:: javascript
     45
     46  // add this line when you want see your message
     47  alert('My message')
     48  // you can debug value of inputs, outputs or conf
     49  alert(inputs["S"]["value"])
     50
     51.. note:: If you try to pass an object it return only ``[object Object]``
    3452
    3553Command line
     
    7391  # add this line when you want investigate more in the code
    7492  pdb.set_trace()
     93
     94Javascript
     95************
     96
     97You can use ``alert`` also to print in the console, more info in the :ref:`web_javascript` web section
  • trunk/docs/services/howtos.txt

    r399 r406  
    44=========================
    55
    6 :Authors: Nicolas Bozon, Gérald Fenoy, Jeff McKenna
     6:Authors: Nicolas Bozon, Gérald Fenoy, Jeff McKenna, Luca Delucchi
    77:Last Updated: $Date$
    88
     
    1919----------------------
    2020
     21The function of the process for each programming language take three arguments: the main
     22configuration, inputs and outputs.
     23
    2124.. Note:: The service has to **return 3 if the process run successfully instead it
    2225          return 4** if the process end with an error.
     
    4043    Python
    4144serviceProvider
    42     The name of the Python module to use as a ZOO Service Provider. For instance, if your 
    43     script, located in the same directory as your ZOO Kernel, was named ``my_module.py`` then 
    44     you should use ``my_module`` (the Python module name) for the serviceProvider value in ZCFG file. 
     45    The name of the Python module to use as a ZOO Service Provider. For instance, if your
     46    script, located in the same directory as your ZOO Kernel, was named ``my_module.py`` then
     47    you should use ``my_module`` (the Python module name) for the serviceProvider value in ZCFG file.
    4548
    4649Python Data Structure used
    4750**************************
    48 
    49 The Python module's function to be used take three arguments: the main configuration, inputs and outputs.
    50 All this values are passed to the Python module as dictionaries.
     51The three parameters of the function are passed to the Python module as dictionaries.
    5152
    5253Following you'll find an example for each parameters
     
    184185----------
    185186
     187ZOO API
     188*********
     189
     190If you need to use :ref:`ZOO API <api>` in your service, you have first to copy ``zoo-api.js``
     191and ``zoo-proj4js.js`` where your services are located (for example in Unix system probably in
     192``/usr/lib/cgi-bin/``
     193
     194Javascript ZCFG requirements
     195**********************************
     196
     197.. Note:: For each Service provided by your ZOO Javascript Services Provider, the ZCFG File
     198          must be named the same as the Javascript function name (also the case of
     199          characters is important).
     200
     201The ZCFG file should contain the following :
     202
     203serviceType
     204    JS
     205serviceProvider
     206    The name of the JavaScript file to use as a ZOO Service Provider. For instance, if your
     207    script, located in the same directory as your ZOO Kernel, was named ``my_module.js`` then
     208    you should use ``my_module.js``.
     209
     210
     211Javascript Data Structure used
     212********************************
     213
     214The three parameters of the function are passed to the JavaScript function as Object.
     215
     216Sample ZOO Javascript Services Provider
     217******************************************
     218
    186219.. code-block:: javascript
    187220
     
    192225     return Array(3,outputs);
    193226  }
     227
Note: See TracChangeset for help on using the changeset viewer.

Search

Context Navigation

ZOO Sponsors

http://www.zoo-project.org/trac/chrome/site/img/geolabs-logo.pnghttp://www.zoo-project.org/trac/chrome/site/img/neogeo-logo.png http://www.zoo-project.org/trac/chrome/site/img/apptech-logo.png http://www.zoo-project.org/trac/chrome/site/img/3liz-logo.png http://www.zoo-project.org/trac/chrome/site/img/gateway-logo.png

Become a sponsor !

Knowledge partners

http://www.zoo-project.org/trac/chrome/site/img/ocu-logo.png http://www.zoo-project.org/trac/chrome/site/img/gucas-logo.png http://www.zoo-project.org/trac/chrome/site/img/polimi-logo.png http://www.zoo-project.org/trac/chrome/site/img/fem-logo.png http://www.zoo-project.org/trac/chrome/site/img/supsi-logo.png http://www.zoo-project.org/trac/chrome/site/img/cumtb-logo.png

Become a knowledge partner

Related links

http://zoo-project.org/img/ogclogo.png http://zoo-project.org/img/osgeologo.png