Changeset 958 for trunk/docs


Ignore:
Timestamp:
Apr 16, 2020, 6:10:30 PM (4 years ago)
Author:
djay
Message:

Add documentation on how to use asyncrhonous execution using the Javascript ZOO-API

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/api/examples.rst

    r725 r958  
    5252the ``storeExecuteResponse`` parameter in his request).
    5353
     54Asynchronous ZOO.Process example
     55--------------------------------
     56
     57::
     58
     59  function RunAsynchonous(conf,inputs,outputs){
     60     var formatWPS=new ZOO.Format.WPS();
     61     var myProcess = new ZOO.Process(conf["main"]["serverAddress"],'Demo',true);
     62     var myExecuteResult  =myProcess.Execute(myInputs,myOutputs);
     63     var response=formatWPS.read(myExecuteResult);
     64     while(response.status){
     65         sleep(1500);
     66         var response1 = ZOO.Request.Get(response.status.replace(/amp;/g,""),null);
     67         response=formatWPS.read(response1);
     68     }
     69     conf["lenv"]["message"]="Asyncrhonous Process ended";
     70     ZOO.UpdateStatus(conf,90);
     71     return {result: ZOO.SERVICE_SUCCEEDED, outputs: outputs};
     72   }
     73
     74In this sample code, by creating the ZOO.Process, providing a third
     75argument set to true, we ensure that the WPS service execution will be run
     76asynchronously. Once the Execute WPS response is fetched, until the
     77service execution ends, the statusLocation is polled every 1,5
     78second.
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