Ignore:
Timestamp:
Sep 22, 2014, 3:05:28 PM (10 years ago)
Author:
djay
Message:

RawDataOutput? gesture fixes (see ref.).

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-project/zoo-kernel/zoo_service_loader.c

    r501 r502  
    259259
    260260        if(t<0){
    261           dumpMaps(m);
    262261          map* tmp00=getMapFromMaps(m,"lenv","message");
    263262          char tmp01[1024];
     
    863862    if(r_inputs!=NULL){
    864863      if(strncmp(r_inputs->value,"1.0.0",5)!=0){
    865       errorException(m, _("Unenderstood <AcceptVersions> value, 1.0.0 is the only acceptable value."), "VersionNegotiationFailed",NULL);
     864        errorException(m, _("Unenderstood <AcceptVersions> value, 1.0.0 is the only acceptable value."), "VersionNegotiationFailed",NULL);
    866865        freeMaps(&m);
    867866        free(m);
     
    16491648            xmlNodePtr cur3=cur2->children;
    16501649            /*      HINTERNET hInternetP;
    1651             hInternetP=InternetOpen(
    1652 #ifndef WIN32
    1653                                    (LPCTSTR)
    1654 #endif
    1655                                    "ZooWPSClient\0",
    1656                                    INTERNET_OPEN_TYPE_PRECONFIG,
    1657                                    NULL,NULL, 0);*/
     1650                    hInternetP=InternetOpen(
     1651                    #ifndef WIN32
     1652                    (LPCTSTR)
     1653                    #endif
     1654                    "ZooWPSClient\0",
     1655                    INTERNET_OPEN_TYPE_PRECONFIG,
     1656                    NULL,NULL, 0);*/
    16581657            //hInternet.ihandle[hInternet.nb].header=NULL;
    16591658            while(cur3!=NULL){
     
    17301729                    hInternet.waitingRequests[hInternet.nb]=strdup(tmp);
    17311730                    InternetOpenUrl(&hInternet,btmp->value,hInternet.waitingRequests[hInternet.nb],strlen(hInternet.waitingRequests[hInternet.nb]),
    1732                                         INTERNET_FLAG_NO_CACHE_WRITE,0);
     1731                                    INTERNET_FLAG_NO_CACHE_WRITE,0);
    17331732                  }
    17341733                  free(tmp);
     
    19711970    fprintf(stderr,"*****%d*****\n",tmps->nodeNr);
    19721971#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       
    19811985        /**
    1982          * A specific responseDocument node.
     1986         * Get every attribute from a RawDataOutput node
     1987         * mimeType, encoding, schema, uom
    19831988         */
    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){
    20731997              if(tmpmaps->content!=NULL)
    2074                 addToMap(tmpmaps->content,(char*)cur1->name,(char*)val);
     1998                addToMap(tmpmaps->content,outs[l],(char*)val);
    20751999              else
    2076                 tmpmaps->content=createMap((char*)cur1->name,(char*)val);
     2000                tmpmaps->content=createMap(outs[l],(char*)val);
    20772001            }
    20782002            xmlFree(val);
    20792003          }
    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){
    20812077            /**
    2082              * Get every attribute from a Output node
    2083              * mimeType, encoding, schema, uom, asReference
     2078             * Indentifier
    20842079             */
    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                 else
    2095                   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;
    20962091              }
    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;
    21002111              xmlFree(val);
    21012112            }
    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){
    21062138              /**
    2107                * Indentifier
     2139               * Get every attribute from a Output node
     2140               * mimeType, encoding, schema, uom, asReference
    21082141               */
    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);
    21202153                }
    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
    21262157                xmlFree(val);
    21272158              }
    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;
    21552160              while(cur2!=NULL && cur2->type != XML_ELEMENT_NODE)
    21562161                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              }
    21572215            }
     2216            cur1=cur1->next;
     2217            while(cur1!=NULL && cur1->type != XML_ELEMENT_NODE)
     2218              cur1=cur1->next;
    21582219          }
    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;
    21622229        }
    21632230      }
    2164       if(request_output_real_format==NULL)
    2165         request_output_real_format=dupMaps(&tmpmaps);
    2166       else
    2167         addMapsToMaps(&request_output_real_format,tmpmaps);
    2168       if(tmpmaps!=NULL){
    2169         freeMaps(&tmpmaps);
    2170         free(tmpmaps);
    2171         tmpmaps=NULL;
    2172       }
    2173     }
    21742231    xmlXPathFreeObject(tmpsptr);
    21752232    xmlFreeDoc(doc);
     
    23482405      fprintf(stderr,"setting variable... %s\n",(
    23492406#endif
    2350               SetEnvironmentVariable(mapcs->name,mapcs->value)
    2351 #ifdef DEBUG
    2352               ==0)? "OK" : "FAILED");
     2407                                                SetEnvironmentVariable(mapcs->name,mapcs->value)
     2408#ifdef DEBUG
     2409                                                ==0)? "OK" : "FAILED");
    23532410#else
    23542411      ;
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