- Timestamp:
- Feb 25, 2019, 1:57:11 PM (5 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/prototype-v0/zoo-project/zoo-kernel/response_print.c
r890 r896 1776 1776 * @param outputs the outputs generated by the service 1777 1777 */ 1778 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){ 1778 void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){ 1779 1779 xmlNsPtr ns,ns_ows,ns_xlink; 1780 1780 xmlNodePtr nr,n,nc,nc1=NULL,nc3; … … 1797 1797 char stored_path[1024]; 1798 1798 memset(stored_path,0,1024); 1799 1799 1800 1800 if(vid==0){ 1801 1801 char tmp[256]; … … 1982 1982 } 1983 1983 } 1984 1984 1985 1985 /** 1986 1986 * Display the process output only when requested ! … … 1993 1993 maps* mcursor=outputs; 1994 1994 elements* scursor=serv->outputs; 1995 map* testResponse=getMap(request,"RawDataOutput"); 1995 map* testResponse=getMap(request,"RawDataOutput"); 1996 1996 if(testResponse==NULL) 1997 1997 testResponse=getMap(request,"ResponseDocument"); 1998 while(mcursor!=NULL){ 1998 while(mcursor!=NULL){ 1999 1999 map* tmp0=getMap(mcursor->content,"inRequest"); 2000 scursor=getElements(serv->outputs,mcursor->name); 2001 if(scursor!=NULL){ 2002 if(testResponse==NULL || tmp0==NULL){ 2000 scursor=getElements(serv->outputs,mcursor->name); 2001 if(scursor!=NULL){ 2002 if(testResponse==NULL || tmp0==NULL){ 2003 2003 if(vid==0) 2004 2004 printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid); … … 2007 2007 } 2008 2008 else 2009 if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0){ 2009 if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0){ 2010 2010 if(vid==0) 2011 2011 printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid); 2012 2012 else 2013 2013 printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid); 2014 } 2014 } 2015 2015 }else 2016 2016 /** … … 2023 2023 printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid); 2024 2024 mcursor=mcursor->next; 2025 } 2025 } 2026 2026 if(vid==0) 2027 2027 xmlAddChild(n,nc); 2028 } 2029 2028 } 2030 2029 if(vid==0 && 2031 2030 hasStoredExecuteResponse==true … … 2176 2175 * @param type the type 2177 2176 */ 2178 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type,int vid){ 2179 2177 void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type,int vid){ 2180 2178 xmlNodePtr nc1,nc2,nc3; 2181 2179 nc1=xmlNewNode(ns_wps, BAD_CAST type); … … 2184 2182 tmp=e->content; 2185 2183 else 2186 tmp=m->content; 2187 2184 tmp=m->content; 2188 2185 if(vid==0){ 2189 2186 nc2=xmlNewNode(ns_ows, BAD_CAST "Identifier"); … … 2225 2222 xmlNewProp(nc1,BAD_CAST "id",BAD_CAST (e!=NULL?e->name:m->name)); 2226 2223 } 2227 2224 2228 2225 // IO type nested outputs 2229 if(m->child!=NULL){ 2226 if(m->child!=NULL){ 2230 2227 maps* curs=m->child; 2231 2228 elements* ecurs=getElements(e,(e!=NULL?e->name:m->name)); … … 2241 2238 } 2242 2239 } 2243 else{ 2240 else{ 2244 2241 map *tmpMap=getMap(m->content,"Reference"); 2245 if(tmpMap==NULL){ 2242 if(tmpMap==NULL){ 2246 2243 nc2=xmlNewNode(ns_wps, BAD_CAST "Data"); 2247 if(e!=NULL && e->format!=NULL){ 2248 if(strncasecmp(e->format,"LiteralOutput",strlen(e->format))==0)2249 nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");2244 if(e!=NULL && e->format!=NULL){ 2245 if (strncasecmp(e->format, "LiteralOutput", strlen(e->format)) == 0) 2246 nc3 = xmlNewNode(ns_wps, BAD_CAST "LiteralData"); 2250 2247 else 2251 2248 if(strncasecmp(e->format,"ComplexOutput",strlen(e->format))==0) … … 2254 2251 nc3=xmlNewNode(ns_wps, BAD_CAST "BoundingBoxData"); 2255 2252 else 2256 nc3=xmlNewNode(ns_wps, BAD_CAST e->format); 2257 } 2258 else { 2259 map* tmpV=getMapFromMaps(m,"format","value"); 2253 nc3=xmlNewNode(ns_wps, BAD_CAST e->format); 2254 } 2255 else { 2256 map* tmpV=getMapFromMaps(m,"format","value"); 2260 2257 if(tmpV!=NULL) 2261 2258 nc3=xmlNewNode(ns_wps, BAD_CAST tmpV->value); … … 2263 2260 nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData"); 2264 2261 } 2265 tmp=m->content; 2266 2262 tmp=m->content; 2263 2267 2264 while(tmp!=NULL){ 2268 2265 if(strcasecmp(tmp->name,"mimeType")==0 || … … 2270 2267 strcasecmp(tmp->name,"schema")==0 || 2271 2268 strcasecmp(tmp->name,"datatype")==0 || 2272 strcasecmp(tmp->name,"uom")==0) { 2273 2269 strcasecmp(tmp->name,"uom")==0) { 2274 2270 if(vid==0) 2275 2271 xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value); … … 2282 2278 } 2283 2279 } 2280 2284 2281 if(vid==0) 2285 2282 xmlAddChild(nc2,nc3); 2286 tmp=tmp->next; 2283 tmp=tmp->next; 2287 2284 } 2288 2285 if(e!=NULL && e->format!=NULL && strcasecmp(e->format,"BoundingBoxData")==0) { … … 2295 2292 } 2296 2293 } 2297 else { 2298 if(e!=NULL) 2299 tmp=getMap(e->defaults->content,"mimeType"); 2294 else { 2295 //if (e != NULL) { 2296 if (e != NULL && e->defaults != NULL) { // knut: add extra NULL pointer check in case user omits <Default> block in config file 2297 tmp = getMap(e->defaults->content, "mimeType"); 2298 } 2300 2299 else 2301 tmp=NULL; 2302 2300 tmp=NULL; 2303 2301 map* tmp1=getMap(m->content,"encoding"); 2304 2302 map* tmp2=getMap(m->content,"mimeType"); … … 2640 2638 dumpMaps(request_outputs); 2641 2639 fprintf(stderr,"printProcessResponse\n"); 2642 #endif 2640 #endif 2643 2641 map* toto=getMap(request_inputs1,"RawDataOutput"); 2644 2642 int asRaw=0; … … 2727 2725 } 2728 2726 2729 if(res!=SERVICE_SUCCEEDED){ 2727 if(res!=SERVICE_SUCCEEDED){ 2730 2728 printProcessResponse(m,request_inputs1,cpid, 2731 2729 s, s->name,res, // replace serviceProvider with serviceName in stored response file name … … 2734 2732 return; 2735 2733 } 2736 2737 2734 2738 2735 map *tmp1=getMapFromMaps(m,"main","tmpPath"); 2739 2736 if(asRaw==0){ … … 2757 2754 #endif 2758 2755 map *gfile=getMap(tmpI->content,"generated_file"); 2759 char *file_name=NULL; 2756 char *file_name=NULL; 2760 2757 if(gfile!=NULL){ 2761 2758 gfile=getMap(tmpI->content,"expected_generated_file"); … … 2765 2762 readGeneratedFile(m,tmpI->content,gfile->value); 2766 2763 file_name=zStrdup((gfile->value)+strlen(tmp1->value)); 2767 } 2764 } 2768 2765 toto=getMap(tmpI->content,"asReference"); 2769 2766 #ifdef USE_MS … … 2776 2773 if(toto!=NULL && strcasecmp(toto->value,"true")==0) 2777 2774 #endif 2778 { 2775 { 2779 2776 elements* in=getElements(s->outputs,tmpI->name); 2780 2777 if(in==NULL && s->outputs->child!=NULL){ … … 2791 2788 addToMap(tmpI->content,"encoding","UTF-8"); 2792 2789 addToMap(tmpI->content,"schema","http://schemas.opengis.net/ows/1.1.0/owsCommon.xsd"); 2793 } 2794 2790 } 2795 2791 char *file_path=NULL; 2796 2792 if(gfile==NULL) { … … 2880 2876 } 2881 2877 } 2882 #endif 2878 #endif 2883 2879 if(file_name!=NULL){ 2884 2880 free(file_name); … … 2896 2892 fprintf(stderr,"SERVICE : %s\n",s->name); 2897 2893 dumpMaps(m); 2898 #endif 2894 #endif 2899 2895 if(error<0) 2900 2896 printProcessResponse(m,request_inputs1,cpid,
Note: See TracChangeset
for help on using the changeset viewer.