Changeset 986


Ignore:
Timestamp:
Mar 9, 2021, 4:50:02 PM (4 years ago)
Author:
djay
Message:

Move the execute endpoint to /processes/{processID}. Fixes in oas.cfg: use opengeospatial/ogcapi-processes github repo for schemas URLs.

Location:
trunk
Files:
7 edited

Legend:

Unmodified
Added
Removed
  • trunk/docker/oas.cfg

    r985 r986  
    33rootUrl=http://localhost/ogc-api
    44links=/,/api,/conformance,/processes,/jobs
    5 paths=/root,/api,/conformance,/processes,/processes/{id},/jobs,/jobs/{jobID},/jobs/{jobID}/results
    6 parameters=id,jobID,resultID
     5paths=/root,/api,/conformance,/processes,/processes/{processID},/jobs,/jobs/{jobID},/jobs/{jobID}/results
     6parameters=processID,jobID,resultID
    77version=3.0.2
    88license_name=OGC license
    9 license_url=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/LICENSE
    10 full_html_support=false
     9license_url=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/LICENSE
     10full_html_support=true
    1111partial_html_support=true
    1212wsUrl=ws://localhost:8888/
     
    8484type=text/hml
    8585
    86 [processes/{id}]
     86[processes/{processID}]
     87length=2
    8788method=get
    8889title=retrieve a process description
     
    9293schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessDescription.yaml
    9394ecode=404
    94 parameters=/components/parameters/id
    95 
    96 
    97 [/processes/{id}/jobs]
    98 rel=canonical
    99 type=application/json
    100 title=Process Description
    101 
    102 [processes/{id}/jobs]
    103 length=2
    104 method=get
    105 title=retrieve a list of jobs run
    106 abstract=A list of jobs run.
    107 tags=JobList
    108 tags_description=
    109 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/JobList.yaml
    110 parameters=/components/parameters/id
    111 ecode=404,500
     95parameters=/components/parameters/processID
    11296method_1=post
    11397title_1=execute a job
     
    116100tags_description_1=
    117101schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml
    118 parameters_1=/components/parameters/id
     102parameters_1=/components/parameters/processID
    119103ecode_1=400,404,500
    120104eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml
    121 ep=,/components/parameters/oas-header1
    122105
    123106[/jobs]
    124107rel=canonical
    125108type=application/json
    126 title=Execute Endpoint
     109title=Job Management
    127110
    128111[jobs]
    129 length=2
     112length=1
    130113method=get
    131114title=retrieve a list of jobs run
     
    156139type=text/hml
    157140
    158 [/processes/{id}/jobs/{jobID}]
    159 rel=canonical
    160 type=application/json
    161 title=Status
    162 
    163 [processes/{id}/jobs/{jobID}]
    164 length=2
    165 method=get
    166 title=The status of a job.
    167 abstract=The status of a job.
    168 tags=GetStatus
    169 tags_description=
    170 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
    171 parameters=/components/parameters/id,/components/parameters/jobID
    172 method_1=delete
    173 title_1=Cancel a job
    174 abstract_1=Cancel the job execution.
    175 tags_1=Dismiss
    176 tags_description_1=Cencel a job execution
    177 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
    178 parameters_1=/components/parameters/id,/components/parameters/jobID
    179 ecode_1=404,500
    180 
    181141[/jobs/{jobID}]
    182142rel=canonical
     
    202162ecode_1=404,500
    203163
    204 
    205 [/processes/{id}/jobs/{jobID}/results]
    206 rel=canonical
    207 type=application/json
    208 title=Get Result
    209 
    210 [processes/{id}/jobs/{jobID}/results]
    211 method=get
    212 title=The result of a job execution.
    213 abstract=The result of a job execution.
    214 tags=GetResult
    215 tags_description=
    216 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Results.yaml
    217 parameters=/components/parameters/id,/components/parameters/jobID
    218 ecode=404,500
    219 ep=,/components/parameters/oas-header2
    220 
    221164[/jobs/{jobID}/results]
    222165rel=canonical
     
    235178ep=,/components/parameters/oas-header2
    236179
    237 [/processes/{id}/jobs/{jobID}/result/{resultID}]
    238 rel=canonical
    239 type=application/json
    240 title=Get Result
    241 
    242 [processes/{id}/jobs/{jobID}/result/{resultID}]
    243 method=get
    244 title=The result of a job execution.
    245 abstract=The result of a job execution.
    246 tags=GetResult
    247 tags_description=
    248 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/valueType.yaml
    249 parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID
    250 ep=,/components/parameters/oas-header2
    251 
    252 
    253 [{id}]
     180[{processID}]
    254181type=string
    255182title=The id of a process
     
    334261schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/statusInfo.yaml
    335262type_1=application/json
    336 title_1=Results received successfully
     263title_1=Status received successfully
    337264state_2=jobFailed
    338 uri_2=failedUrii
     265uri_2=failedUri
    339266schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/exception.yaml
    340267type_2=application/json
  • trunk/zoo-project/HISTORY.txt

    r984 r986  
    11Version 1.8.1
    2   * Make all demos running within docker
     2  * Move jobs to root and use /processes/{processID} as execute endpopint
     3  * Make all demos running within docker (including SAGA and OTB)
    34  * Deploy demo HTML UI from github from the Dockerfile
    45  * Add demo ZOO-Services build in the Dockerfile
  • trunk/zoo-project/zoo-kernel/oas.cfg

    r967 r986  
    11[openapi]
    22use_content=false
    3 rootUrl=https://myserver/ogc-api
    4 links=/,/api,/conformance,/processes
    5 paths=/root,/api,/conformance,/processes,/processes/{id},/processes/{id}/jobs,/processes/{id}/jobs/{jobID},/processes/{id}/jobs/{jobID}/results
    6 parameters=id,jobID,resultID
     3rootUrl=http://localhost/ogc-api
     4links=/,/api,/conformance,/processes,/jobs
     5paths=/root,/api,/conformance,/processes,/processes/{processID},/jobs,/jobs/{jobID},/jobs/{jobID}/results
     6parameters=processID,jobID,resultID
    77version=3.0.2
    88license_name=OGC license
    9 license_url=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/LICENSE
    10 full_html_support=false
     9license_url=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/LICENSE
     10full_html_support=true
    1111partial_html_support=true
    12 wsUrl=wss://demo.mapmint.com:4430/
    13 publisherUrl=http://127.0.0.1/cgi-bin3/publish.py?jobid=
    14 io_as_array=true
     12wsUrl=ws://localhost:8888/
     13publisherUrl=http://localhost/cgi-bin/publish.py?jobid=
    1514
    1615[/]
     
    2524tags=Home
    2625tags_description=
    27 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/LandingPage.yaml
     26schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/LandingPage.yaml
    2827
    2928[/index.html]
     
    4140
    4241[api.html]
    43 href=https://demo.mapmint.com/swagger-ui/ogc-api-processes/
     42href=http://localhost/swagger-ui/oapip/
    4443
    4544[api]
     
    6261tags=Conformance
    6362tags_description=
    64 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ConformanceDeclaration.yaml
     63schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ConformanceDeclaration.yaml
    6564
    6665[/conformance.html]
     
    7978tags=GetCapabilities
    8079tags_description=
    81 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessList.yaml
     80schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessList.yaml
    8281
    8382[/processes.html]
     
    8584type=text/hml
    8685
    87 [processes/{id}]
     86[processes/{processID}]
     87length=2
    8888method=get
    8989title=retrieve a process description
     
    9191tags=ProcessDescription
    9292tags_description=
    93 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessDescription.yaml
     93schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessDescription.yaml
    9494ecode=404
    95 parameters=/components/parameters/id
    96 
    97 
    98 [/processes/{id}/jobs]
    99 rel=canonical
    100 type=application/json
    101 title=Process Description
    102 
    103 [processes/{id}/jobs]
    104 length=2
    105 method=get
    106 title=retrieve a list of jobs run
    107 abstract=A list of jobs run.
    108 tags=JobList
    109 tags_description=
    110 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/JobList.yaml
    111 parameters=/components/parameters/id
    112 ecode=404,500
     95parameters=/components/parameters/processID
    11396method_1=post
    11497title_1=execute a job
     
    11699tags_1=Execute Endpoint
    117100tags_description_1=
    118 schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteSync.yaml
    119 parameters_1=/components/parameters/id
     101schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml
     102parameters_1=/components/parameters/processID
    120103ecode_1=400,404,500
    121 eschema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteAsync.yaml
     104eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml
     105
     106[/jobs]
     107rel=canonical
     108type=application/json
     109title=Job Management
     110
     111[jobs]
     112length=1
     113method=get
     114title=retrieve a list of jobs run
     115abstract=A list of jobs run.
     116tags=JobList
     117tags_description=
     118schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/JobList.yaml
     119parameters=
     120ecode=404,500
     121method_1=post
     122title_1=execute a job
     123abstract_1=An execute endpoint.
     124tags_1=ExecuteEndpoint
     125tags_description_1=
     126schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml
     127parameters_1=
     128ecode_1=400,404,500
     129eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml
    122130ep=,/components/parameters/oas-header1
    123131
     
    125133abstract=Mandatory execute request in JSON format
    126134type=application/json
    127 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/execute.yaml
    128 
    129 [/processes/{id}/jobs/{jobID}]
     135schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/execute.yaml
     136
     137[/jobs.html]
     138rel=alternate
     139type=text/hml
     140
     141[/jobs/{jobID}]
    130142rel=canonical
    131143type=application/json
    132144title=Status
    133145
    134 [processes/{id}/jobs/{jobID}]
     146[jobs/{jobID}]
    135147length=2
    136148method=get
     
    139151tags=GetStatus
    140152tags_description=
    141 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml
    142 parameters=/components/parameters/id,/components/parameters/jobID
     153schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
     154parameters=/components/parameters/jobID
    143155method_1=delete
    144156title_1=Cancel a job
    145157abstract_1=Cancel the job execution.
    146158tags_1=Dismiss
    147 tags_description_1=Cencel a job execution
    148 schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml
    149 parameters_1=/components/parameters/id,/components/parameters/jobID
     159tags_description_1=Cancel a job execution
     160schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml
     161parameters_1=/components/parameters/jobID
    150162ecode_1=404,500
    151163
    152 
    153 [/processes/{id}/jobs/{jobID}/results]
     164[/jobs/{jobID}/results]
    154165rel=canonical
    155166type=application/json
    156167title=Get Result
    157168
    158 [processes/{id}/jobs/{jobID}/results]
     169[jobs/{jobID}/results]
    159170method=get
    160171title=The result of a job execution.
     
    162173tags=GetResult
    163174tags_description=
    164 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Results.yaml
    165 parameters=/components/parameters/id,/components/parameters/jobID
     175schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Results.yaml
     176parameters=/components/parameters/jobID
    166177ecode=404,500
    167178ep=,/components/parameters/oas-header2
    168179
    169 [/processes/{id}/jobs/{jobID}/result/{resultID}]
    170 rel=canonical
    171 type=application/json
    172 title=Get Result
    173 
    174 [processes/{id}/jobs/{jobID}/result/{resultID}]
    175 method=get
    176 title=The result of a job execution.
    177 abstract=The result of a job execution.
    178 tags=GetResult
    179 tags_description=
    180 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/valueType.yaml
    181 parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID
    182 ep=,/components/parameters/oas-header2
    183 
    184 
    185 [{id}]
     180[{processID}]
    186181type=string
    187182title=The id of a process
     
    214209
    215210[conformsTo]
    216 rootUrl=http://www.opengis.net/spec/ogcapi-processes/1.0/conf/
     211rootUrl=http://www.opengis.net/spec/ogcapi-processes/1.0/req/
    217212rootUrl0=http://www.opengis.net/spec/WPS/2.0/req/service/binding/rest-json/
    218213link=core
     
    222217link_4=dismiss
    223218link_5=callback
    224 length=6
     219link_6=ogc-process-description
     220link_7=html
     221length=8
    225222
    226223[exception]
    227224abstract=Exception
    228225type=application/json
    229 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml
    230 default_schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml
     226schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/responses/NotFound.yaml
     227default_schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ServerError.yaml
    231228
    232229[responses]
    233230length=5
    234231code=404
    235 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml
     232schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotFound.yaml
    236233type=application/json
    237234title=NotFound
    238235code_1=500
    239 schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml
     236schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ServerError.yaml
    240237type_1=application/json
    241238title_1=ServerError
    242239code_2=400
    243 schema_2=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/InvalidParameter.yaml
     240schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/InvalidParameter.yaml
    244241type_2=appliction/json
    245242title_2=InvalidParameter
    246243code_3=405
    247 schema_3=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/NotAllowed.yaml
     244schema_3=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotAllowed.yaml
    248245type_3=appliction/json
    249246title_3=NotAllowed
    250247code_4=406
    251 schema_4=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotSupported.yaml
     248schema_4=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotSupported.yaml
    252249type_4=appliction/json
    253250title_4=NotSupported
     
    257254state=jobSuccess
    258255uri=successUri
    259 schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/result.yaml
     256schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/result.yaml
    260257type=application/json
    261258title=Results received successfully
    262259state_1=jobInProgress
    263260uri_1=inProgressUri
    264 schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/statusInfo.yaml
     261schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/statusInfo.yaml
    265262type_1=application/json
    266 title_1=Results received successfully
     263title_1=Status received successfully
    267264state_2=jobFailed
    268 uri_2=failedUrii
    269 schema_2=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/exception.yaml
     265uri_2=failedUri
     266schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/exception.yaml
    270267type_2=application/json
    271268title_2=Exception received successfully
  • trunk/zoo-project/zoo-kernel/service_json.c

    r985 r986  
    533533      json_object *res3=json_object_new_object();
    534534      map* pmTmp=getMapFromMaps(m,"lenv","requestType");
    535       if(pmTmp!=NULL && strncasecmp(pmTmp->value,"desc",4)==0)
     535      if(pmTmp!=NULL && strncasecmp(pmTmp->value,"desc",4)==0){
    536536        json_object_object_add(res2,"rel",json_object_new_string("process-desc"));
     537      }
    537538      else{
    538539        json_object_object_add(res2,"rel",json_object_new_string("execute"));
    539         json_object_object_add(res3,"rel",json_object_new_string("alternate"));
    540         json_object_object_add(res3,"type",json_object_new_string("text/html"));
    541       }
     540      }
     541      json_object_object_add(res3,"rel",json_object_new_string("alternate"));
     542      json_object_object_add(res3,"type",json_object_new_string("text/html"));
    542543      json_object_object_add(res2,"type",json_object_new_string("application/json"));
    543       json_object_object_add(res2,"title",json_object_new_string("Process Description"));
    544544      map* tmpUrl=getMapFromMaps(m,"openapi","rootUrl");
    545545      char* tmpStr=(char*) malloc((strlen(tmpUrl->value)+strlen(rUrl)+13)*sizeof(char));
    546       sprintf(tmpStr,"%s/processes/%s/",tmpUrl->value,rUrl);
    547       if(doc==NULL){
     546      sprintf(tmpStr,"%s/processes/%s",tmpUrl->value,rUrl);
     547      if(pmTmp!=NULL && strncasecmp(pmTmp->value,"desc",4)!=0){
    548548        json_object_object_add(res2,"title",json_object_new_string("Execute End Point"));
    549549        json_object_object_add(res3,"title",json_object_new_string("Execute End Point"));
    550         char* tmpStr1=zStrdup(tmpStr);
     550        /*char* tmpStr1=zStrdup(tmpStr);
    551551        tmpStr=(char*) realloc(tmpStr,(strlen(tmpStr)+6)*sizeof(char));
    552552        sprintf(tmpStr,"%sjobs",tmpStr1);
    553         free(tmpStr1);
    554         char* tmpStr3=(char*) malloc((strlen(tmpStr)+6)*sizeof(char));
    555         sprintf(tmpStr3,"%s.html",tmpStr);
    556         json_object_object_add(res3,"href",json_object_new_string(tmpStr3));
    557         free(tmpStr3);
    558       }
     553        free(tmpStr1);*/
     554      }else{
     555        json_object_object_add(res2,"title",json_object_new_string("Process Description"));
     556        json_object_object_add(res3,"title",json_object_new_string("Process Description"));
     557      }
     558      char* tmpStr3=(char*) malloc((strlen(tmpStr)+6)*sizeof(char));
     559      sprintf(tmpStr3,"%s.html",tmpStr);
     560      json_object_object_add(res3,"href",json_object_new_string(tmpStr3));
     561      free(tmpStr3);
    559562      json_object_object_add(res2,"href",json_object_new_string(tmpStr));
    560563      free(tmpStr);
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r985 r986  
    20612061        errorException (NULL, _("Unable to load the oas.cfg file."),
    20622062                        "InternalError", NULL);
    2063         free (m);
     2063        free (m1);
    20642064        return 1;
    20652065      }
     
    20892089    setMapInMaps(m,"headers","Content-Type","application/json;charset=UTF-8");
    20902090    /* - Root url */
    2091     if(cgiContentLength==1){
     2091    if((strncasecmp(cgiRequestMethod,"post",4)==0 &&
     2092        (strstr(cgiQueryString,"/processes/")==NULL ||
     2093         strlen(cgiQueryString)<=11))
     2094       ||
     2095       (strncasecmp(cgiRequestMethod,"DELETE",6)==0 &&
     2096        (strstr(cgiQueryString,"/jobs/")==NULL || strlen(cgiQueryString)<=6)) ){
     2097      setMapInMaps(m,"lenv","status_code","405");
     2098      map* error=createMap("code","InvalidMethod");
     2099      addToMap(error,"message",_("The request method used to access the current path is not supported."));
     2100      printExceptionReportResponseJ(m,error);
     2101      json_object_put(res);
     2102      // TODO: cleanup memory
     2103      return 1;
     2104    }
     2105    else if(cgiContentLength==1){
    20922106      if(strncasecmp(cgiRequestMethod,"GET",3)!=0){
    20932107        setMapInMaps(m,"lenv","status_code","405");
     
    22052219    else if(strstr(cgiQueryString,"/processes")==NULL && (strstr(cgiQueryString,"/jobs")!=NULL || strstr(cgiQueryString,"/jobs/")!=NULL)){
    22062220      /* - /jobs url */
    2207       fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
    2208       fflush(stderr);
    22092221      if(strncasecmp(cgiRequestMethod,"DELETE",6)==0) {
    2210         fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
    2211         fflush(stderr);
    22122222        char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6);
    22132223        setMapInMaps(m,"lenv","gs_usid",jobId);
    22142224        setMapInMaps(m,"lenv","file.statusFile",json_getStatusFilePath(m));
    2215         fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
    2216         fflush(stderr);
    22172225        runDismiss(m,jobId);
    2218         fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
    2219         fflush(stderr);
    22202226        map* pmError=getMapFromMaps(m,"lenv","error");
    22212227        if(pmError!=NULL && strncasecmp(pmError->value,"true",4)==0){
     
    22272233          res=createStatus(m,SERVICE_DISMISSED);
    22282234        }
    2229         fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
    2230         fflush(stderr);
    22312235      }
    22322236      else if(strcasecmp(cgiRequestMethod,"get")==0){
     
    22622266                //char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6);
    22632267                jobId[strlen(jobId)-8]=0;
    2264                 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
    2265                 fflush(stderr);
    22662268                char *sid=getStatusId(m,jobId);
    22672269                if(sid==NULL){
    2268                   fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
    2269                   fflush(stderr);
    22702270                  map* error=createMap("code","NoSuchJob");
    22712271                  addToMap(error,"message",_("The JobID from the request does not match any of the Jobs running on this server"));
     
    22732273                  return 1;
    22742274                }else{
    2275                   fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
    2276                   fflush(stderr);
    22772275                  if(isRunning(m,jobId)>0){
    22782276                    map* error=createMap("code","ResultNotReady");
     
    22812279                    return 1;
    22822280                  }else{
    2283                     fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);
    2284                     fflush(stderr);
    22852281                    char *Url0=getResultPath(m,jobId);
    2286                     fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,Url0);
    2287                     fflush(stderr);
    2288                     //map *cIdentifier = getMapFromMaps (m, "lenv", "oIdentifier");
    22892282                    zStatStruct f_status;
    22902283                    int s=zStat(Url0, &f_status);
    22912284                    if(s==0 && f_status.st_size>0){
    2292                       fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,Url0);
    2293                       fflush(stderr);
    2294                      
    22952285                      if(f_status.st_size>15){
    22962286                        json_object* pjoTmp=json_readFile(m,Url0);
     
    23582348        }
    23592349         
    2360       }else if(strcasecmp(cgiRequestMethod,"post")==0 && (strcmp(cgiQueryString,"/jobs")==0 || strcmp(cgiQueryString,"/jobs/")==0)){
    2361         /* - /jobs Execution (POST) */
     2350      }   
     2351    }
     2352    else{
     2353      service* s1=NULL;
     2354      int t=0;
     2355      if(strstr(cgiQueryString,"/processes/")==NULL){
     2356        map* error=createMap("code","BadRequest");
     2357        addToMap(error,"message",_("The ressource is not available"));
     2358        //setMapInMaps(conf,"lenv","status_code","404 Bad Request");
     2359        printExceptionReportResponseJ(m,error);
     2360        freeMaps (&m);
     2361        free (m);
     2362        free (REQUEST);
     2363        xmlCleanupParser ();
     2364        zooXmlCleanupNs ();                     
     2365        return 1;
     2366      }else if(strcasecmp(cgiRequestMethod,"post")==0){
     2367        /* - /processes/{processId} Execution (POST) */
    23622368        eres = SERVICE_STARTED;
    23632369        initAllEnvironment(m,request_inputs,ntmp,"jrequest");
     
    24002406        if(json_object_object_get_ex(jobj,"id",&json_io)!=FALSE){
    24012407          cIdentifier=zStrdup(json_object_get_string(json_io));
     2408        }else{
     2409          if(strstr(cgiQueryString,"/processes/")!=NULL && strlen(cgiQueryString)>11)
     2410            cIdentifier=zStrdup(strstr(cgiQueryString,"/processes/")+11);         
    24022411        }
    2403         fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
    2404         fflush(stderr);
    24052412        fetchService(zooRegistry,m,&s1,request_inputs,ntmp,cIdentifier,printExceptionReportResponseJ);
    2406         fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
    2407         fflush(stderr);
    2408         //maps* inputs_real_format=NULL, *outputs_real_format= NULL;
    24092413        parseJRequest(m,s1,jobj,request_inputs,&request_input_real_format,&request_output_real_format);
    2410         fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
    2411         fflush(stderr);
    24122414        map* preference=getMapFromMaps(m,"renv","HTTP_PREFER");
    24132415        map* mode=getMap(request_inputs,"mode");
     
    25932595           
    25942596      }//else error
    2595    
    2596     }
    2597     else{
    2598       service* s1=NULL;
    2599       int t=0;
    2600       if(strstr(cgiQueryString,"/processes/")==NULL){
    2601         map* error=createMap("code","BadRequest");
    2602         addToMap(error,"message",_("The ressource is not available"));
    2603         //setMapInMaps(conf,"lenv","status_code","404 Bad Request");
    2604         printExceptionReportResponseJ(m,error);
    2605         freeMaps (&m);
    2606         free (m);
    2607         free (REQUEST);
    2608         xmlCleanupParser ();
    2609         zooXmlCleanupNs ();                     
    2610         return 1;
    2611       } else
     2597      else
    26122598        if(strstr(cgiQueryString,"/jobs")==NULL && strstr(cgiQueryString,"/jobs/")==NULL){
    26132599          /* - /processes/{id}/ */
     
    26472633            }
    26482634
    2649             fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
    2650             fflush(stderr);
    26512635            fetchService(zooRegistry,m,&s1,request_inputs,ntmp,cIdentifier,printExceptionReportResponseJ);
    2652             fprintf(stderr,"%s %d \n", __FILE__,__LINE__);
    2653             fflush(stderr);     
    26542636
    26552637
     
    30323014
    30333015    fetchService(zooRegistry,m,&s1,request_inputs,ntmp,r_inputs->value,printExceptionReportResponse);
    3034     /*
    3035     //*****************
    3036     // Fetch S1
    3037     //*****************
    3038     map* import = getMapFromMaps (m, IMPORTSERVICE, r_inputs->value);
    3039     if (import != NULL && import->value != NULL) {
    3040       strncpy(tmps1, import->value, 1024);
    3041       setMapInMaps (m, "lenv", "Identifier", r_inputs->value);
    3042       setMapInMaps (m, "lenv", "oIdentifier", r_inputs->value);
    3043     }
    3044     else {
    3045       snprintf (tmps1, 1024, "%s/%s.zcfg", conf_dir, r_inputs->value);
    3046 #ifdef DEBUG
    3047       fprintf (stderr, "Trying to load %s\n", tmps1);
    3048 #endif
    3049       if (strstr (r_inputs->value, ".") != NULL)
    3050         {
    3051           char *identifier = zStrdup (r_inputs->value);
    3052           parseIdentifier (m, conf_dir, identifier, tmps1);
    3053           map *tmpMap = getMapFromMaps (m, "lenv", "metapath");
    3054           if (tmpMap != NULL)
    3055             addToMap (request_inputs, "metapath", tmpMap->value);
    3056           free (identifier);
    3057         }
    3058       else
    3059         {
    3060           setMapInMaps (m, "lenv", "Identifier", r_inputs->value);
    3061           setMapInMaps (m, "lenv", "oIdentifier", r_inputs->value);
    3062         }
    3063     }
    3064 
    3065     r_inputs = getMapFromMaps (m, "lenv", "Identifier");
    3066  
    3067 #ifdef META_DB
    3068     int metadb_id=_init_sql(m,"metadb");
    3069     //FAILED CONNECTING DB
    3070     if(getMapFromMaps(m,"lenv","dbIssue")!=NULL || metadb_id<0){
    3071       fprintf(stderr,"ERROR CONNECTING METADB\n");
    3072     }
    3073     if(metadb_id>=0)
    3074       s1=extractServiceFromDb(m,r_inputs->value,0);
    3075     //close_sql(m,0);
    3076     if(s1!=NULL){
    3077       inheritance(zooRegistry,&s1);
    3078 #ifdef USE_HPC
    3079       addNestedOutputs(&s1);
    3080 #endif
    3081       if(zooRegistry!=NULL){
    3082         freeRegistry(&zooRegistry);
    3083         free(zooRegistry);
    3084       }
    3085     }else /* Not found in MetaDB /{
    3086 #endif
    3087       s1 = createService();
    3088       if (s1 == NULL)
    3089         {
    3090           freeMaps (&m);
    3091           free (m);
    3092           if(zooRegistry!=NULL){
    3093             freeRegistry(&zooRegistry);
    3094             free(zooRegistry);
    3095           }
    3096           free (REQUEST);
    3097           free (SERVICE_URL);
    3098           return errorException (m, _("Unable to allocate memory"),
    3099                                  "InternalError", NULL);
    3100         }
    3101 
    3102       int saved_stdout = zDup (fileno (stdout));
    3103       zDup2 (fileno (stderr), fileno (stdout));
    3104       t = readServiceFile (m, tmps1, &s1, r_inputs->value);
    3105       if(t>=0){
    3106         inheritance(zooRegistry,&s1);
    3107 #ifdef USE_HPC
    3108         addNestedOutputs(&s1);
    3109 #endif
    3110       }
    3111       if(zooRegistry!=NULL){
    3112         freeRegistry(&zooRegistry);
    3113         free(zooRegistry);
    3114       }
    3115       fflush (stdout);
    3116       zDup2 (saved_stdout, fileno (stdout));
    3117       if (t < 0)
    3118         {
    3119           char *tmpMsg = (char *) malloc (2048 + strlen (r_inputs->value));
    3120           sprintf (tmpMsg,
    3121                    _
    3122                    ("The value for <identifier> seems to be wrong (%s). Please specify one of the processes in the list returned by a GetCapabilities request."),
    3123                    r_inputs->value);
    3124           errorException (m, tmpMsg, "InvalidParameterValue", "identifier");
    3125           free (tmpMsg);
    3126           free (s1);
    3127           freeMaps (&m);
    3128           free (m);
    3129           free (REQUEST);
    3130           free (SERVICE_URL);
    3131           return 0;
    3132         }
    3133       zClose (saved_stdout);
    3134 #ifdef META_DB
    3135     }
    3136 #endif
    3137     //*****************
    3138     // End Fetch S1
    3139     //*****************
    3140 */
    31413016 
    31423017#ifdef DEBUG
  • trunk/zoo-project/zoo-services/utils/open-api/static/openapi.js

    r985 r986  
    3737function loadRequest(){
    3838    var requestObject={
    39         "id": System["JSON_STR"]["id"],
     39        //"id": System["JSON_STR"]["id"],
    4040        "inputs":{},
    4141        "outputs":{},
  • trunk/zoo-project/zoo-services/utils/open-api/templates/index.html

    r985 r986  
    2626#set values={}
    2727#end try
     28#def findLink($val,$key)
     29#if "links" in $val
     30#for i in range(len($val["links"]))
     31#if $val["links"][$i]["rel"]==$key
     32#return $val["links"][$i]["href"]
     33#end if
     34#end for
     35#return None
     36#else
     37#return None
     38#end if
     39#end def
    2840<html lang="en">
    2941  <head>
     
    272284          <input type="hidden" name="oapi_ioAsArray" value="#if "io_as_array" in $openapi["openapi"]#$openapi["openapi"]["io_as_array"]#else#false#end if#" />
    273285          <input type="hidden" name="oapi_wsUrl" value="$openapi["openapi"]["wsurl"]" />
    274           <input type="hidden" name="oapi_jobUrl" value="$openapi["openapi"]["rootUrl"]/jobs" />
     286          <input type="hidden" name="oapi_jobUrl" value="$findLink($values,"execute")" />
    275287          <input type="hidden" name="oapi_reqID" value="$cid" />
    276288          <h3>Inputs</h3>
     
    360372      <a href="$values["links"][$i]["href"]">$printRel($openapi["links_title"],$values["links"][$i]["rel"])</a>
    361373    </p>
    362     #if $i+1<=len($values["links"]) and len($values["links"])>1 and not($values["links"][$i+1]["rel"]=="alternate" and $openapi["openapi"]["full_html_support"]=="true")
     374    #if $i+1<=len($values["links"]) and len($values["links"])>1 and ($values["links"][$i+1]["rel"]=="alternate" or $values["links"][$i+1]["rel"]=="service-doc")
    363375    <p><a href="$values["links"][$i+1]["href"]">$printRel($openapi["links_title"],$values["links"][$i+1]["rel"])</a></p>
    364376    #end if
     
    410422          *#
    411423          <th scope="row">
    412             <a href="$(values[$i]["links"][0]["href"][:-1]).html">
     424            <a href="$(values[$i]["links"][0]["href"]).html">
    413425              <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-link-45deg" fill="currentColor" xmlns="http://www.w3.org/2000/svg">
    414426                <path d="M4.715 6.542L3.343 7.914a3 3 0 1 0 4.243 4.243l1.828-1.829A3 3 0 0 0 8.586 5.5L8 6.086a1.001 1.001 0 0 0-.154.199 2 2 0 0 1 .861 3.337L6.88 11.45a2 2 0 1 1-2.83-2.83l.793-.792a4.018 4.018 0 0 1-.128-1.287z"/>
     
    526538      <hr>
    527539      <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address>
    528       <!-- hhmts start -->Last modified: Thu Mar  4 10:51:46 CET 2021 <!-- hhmts end -->
     540      <!-- hhmts start -->Last modified: Tue Mar  9 16:33:11 CET 2021 <!-- hhmts end -->
    529541    </main>
    530542#if $currentKey=="root"
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