Changeset 986
- Timestamp:
- Mar 9, 2021, 4:50:02 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 7 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/docker/oas.cfg
r985 r986 3 3 rootUrl=http://localhost/ogc-api 4 4 links=/,/api,/conformance,/processes,/jobs 5 paths=/root,/api,/conformance,/processes,/processes/{ id},/jobs,/jobs/{jobID},/jobs/{jobID}/results6 parameters= id,jobID,resultID5 paths=/root,/api,/conformance,/processes,/processes/{processID},/jobs,/jobs/{jobID},/jobs/{jobID}/results 6 parameters=processID,jobID,resultID 7 7 version=3.0.2 8 8 license_name=OGC license 9 license_url=https://raw.githubusercontent.com/opengeospatial/ wps-rest-binding/master/LICENSE10 full_html_support= false9 license_url=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/LICENSE 10 full_html_support=true 11 11 partial_html_support=true 12 12 wsUrl=ws://localhost:8888/ … … 84 84 type=text/hml 85 85 86 [processes/{id}] 86 [processes/{processID}] 87 length=2 87 88 method=get 88 89 title=retrieve a process description … … 92 93 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessDescription.yaml 93 94 ecode=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 95 parameters=/components/parameters/processID 112 96 method_1=post 113 97 title_1=execute a job … … 116 100 tags_description_1= 117 101 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml 118 parameters_1=/components/parameters/ id102 parameters_1=/components/parameters/processID 119 103 ecode_1=400,404,500 120 104 eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml 121 ep=,/components/parameters/oas-header1122 105 123 106 [/jobs] 124 107 rel=canonical 125 108 type=application/json 126 title= Execute Endpoint109 title=Job Management 127 110 128 111 [jobs] 129 length= 2112 length=1 130 113 method=get 131 114 title=retrieve a list of jobs run … … 156 139 type=text/hml 157 140 158 [/processes/{id}/jobs/{jobID}]159 rel=canonical160 type=application/json161 title=Status162 163 [processes/{id}/jobs/{jobID}]164 length=2165 method=get166 title=The status of a job.167 abstract=The status of a job.168 tags=GetStatus169 tags_description=170 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml171 parameters=/components/parameters/id,/components/parameters/jobID172 method_1=delete173 title_1=Cancel a job174 abstract_1=Cancel the job execution.175 tags_1=Dismiss176 tags_description_1=Cencel a job execution177 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml178 parameters_1=/components/parameters/id,/components/parameters/jobID179 ecode_1=404,500180 181 141 [/jobs/{jobID}] 182 142 rel=canonical … … 202 162 ecode_1=404,500 203 163 204 205 [/processes/{id}/jobs/{jobID}/results]206 rel=canonical207 type=application/json208 title=Get Result209 210 [processes/{id}/jobs/{jobID}/results]211 method=get212 title=The result of a job execution.213 abstract=The result of a job execution.214 tags=GetResult215 tags_description=216 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Results.yaml217 parameters=/components/parameters/id,/components/parameters/jobID218 ecode=404,500219 ep=,/components/parameters/oas-header2220 221 164 [/jobs/{jobID}/results] 222 165 rel=canonical … … 235 178 ep=,/components/parameters/oas-header2 236 179 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}] 254 181 type=string 255 182 title=The id of a process … … 334 261 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/statusInfo.yaml 335 262 type_1=application/json 336 title_1= Results received successfully263 title_1=Status received successfully 337 264 state_2=jobFailed 338 uri_2=failedUri i265 uri_2=failedUri 339 266 schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/exception.yaml 340 267 type_2=application/json -
trunk/zoo-project/HISTORY.txt
r984 r986 1 1 Version 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) 3 4 * Deploy demo HTML UI from github from the Dockerfile 4 5 * Add demo ZOO-Services build in the Dockerfile -
trunk/zoo-project/zoo-kernel/oas.cfg
r967 r986 1 1 [openapi] 2 2 use_content=false 3 rootUrl=http s://myserver/ogc-api4 links=/,/api,/conformance,/processes 5 paths=/root,/api,/conformance,/processes,/processes/{ id},/processes/{id}/jobs,/processes/{id}/jobs/{jobID},/processes/{id}/jobs/{jobID}/results6 parameters= id,jobID,resultID3 rootUrl=http://localhost/ogc-api 4 links=/,/api,/conformance,/processes,/jobs 5 paths=/root,/api,/conformance,/processes,/processes/{processID},/jobs,/jobs/{jobID},/jobs/{jobID}/results 6 parameters=processID,jobID,resultID 7 7 version=3.0.2 8 8 license_name=OGC license 9 license_url=https://raw.githubusercontent.com/opengeospatial/ wps-rest-binding/master/LICENSE10 full_html_support= false9 license_url=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/LICENSE 10 full_html_support=true 11 11 partial_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 12 wsUrl=ws://localhost:8888/ 13 publisherUrl=http://localhost/cgi-bin/publish.py?jobid= 15 14 16 15 [/] … … 25 24 tags=Home 26 25 tags_description= 27 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/LandingPage.yaml26 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/LandingPage.yaml 28 27 29 28 [/index.html] … … 41 40 42 41 [api.html] 43 href=http s://demo.mapmint.com/swagger-ui/ogc-api-processes/42 href=http://localhost/swagger-ui/oapip/ 44 43 45 44 [api] … … 62 61 tags=Conformance 63 62 tags_description= 64 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ConformanceDeclaration.yaml63 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ConformanceDeclaration.yaml 65 64 66 65 [/conformance.html] … … 79 78 tags=GetCapabilities 80 79 tags_description= 81 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessList.yaml80 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessList.yaml 82 81 83 82 [/processes.html] … … 85 84 type=text/hml 86 85 87 [processes/{id}] 86 [processes/{processID}] 87 length=2 88 88 method=get 89 89 title=retrieve a process description … … 91 91 tags=ProcessDescription 92 92 tags_description= 93 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessDescription.yaml93 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ProcessDescription.yaml 94 94 ecode=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 95 parameters=/components/parameters/processID 113 96 method_1=post 114 97 title_1=execute a job … … 116 99 tags_1=Execute Endpoint 117 100 tags_description_1= 118 schema_1=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteSync.yaml119 parameters_1=/components/parameters/ id101 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml 102 parameters_1=/components/parameters/processID 120 103 ecode_1=400,404,500 121 eschema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteAsync.yaml 104 eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml 105 106 [/jobs] 107 rel=canonical 108 type=application/json 109 title=Job Management 110 111 [jobs] 112 length=1 113 method=get 114 title=retrieve a list of jobs run 115 abstract=A list of jobs run. 116 tags=JobList 117 tags_description= 118 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/JobList.yaml 119 parameters= 120 ecode=404,500 121 method_1=post 122 title_1=execute a job 123 abstract_1=An execute endpoint. 124 tags_1=ExecuteEndpoint 125 tags_description_1= 126 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteSync.yaml 127 parameters_1= 128 ecode_1=400,404,500 129 eschema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ExecuteAsync.yaml 122 130 ep=,/components/parameters/oas-header1 123 131 … … 125 133 abstract=Mandatory execute request in JSON format 126 134 type=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}] 135 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/execute.yaml 136 137 [/jobs.html] 138 rel=alternate 139 type=text/hml 140 141 [/jobs/{jobID}] 130 142 rel=canonical 131 143 type=application/json 132 144 title=Status 133 145 134 [ processes/{id}/jobs/{jobID}]146 [jobs/{jobID}] 135 147 length=2 136 148 method=get … … 139 151 tags=GetStatus 140 152 tags_description= 141 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml142 parameters=/components/parameters/ id,/components/parameters/jobID153 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml 154 parameters=/components/parameters/jobID 143 155 method_1=delete 144 156 title_1=Cancel a job 145 157 abstract_1=Cancel the job execution. 146 158 tags_1=Dismiss 147 tags_description_1=C encel a job execution148 schema_1=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml149 parameters_1=/components/parameters/ id,/components/parameters/jobID159 tags_description_1=Cancel a job execution 160 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Status.yaml 161 parameters_1=/components/parameters/jobID 150 162 ecode_1=404,500 151 163 152 153 [/processes/{id}/jobs/{jobID}/results] 164 [/jobs/{jobID}/results] 154 165 rel=canonical 155 166 type=application/json 156 167 title=Get Result 157 168 158 [ processes/{id}/jobs/{jobID}/results]169 [jobs/{jobID}/results] 159 170 method=get 160 171 title=The result of a job execution. … … 162 173 tags=GetResult 163 174 tags_description= 164 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Results.yaml165 parameters=/components/parameters/ id,/components/parameters/jobID175 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/Results.yaml 176 parameters=/components/parameters/jobID 166 177 ecode=404,500 167 178 ep=,/components/parameters/oas-header2 168 179 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}] 186 181 type=string 187 182 title=The id of a process … … 214 209 215 210 [conformsTo] 216 rootUrl=http://www.opengis.net/spec/ogcapi-processes/1.0/ conf/211 rootUrl=http://www.opengis.net/spec/ogcapi-processes/1.0/req/ 217 212 rootUrl0=http://www.opengis.net/spec/WPS/2.0/req/service/binding/rest-json/ 218 213 link=core … … 222 217 link_4=dismiss 223 218 link_5=callback 224 length=6 219 link_6=ogc-process-description 220 link_7=html 221 length=8 225 222 226 223 [exception] 227 224 abstract=Exception 228 225 type=application/json 229 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml230 default_schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml226 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/responses/NotFound.yaml 227 default_schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ServerError.yaml 231 228 232 229 [responses] 233 230 length=5 234 231 code=404 235 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml232 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotFound.yaml 236 233 type=application/json 237 234 title=NotFound 238 235 code_1=500 239 schema_1=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml236 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/ServerError.yaml 240 237 type_1=application/json 241 238 title_1=ServerError 242 239 code_2=400 243 schema_2=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/InvalidParameter.yaml240 schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/InvalidParameter.yaml 244 241 type_2=appliction/json 245 242 title_2=InvalidParameter 246 243 code_3=405 247 schema_3=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/NotAllowed.yaml244 schema_3=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotAllowed.yaml 248 245 type_3=appliction/json 249 246 title_3=NotAllowed 250 247 code_4=406 251 schema_4=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotSupported.yaml248 schema_4=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/responses/NotSupported.yaml 252 249 type_4=appliction/json 253 250 title_4=NotSupported … … 257 254 state=jobSuccess 258 255 uri=successUri 259 schema=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/result.yaml256 schema=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/result.yaml 260 257 type=application/json 261 258 title=Results received successfully 262 259 state_1=jobInProgress 263 260 uri_1=inProgressUri 264 schema_1=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/statusInfo.yaml261 schema_1=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/statusInfo.yaml 265 262 type_1=application/json 266 title_1= Results received successfully263 title_1=Status received successfully 267 264 state_2=jobFailed 268 uri_2=failedUri i269 schema_2=https://raw.githubusercontent.com/ gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/exception.yaml265 uri_2=failedUri 266 schema_2=https://raw.githubusercontent.com/opengeospatial/ogcapi-processes/master/core/openapi/schemas/exception.yaml 270 267 type_2=application/json 271 268 title_2=Exception received successfully -
trunk/zoo-project/zoo-kernel/service_json.c
r985 r986 533 533 json_object *res3=json_object_new_object(); 534 534 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){ 536 536 json_object_object_add(res2,"rel",json_object_new_string("process-desc")); 537 } 537 538 else{ 538 539 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")); 542 543 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"));544 544 map* tmpUrl=getMapFromMaps(m,"openapi","rootUrl"); 545 545 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){ 548 548 json_object_object_add(res2,"title",json_object_new_string("Execute End Point")); 549 549 json_object_object_add(res3,"title",json_object_new_string("Execute End Point")); 550 char* tmpStr1=zStrdup(tmpStr);550 /*char* tmpStr1=zStrdup(tmpStr); 551 551 tmpStr=(char*) realloc(tmpStr,(strlen(tmpStr)+6)*sizeof(char)); 552 552 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); 559 562 json_object_object_add(res2,"href",json_object_new_string(tmpStr)); 560 563 free(tmpStr); -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r985 r986 2061 2061 errorException (NULL, _("Unable to load the oas.cfg file."), 2062 2062 "InternalError", NULL); 2063 free (m );2063 free (m1); 2064 2064 return 1; 2065 2065 } … … 2089 2089 setMapInMaps(m,"headers","Content-Type","application/json;charset=UTF-8"); 2090 2090 /* - 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){ 2092 2106 if(strncasecmp(cgiRequestMethod,"GET",3)!=0){ 2093 2107 setMapInMaps(m,"lenv","status_code","405"); … … 2205 2219 else if(strstr(cgiQueryString,"/processes")==NULL && (strstr(cgiQueryString,"/jobs")!=NULL || strstr(cgiQueryString,"/jobs/")!=NULL)){ 2206 2220 /* - /jobs url */ 2207 fprintf(stderr,"%s %d \n",__FILE__,__LINE__);2208 fflush(stderr);2209 2221 if(strncasecmp(cgiRequestMethod,"DELETE",6)==0) { 2210 fprintf(stderr,"%s %d \n",__FILE__,__LINE__);2211 fflush(stderr);2212 2222 char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6); 2213 2223 setMapInMaps(m,"lenv","gs_usid",jobId); 2214 2224 setMapInMaps(m,"lenv","file.statusFile",json_getStatusFilePath(m)); 2215 fprintf(stderr,"%s %d \n",__FILE__,__LINE__);2216 fflush(stderr);2217 2225 runDismiss(m,jobId); 2218 fprintf(stderr,"%s %d \n",__FILE__,__LINE__);2219 fflush(stderr);2220 2226 map* pmError=getMapFromMaps(m,"lenv","error"); 2221 2227 if(pmError!=NULL && strncasecmp(pmError->value,"true",4)==0){ … … 2227 2233 res=createStatus(m,SERVICE_DISMISSED); 2228 2234 } 2229 fprintf(stderr,"%s %d \n",__FILE__,__LINE__);2230 fflush(stderr);2231 2235 } 2232 2236 else if(strcasecmp(cgiRequestMethod,"get")==0){ … … 2262 2266 //char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6); 2263 2267 jobId[strlen(jobId)-8]=0; 2264 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);2265 fflush(stderr);2266 2268 char *sid=getStatusId(m,jobId); 2267 2269 if(sid==NULL){ 2268 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);2269 fflush(stderr);2270 2270 map* error=createMap("code","NoSuchJob"); 2271 2271 addToMap(error,"message",_("The JobID from the request does not match any of the Jobs running on this server")); … … 2273 2273 return 1; 2274 2274 }else{ 2275 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);2276 fflush(stderr);2277 2275 if(isRunning(m,jobId)>0){ 2278 2276 map* error=createMap("code","ResultNotReady"); … … 2281 2279 return 1; 2282 2280 }else{ 2283 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,jobId);2284 fflush(stderr);2285 2281 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");2289 2282 zStatStruct f_status; 2290 2283 int s=zStat(Url0, &f_status); 2291 2284 if(s==0 && f_status.st_size>0){ 2292 fprintf(stderr,"%s %d %s \n",__FILE__,__LINE__,Url0);2293 fflush(stderr);2294 2295 2285 if(f_status.st_size>15){ 2296 2286 json_object* pjoTmp=json_readFile(m,Url0); … … 2358 2348 } 2359 2349 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) */ 2362 2368 eres = SERVICE_STARTED; 2363 2369 initAllEnvironment(m,request_inputs,ntmp,"jrequest"); … … 2400 2406 if(json_object_object_get_ex(jobj,"id",&json_io)!=FALSE){ 2401 2407 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); 2402 2411 } 2403 fprintf(stderr,"%s %d \n", __FILE__,__LINE__);2404 fflush(stderr);2405 2412 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;2409 2413 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);2412 2414 map* preference=getMapFromMaps(m,"renv","HTTP_PREFER"); 2413 2415 map* mode=getMap(request_inputs,"mode"); … … 2593 2595 2594 2596 }//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 2612 2598 if(strstr(cgiQueryString,"/jobs")==NULL && strstr(cgiQueryString,"/jobs/")==NULL){ 2613 2599 /* - /processes/{id}/ */ … … 2647 2633 } 2648 2634 2649 fprintf(stderr,"%s %d \n", __FILE__,__LINE__);2650 fflush(stderr);2651 2635 fetchService(zooRegistry,m,&s1,request_inputs,ntmp,cIdentifier,printExceptionReportResponseJ); 2652 fprintf(stderr,"%s %d \n", __FILE__,__LINE__);2653 fflush(stderr);2654 2636 2655 2637 … … 3032 3014 3033 3015 fetchService(zooRegistry,m,&s1,request_inputs,ntmp,r_inputs->value,printExceptionReportResponse); 3034 /*3035 //*****************3036 // Fetch S13037 //*****************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 DEBUG3047 fprintf (stderr, "Trying to load %s\n", tmps1);3048 #endif3049 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 else3059 {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_DB3068 int metadb_id=_init_sql(m,"metadb");3069 //FAILED CONNECTING DB3070 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_HPC3079 addNestedOutputs(&s1);3080 #endif3081 if(zooRegistry!=NULL){3082 freeRegistry(&zooRegistry);3083 free(zooRegistry);3084 }3085 }else /* Not found in MetaDB /{3086 #endif3087 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_HPC3108 addNestedOutputs(&s1);3109 #endif3110 }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_DB3135 }3136 #endif3137 //*****************3138 // End Fetch S13139 //*****************3140 */3141 3016 3142 3017 #ifdef DEBUG -
trunk/zoo-project/zoo-services/utils/open-api/static/openapi.js
r985 r986 37 37 function loadRequest(){ 38 38 var requestObject={ 39 "id": System["JSON_STR"]["id"],39 //"id": System["JSON_STR"]["id"], 40 40 "inputs":{}, 41 41 "outputs":{}, -
trunk/zoo-project/zoo-services/utils/open-api/templates/index.html
r985 r986 26 26 #set values={} 27 27 #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 28 40 <html lang="en"> 29 41 <head> … … 272 284 <input type="hidden" name="oapi_ioAsArray" value="#if "io_as_array" in $openapi["openapi"]#$openapi["openapi"]["io_as_array"]#else#false#end if#" /> 273 285 <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")" /> 275 287 <input type="hidden" name="oapi_reqID" value="$cid" /> 276 288 <h3>Inputs</h3> … … 360 372 <a href="$values["links"][$i]["href"]">$printRel($openapi["links_title"],$values["links"][$i]["rel"])</a> 361 373 </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") 363 375 <p><a href="$values["links"][$i+1]["href"]">$printRel($openapi["links_title"],$values["links"][$i+1]["rel"])</a></p> 364 376 #end if … … 410 422 *# 411 423 <th scope="row"> 412 <a href="$(values[$i]["links"][0]["href"] [:-1]).html">424 <a href="$(values[$i]["links"][0]["href"]).html"> 413 425 <svg width="1em" height="1em" viewBox="0 0 16 16" class="bi bi-link-45deg" fill="currentColor" xmlns="http://www.w3.org/2000/svg"> 414 426 <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"/> … … 526 538 <hr> 527 539 <address>$openapi["openapi"]["rootUrl"]$(currentUrl).html</address> 528 <!-- hhmts start -->Last modified: T hu Mar 4 10:51:46CET 2021 <!-- hhmts end -->540 <!-- hhmts start -->Last modified: Tue Mar 9 16:33:11 CET 2021 <!-- hhmts end --> 529 541 </main> 530 542 #if $currentKey=="root"
Note: See TracChangeset
for help on using the changeset viewer.