Changeset 502 for trunk/zoo-project
- Timestamp:
- Sep 22, 2014, 3:05:28 PM (10 years ago)
- Location:
- trunk/zoo-project
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/zoo-project/zoo-api/js/ZOO-api.js
r401 r502 6189 6189 }, 6190 6190 'RawDataOutput': function(identifier,obj) { 6191 var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:RawDataOutput ><wps:Output '+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:Output></wps:RawDataOutput></wps:ResponseForm>');6191 var output = new XML('<wps:ResponseForm xmlns:wps="'+this.namespaces['wps']+'"><wps:RawDataOutput '+(obj["mimeType"]?' mimeType="'+obj["mimeType"]+'" ':'')+(obj["encoding"]?' encoding="'+obj["encoding"]+'" ':'')+'><ows:Identifier xmlns:ows="'+this.namespaces['ows']+'">'+identifier+'</ows:Identifier></wps:RawDataOutput></wps:ResponseForm>'); 6192 6192 if (obj.encoding) 6193 6193 output.*::Data.*::ComplexData.@encoding = obj.encoding; -
trunk/zoo-project/zoo-kernel/zoo_service_loader.c
r501 r502 259 259 260 260 if(t<0){ 261 dumpMaps(m);262 261 map* tmp00=getMapFromMaps(m,"lenv","message"); 263 262 char tmp01[1024]; … … 863 862 if(r_inputs!=NULL){ 864 863 if(strncmp(r_inputs->value,"1.0.0",5)!=0){ 865 864 errorException(m, _("Unenderstood <AcceptVersions> value, 1.0.0 is the only acceptable value."), "VersionNegotiationFailed",NULL); 866 865 freeMaps(&m); 867 866 free(m); … … 1649 1648 xmlNodePtr cur3=cur2->children; 1650 1649 /* HINTERNET hInternetP; 1651 hInternetP=InternetOpen(1652 #ifndef WIN321653 1654 #endif1655 1656 1657 1650 hInternetP=InternetOpen( 1651 #ifndef WIN32 1652 (LPCTSTR) 1653 #endif 1654 "ZooWPSClient\0", 1655 INTERNET_OPEN_TYPE_PRECONFIG, 1656 NULL,NULL, 0);*/ 1658 1657 //hInternet.ihandle[hInternet.nb].header=NULL; 1659 1658 while(cur3!=NULL){ … … 1730 1729 hInternet.waitingRequests[hInternet.nb]=strdup(tmp); 1731 1730 InternetOpenUrl(&hInternet,btmp->value,hInternet.waitingRequests[hInternet.nb],strlen(hInternet.waitingRequests[hInternet.nb]), 1732 1731 INTERNET_FLAG_NO_CACHE_WRITE,0); 1733 1732 } 1734 1733 free(tmp); … … 1971 1970 fprintf(stderr,"*****%d*****\n",tmps->nodeNr); 1972 1971 #endif 1973 for(int k=0;k<tmps->nodeNr;k++){ 1974 if(asRaw==true) 1975 addToMap(request_inputs,"RawDataOutput",""); 1976 else 1977 addToMap(request_inputs,"ResponseDocument",""); 1978 maps *tmpmaps=NULL; 1979 xmlNodePtr cur=tmps->nodeTab[k]; 1980 if(cur->type == XML_ELEMENT_NODE) { 1972 if(asRaw==true){ 1973 addToMap(request_inputs,"RawDataOutput",""); 1974 xmlNodePtr cur0=tmps->nodeTab[0]; 1975 if(cur0->type == XML_ELEMENT_NODE) { 1976 1977 maps* tmpmaps=(maps*)malloc(MAPS_SIZE); 1978 if(tmpmaps == NULL){ 1979 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1980 } 1981 tmpmaps->name=zStrdup("unknownIdentifier"); 1982 tmpmaps->content=NULL; 1983 tmpmaps->next=NULL; 1984 1981 1985 /** 1982 * A specific responseDocument node. 1986 * Get every attribute from a RawDataOutput node 1987 * mimeType, encoding, schema, uom 1983 1988 */ 1984 if(tmpmaps==NULL){ 1985 tmpmaps=(maps*)malloc(MAPS_SIZE); 1986 if(tmpmaps == NULL){ 1987 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 1988 } 1989 tmpmaps->name=zStrdup("unknownIdentifier"); 1990 tmpmaps->content=NULL; 1991 tmpmaps->next=NULL; 1992 } 1993 /** 1994 * Get every attribute: storeExecuteResponse, lineage, status 1995 */ 1996 const char *ress[3]={"storeExecuteResponse","lineage","status"}; 1997 xmlChar *val; 1998 for(int l=0;l<3;l++){ 1999 #ifdef DEBUG 2000 fprintf(stderr,"*** %s ***\t",ress[l]); 2001 #endif 2002 val=xmlGetProp(cur,BAD_CAST ress[l]); 2003 if(val!=NULL && strlen((char*)val)>0){ 2004 if(tmpmaps->content!=NULL) 2005 addToMap(tmpmaps->content,ress[l],(char*)val); 2006 else 2007 tmpmaps->content=createMap(ress[l],(char*)val); 2008 addToMap(request_inputs,ress[l],(char*)val); 2009 } 2010 #ifdef DEBUG 2011 fprintf(stderr,"%s\n",val); 2012 #endif 2013 xmlFree(val); 2014 } 2015 xmlNodePtr cur1=cur->children; 2016 while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE) 2017 cur1=cur1->next; 2018 int cur1cnt=0; 2019 while(cur1){ 2020 /** 2021 * Indentifier 2022 */ 2023 if(xmlStrncasecmp(cur1->name,BAD_CAST "Identifier",xmlStrlen(cur1->name))==0){ 2024 xmlChar *val= 2025 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 2026 if(tmpmaps==NULL){ 2027 tmpmaps=(maps*)malloc(MAPS_SIZE); 2028 if(tmpmaps == NULL){ 2029 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2030 } 2031 tmpmaps->name=zStrdup((char*)val); 2032 tmpmaps->content=NULL; 2033 tmpmaps->next=NULL; 2034 } 2035 else{ 2036 //free(tmpmaps->name); 2037 tmpmaps->name=zStrdup((char*)val); 2038 } 2039 if(asRaw==true) 2040 addToMap(request_inputs,"RawDataOutput",(char*)val); 2041 else{ 2042 if(cur1cnt==0) 2043 addToMap(request_inputs,"ResponseDocument",(char*)val); 2044 else{ 2045 map* tt=getMap(request_inputs,"ResponseDocument"); 2046 char* tmp=zStrdup(tt->value); 2047 free(tt->value); 2048 tt->value=(char*)malloc((strlen(tmp)+strlen((char*)val)+1)*sizeof(char)); 2049 sprintf(tt->value,"%s;%s",tmp,(char*)val); 2050 free(tmp); 2051 } 2052 } 2053 cur1cnt+=1; 2054 xmlFree(val); 2055 } 2056 /** 2057 * Title, Asbtract 2058 */ 2059 else if(xmlStrncasecmp(cur1->name,BAD_CAST "Title",xmlStrlen(cur1->name))==0 || 2060 xmlStrncasecmp(cur1->name,BAD_CAST "Abstract",xmlStrlen(cur1->name))==0){ 2061 xmlChar *val= 2062 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 2063 if(tmpmaps==NULL){ 2064 tmpmaps=(maps*)malloc(MAPS_SIZE); 2065 if(tmpmaps == NULL){ 2066 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2067 } 2068 tmpmaps->name=zStrdup("missingIndetifier"); 2069 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 2070 tmpmaps->next=NULL; 2071 } 2072 else{ 1989 const char *outs[4]={"mimeType","encoding","schema","uom"}; 1990 for(int l=0;l<4;l++){ 1991 #ifdef DEBUG 1992 fprintf(stderr,"*** %s ***\t",outs[l]); 1993 #endif 1994 xmlChar *val=xmlGetProp(cur0,BAD_CAST outs[l]); 1995 if(val!=NULL){ 1996 if(strlen((char*)val)>0){ 2073 1997 if(tmpmaps->content!=NULL) 2074 addToMap(tmpmaps->content, (char*)cur1->name,(char*)val);1998 addToMap(tmpmaps->content,outs[l],(char*)val); 2075 1999 else 2076 tmpmaps->content=createMap( (char*)cur1->name,(char*)val);2000 tmpmaps->content=createMap(outs[l],(char*)val); 2077 2001 } 2078 2002 xmlFree(val); 2079 2003 } 2080 else if(xmlStrncasecmp(cur1->name,BAD_CAST "Output",xmlStrlen(cur1->name))==0){ 2004 } 2005 xmlNodePtr cur2=cur0->children; 2006 while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE) 2007 cur2=cur2->next; 2008 int cur1cnt=0; 2009 while(cur2!=NULL){ 2010 if(xmlStrncasecmp(cur2->name,BAD_CAST "Identifier",xmlStrlen(cur2->name))==0){ 2011 xmlChar *val= 2012 xmlNodeListGetString(NULL,cur2->xmlChildrenNode,1); 2013 free(tmpmaps->name); 2014 tmpmaps->name=zStrdup((char*)val); 2015 } 2016 cur2=cur2->next; 2017 while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE) 2018 cur2=cur2->next; 2019 } 2020 if(request_output_real_format==NULL) 2021 request_output_real_format=dupMaps(&tmpmaps); 2022 else 2023 addMapsToMaps(&request_output_real_format,tmpmaps); 2024 if(tmpmaps!=NULL){ 2025 freeMaps(&tmpmaps); 2026 free(tmpmaps); 2027 tmpmaps=NULL; 2028 } 2029 } 2030 } 2031 else 2032 for(int k=0;k<tmps->nodeNr;k++){ 2033 //else 2034 addToMap(request_inputs,"ResponseDocument",""); 2035 maps *tmpmaps=NULL; 2036 xmlNodePtr cur=tmps->nodeTab[k]; 2037 if(cur->type == XML_ELEMENT_NODE) { 2038 /** 2039 * A specific responseDocument node. 2040 */ 2041 if(tmpmaps==NULL){ 2042 tmpmaps=(maps*)malloc(MAPS_SIZE); 2043 if(tmpmaps == NULL){ 2044 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2045 } 2046 tmpmaps->name=zStrdup("unknownIdentifier"); 2047 tmpmaps->content=NULL; 2048 tmpmaps->next=NULL; 2049 } 2050 /** 2051 * Get every attribute: storeExecuteResponse, lineage, status 2052 */ 2053 const char *ress[3]={"storeExecuteResponse","lineage","status"}; 2054 xmlChar *val; 2055 for(int l=0;l<3;l++){ 2056 #ifdef DEBUG 2057 fprintf(stderr,"*** %s ***\t",ress[l]); 2058 #endif 2059 val=xmlGetProp(cur,BAD_CAST ress[l]); 2060 if(val!=NULL && strlen((char*)val)>0){ 2061 if(tmpmaps->content!=NULL) 2062 addToMap(tmpmaps->content,ress[l],(char*)val); 2063 else 2064 tmpmaps->content=createMap(ress[l],(char*)val); 2065 addToMap(request_inputs,ress[l],(char*)val); 2066 } 2067 #ifdef DEBUG 2068 fprintf(stderr,"%s\n",val); 2069 #endif 2070 xmlFree(val); 2071 } 2072 xmlNodePtr cur1=cur->children; 2073 while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE) 2074 cur1=cur1->next; 2075 int cur1cnt=0; 2076 while(cur1){ 2081 2077 /** 2082 * Get every attribute from a Output node 2083 * mimeType, encoding, schema, uom, asReference 2078 * Indentifier 2084 2079 */ 2085 const char *outs[5]={"mimeType","encoding","schema","uom","asReference"};2086 for(int l=0;l<5;l++){2087 #ifdef DEBUG 2088 fprintf(stderr,"*** %s ***\t",outs[l]);2089 #endif 2090 val=xmlGetProp(cur1,BAD_CAST outs[l]);2091 if(val!=NULL && strlen((char*)val)>0){2092 if(tmpmaps->content!=NULL)2093 addToMap(tmpmaps->content,outs[l],(char*)val);2094 else2095 tmpmaps->content=createMap(outs[l],(char*)val);2080 if(xmlStrncasecmp(cur1->name,BAD_CAST "Identifier",xmlStrlen(cur1->name))==0){ 2081 xmlChar *val= 2082 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 2083 if(tmpmaps==NULL){ 2084 tmpmaps=(maps*)malloc(MAPS_SIZE); 2085 if(tmpmaps == NULL){ 2086 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2087 } 2088 tmpmaps->name=zStrdup((char*)val); 2089 tmpmaps->content=NULL; 2090 tmpmaps->next=NULL; 2096 2091 } 2097 #ifdef DEBUG 2098 fprintf(stderr,"%s\n",val); 2099 #endif 2092 else{ 2093 free(tmpmaps->name); 2094 tmpmaps->name=zStrdup((char*)val); 2095 } 2096 if(asRaw==true) 2097 addToMap(request_inputs,"RawDataOutput",(char*)val); 2098 else{ 2099 if(cur1cnt==0) 2100 addToMap(request_inputs,"ResponseDocument",(char*)val); 2101 else{ 2102 map* tt=getMap(request_inputs,"ResponseDocument"); 2103 char* tmp=zStrdup(tt->value); 2104 free(tt->value); 2105 tt->value=(char*)malloc((strlen(tmp)+strlen((char*)val)+1)*sizeof(char)); 2106 sprintf(tt->value,"%s;%s",tmp,(char*)val); 2107 free(tmp); 2108 } 2109 } 2110 cur1cnt+=1; 2100 2111 xmlFree(val); 2101 2112 } 2102 xmlNodePtr cur2=cur1->children; 2103 while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE) 2104 cur2=cur2->next; 2105 while(cur2){ 2113 /** 2114 * Title, Asbtract 2115 */ 2116 else if(xmlStrncasecmp(cur1->name,BAD_CAST "Title",xmlStrlen(cur1->name))==0 || 2117 xmlStrncasecmp(cur1->name,BAD_CAST "Abstract",xmlStrlen(cur1->name))==0){ 2118 xmlChar *val= 2119 xmlNodeListGetString(doc,cur1->xmlChildrenNode,1); 2120 if(tmpmaps==NULL){ 2121 tmpmaps=(maps*)malloc(MAPS_SIZE); 2122 if(tmpmaps == NULL){ 2123 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2124 } 2125 tmpmaps->name=zStrdup("missingIndetifier"); 2126 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 2127 tmpmaps->next=NULL; 2128 } 2129 else{ 2130 if(tmpmaps->content!=NULL) 2131 addToMap(tmpmaps->content,(char*)cur1->name,(char*)val); 2132 else 2133 tmpmaps->content=createMap((char*)cur1->name,(char*)val); 2134 } 2135 xmlFree(val); 2136 } 2137 else if(xmlStrncasecmp(cur1->name,BAD_CAST "Output",xmlStrlen(cur1->name))==0){ 2106 2138 /** 2107 * Indentifier 2139 * Get every attribute from a Output node 2140 * mimeType, encoding, schema, uom, asReference 2108 2141 */ 2109 if(xmlStrncasecmp(cur2->name,BAD_CAST "Identifier",xmlStrlen(cur2->name))==0){2110 xmlChar *val=2111 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 2112 if(tmpmaps==NULL){2113 tmpmaps=(maps*)malloc(MAPS_SIZE); 2114 if(tmpmaps == NULL){2115 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL);2116 }2117 tmpmaps->name=zStrdup((char*)val);2118 tmpmaps->content=NULL;2119 tmpmaps->next=NULL;2142 const char *outs[5]={"mimeType","encoding","schema","uom","asReference"}; 2143 for(int l=0;l<5;l++){ 2144 #ifdef DEBUG 2145 fprintf(stderr,"*** %s ***\t",outs[l]); 2146 #endif 2147 xmlChar *val=xmlGetProp(cur1,BAD_CAST outs[l]); 2148 if(val!=NULL && strlen((char*)val)>0){ 2149 if(tmpmaps->content!=NULL) 2150 addToMap(tmpmaps->content,outs[l],(char*)val); 2151 else 2152 tmpmaps->content=createMap(outs[l],(char*)val); 2120 2153 } 2121 else{ 2122 if(tmpmaps->name!=NULL) 2123 free(tmpmaps->name); 2124 tmpmaps->name=zStrdup((char*)val);; 2125 } 2154 #ifdef DEBUG 2155 fprintf(stderr,"%s\n",val); 2156 #endif 2126 2157 xmlFree(val); 2127 2158 } 2128 /** 2129 * Title, Asbtract 2130 */ 2131 else if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 || 2132 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){ 2133 xmlChar *val= 2134 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 2135 if(tmpmaps==NULL){ 2136 tmpmaps=(maps*)malloc(MAPS_SIZE); 2137 if(tmpmaps == NULL){ 2138 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2139 } 2140 tmpmaps->name=zStrdup("missingIndetifier"); 2141 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 2142 tmpmaps->next=NULL; 2143 } 2144 else{ 2145 if(tmpmaps->content!=NULL) 2146 addToMap(tmpmaps->content, 2147 (char*)cur2->name,(char*)val); 2148 else 2149 tmpmaps->content= 2150 createMap((char*)cur2->name,(char*)val); 2151 } 2152 xmlFree(val); 2153 } 2154 cur2=cur2->next; 2159 xmlNodePtr cur2=cur1->children; 2155 2160 while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE) 2156 2161 cur2=cur2->next; 2162 while(cur2){ 2163 /** 2164 * Indentifier 2165 */ 2166 if(xmlStrncasecmp(cur2->name,BAD_CAST "Identifier",xmlStrlen(cur2->name))==0){ 2167 xmlChar *val= 2168 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 2169 if(tmpmaps==NULL){ 2170 tmpmaps=(maps*)malloc(MAPS_SIZE); 2171 if(tmpmaps == NULL){ 2172 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2173 } 2174 tmpmaps->name=zStrdup((char*)val); 2175 tmpmaps->content=NULL; 2176 tmpmaps->next=NULL; 2177 } 2178 else{ 2179 if(tmpmaps->name!=NULL) 2180 free(tmpmaps->name); 2181 tmpmaps->name=zStrdup((char*)val);; 2182 } 2183 xmlFree(val); 2184 } 2185 /** 2186 * Title, Asbtract 2187 */ 2188 else if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 || 2189 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){ 2190 xmlChar *val= 2191 xmlNodeListGetString(doc,cur2->xmlChildrenNode,1); 2192 if(tmpmaps==NULL){ 2193 tmpmaps=(maps*)malloc(MAPS_SIZE); 2194 if(tmpmaps == NULL){ 2195 return errorException(m, _("Unable to allocate memory."), "InternalError",NULL); 2196 } 2197 tmpmaps->name=zStrdup("missingIndetifier"); 2198 tmpmaps->content=createMap((char*)cur2->name,(char*)val); 2199 tmpmaps->next=NULL; 2200 } 2201 else{ 2202 if(tmpmaps->content!=NULL) 2203 addToMap(tmpmaps->content, 2204 (char*)cur2->name,(char*)val); 2205 else 2206 tmpmaps->content= 2207 createMap((char*)cur2->name,(char*)val); 2208 } 2209 xmlFree(val); 2210 } 2211 cur2=cur2->next; 2212 while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE) 2213 cur2=cur2->next; 2214 } 2157 2215 } 2216 cur1=cur1->next; 2217 while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE) 2218 cur1=cur1->next; 2158 2219 } 2159 cur1=cur1->next; 2160 while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE) 2161 cur1=cur1->next; 2220 } 2221 if(request_output_real_format==NULL) 2222 request_output_real_format=dupMaps(&tmpmaps); 2223 else 2224 addMapsToMaps(&request_output_real_format,tmpmaps); 2225 if(tmpmaps!=NULL){ 2226 freeMaps(&tmpmaps); 2227 free(tmpmaps); 2228 tmpmaps=NULL; 2162 2229 } 2163 2230 } 2164 if(request_output_real_format==NULL)2165 request_output_real_format=dupMaps(&tmpmaps);2166 else2167 addMapsToMaps(&request_output_real_format,tmpmaps);2168 if(tmpmaps!=NULL){2169 freeMaps(&tmpmaps);2170 free(tmpmaps);2171 tmpmaps=NULL;2172 }2173 }2174 2231 xmlXPathFreeObject(tmpsptr); 2175 2232 xmlFreeDoc(doc); … … 2348 2405 fprintf(stderr,"setting variable... %s\n",( 2349 2406 #endif 2350 2351 #ifdef DEBUG 2352 2407 SetEnvironmentVariable(mapcs->name,mapcs->value) 2408 #ifdef DEBUG 2409 ==0)? "OK" : "FAILED"); 2353 2410 #else 2354 2411 ;
Note: See TracChangeset
for help on using the changeset viewer.