Ignore:
Timestamp:
Aug 5, 2011, 3:02:43 PM (13 years ago)
Author:
djay
Message:

Merge branch-1.2 r268:r296.

Location:
branches/branch-1.2
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/branch-1.2

  • branches/branch-1.2/zoo-kernel/zoo_service_loader.c

    r268 r301  
    452452  _getcwd(ntmp,1024);
    453453#endif
    454   r_inputs=getMap(request_inputs,"metapath");
    455   if(r_inputs==NULL){
    456     if(request_inputs==NULL)
    457       request_inputs=createMap("metapath","");
    458     else
    459       addToMap(request_inputs,"metapath","");
    460 #ifdef DEBUG
    461     fprintf(stderr,"ADD METAPATH\n");
    462     dumpMap(request_inputs);
    463 #endif
    464     r_inputs=getMap(request_inputs,"metapath");
    465   }
     454  r_inputs=getMapOrFill(request_inputs,"metapath","");
     455
    466456  char conf_file[10240];
    467457  snprintf(conf_file,10240,"%s/%s/main.cfg",ntmp,r_inputs->value);
     
    493483  textdomain("zoo-services");
    494484
     485  map* lsoap=getMap(request_inputs,"soap");
     486  if(lsoap!=NULL && strcasecmp(lsoap->value,"true")==0)
     487    setMapInMaps(m,"main","isSoap","true");
     488  else
     489    setMapInMaps(m,"main","isSoap","false");
    495490
    496491  /**
     
    10131008            lmap->value=strdup(tmpValue);
    10141009            free(tmpValue);
    1015             dumpMap(tmpmaps->content);
    10161010            tmpc=strtok(NULL,"@");
    10171011            continue;
     
    10421036              fprintf(stderr,"REQUIRE TO DOWNLOAD A FILE FROM A SERVER : url(%s)\n",tmpv1+1);
    10431037#endif
     1038              char *tmpx=url_encode(tmpv1+1);
     1039              addToMap(tmpmaps->content,tmpn1,tmpx);
     1040             
    10441041#ifndef WIN32
    10451042              if(CHECK_INET_HANDLE(hInternet))
    10461043#endif
    10471044                {
    1048                   res=InternetOpenUrl(hInternet,tmpv1+1,NULL,0,
    1049                                       INTERNET_FLAG_NO_CACHE_WRITE,0);
    1050 #ifdef DEBUG
    1051                   fprintf(stderr,"(%s) content-length : %d,,res.nDataAlloc %d \n",
    1052                           tmpv1+1,res.nDataAlloc,res.nDataLen);
    1053 #endif
    1054                   char* tmpContent=(char*)calloc((res.nDataLen+1),sizeof(char));
    1055                   if(tmpContent == NULL){
    1056                     return errorException(m, _("Unable to allocate memory."), "InternalError");
    1057                   }
    1058                   size_t dwRead;
    1059                   InternetReadFile(res, (LPVOID)tmpContent,res.nDataLen, &dwRead);
    1060                   map* tmpMap=getMap(tmpmaps->content,"value");
    1061                   if(tmpMap!=NULL){
    1062                     free(tmpMap->value);
    1063                     tmpMap->value=(char*)malloc((res.nDataLen+1)*sizeof(char));
    1064                     memmove(tmpMap->value,tmpContent,(res.nDataLen)*sizeof(char));
    1065                     tmpMap->value[res.nDataLen]=0;
    1066                     if(strlen(tmpContent)!=res.nDataLen){
    1067                       char tmp[256];
    1068                       sprintf(tmp,"%d",res.nDataLen*sizeof(char));
    1069                       addToMap(tmpmaps->content,"size",tmp);
    1070                     }
    1071                   }
    1072                   free(tmpContent);
     1045                  loadRemoteFile(m,tmpmaps->content,hInternet,tmpv1+1);
    10731046                }
    1074               char *tmpx=url_encode(tmpv1+1);
    1075               addToMap(tmpmaps->content,tmpn1,tmpx);
    1076               free(tmpx);
     1047              char *tmpx1=url_encode(tmpv1+1);
     1048              addToMap(tmpmaps->content,tmpn1,tmpx1);
     1049              free(tmpx1);
    10771050              addToMap(tmpmaps->content,"Reference",tmpv1+1);
    1078               dumpMap(tmpmaps->content);
    10791051            }
    10801052          tmpc=strtok(NULL,"@");
     
    11931165            fprintf(stderr,"REFERENCE\n");
    11941166#endif
    1195             const char *refs[5];
    1196             refs[0]="mimeType";
    1197             refs[1]="encoding";
    1198             refs[2]="schema";
    1199             refs[3]="method";
    1200             refs[4]="href";
     1167            const char *refs[5]={"mimeType","encoding","schema","method","href"};
    12011168            for(int l=0;l<5;l++){
    12021169#ifdef DEBUG
     
    12131180                  if(!(ltmp!=NULL && strcmp(ltmp->value,"POST")==0)
    12141181                     && CHECK_INET_HANDLE(hInternet)){
    1215                     res=InternetOpenUrl(hInternet,(char*)val,NULL,0,
    1216                                         INTERNET_FLAG_NO_CACHE_WRITE,0);
    1217                     char* tmpContent=
    1218                       (char*)calloc((res.nDataLen+1),sizeof(char));
    1219                     if(tmpContent == NULL){
    1220                       return errorException(m, _("Unable to allocate memory."), "InternalError");
    1221                     }
    1222                     size_t dwRead;
    1223                     InternetReadFile(res, (LPVOID)tmpContent,
    1224                                      res.nDataLen, &dwRead);
    1225                     tmpContent[res.nDataLen]=0;
    1226                     addToMap(tmpmaps->content,"value",tmpContent);
     1182                    loadRemoteFile(m,tmpmaps->content,hInternet,(char*)val);
    12271183                  }
    12281184                }
     
    14151371                    else
    14161372                      tmpmaps->content=createMap(list[l],(char*)val);
     1373#ifdef DEBUG
     1374                    fprintf(stderr,"%s\n",val);
     1375#endif
    14171376                  }
    1418 #ifdef DEBUG
    1419                   fprintf(stderr,"%s\n",val);
    1420 #endif
    14211377                  xmlFree(val);
    1422                   free(list[l]);
     1378                  free(list[l]);                 
    14231379                }
    14241380              }
     
    14281384                 * mimeType, encoding, schema
    14291385                 */
    1430                 const char *coms[3];
    1431                 coms[0]="mimeType";
    1432                 coms[1]="encoding";
    1433                 coms[2]="schema";
     1386                const char *coms[3]={"mimeType","encoding","schema"};
    14341387                for(int l=0;l<3;l++){
    14351388#ifdef DEBUG
    1436                   fprintf(stderr,"*** ComplexData %s ***",coms[l]);
     1389                  fprintf(stderr,"*** ComplexData %s ***\n",coms[l]);
    14371390#endif
    14381391                  xmlChar *val=xmlGetProp(cur4,BAD_CAST coms[l]);
     
    14421395                    else
    14431396                      tmpmaps->content=createMap(coms[l],(char*)val);
     1397#ifdef DEBUG
     1398                    fprintf(stderr,"%s\n",val);
     1399#endif
    14441400                  }
    1445 #ifdef DEBUG
    1446                   fprintf(stderr,"%s\n",val);
    1447 #endif
    14481401                  xmlFree(val);
    14491402                }
    14501403              }
     1404
    14511405              map* test=getMap(tmpmaps->content,"encoding");
    1452               if(test==NULL || strcasecmp(test->value,"base64")!=0){
     1406              if(test==NULL){
     1407                if(tmpmaps->content!=NULL)
     1408                  addToMap(tmpmaps->content,"encoding","utf-8");
     1409                else
     1410                  tmpmaps->content=createMap("encoding","utf-8");
     1411                test=getMap(tmpmaps->content,"encoding");
     1412              }
     1413
     1414              if(strcasecmp(test->value,"base64")!=0){
    14531415                xmlChar* mv=xmlNodeListGetString(doc,cur4->xmlChildrenNode,1);
    1454                 if(mv==NULL){
     1416                map* ltmp=getMap(tmpmaps->content,"mimeType");
     1417                if(mv==NULL ||
     1418                   (xmlStrcasecmp(cur4->name, BAD_CAST "ComplexData")==0 &&
     1419                    (ltmp==NULL || strncasecmp(ltmp->value,"text/xml",8)==0) )){
    14551420                  xmlDocPtr doc1=xmlNewDoc(BAD_CAST "1.0");
    14561421                  int buffersize;
    1457                   xmlDocSetRootElement(doc1,cur4->xmlChildrenNode);
     1422                  xmlNodePtr cur5=cur4->children;
     1423                  while(cur5!=NULL &&cur5->type!=XML_ELEMENT_NODE)
     1424                    cur5=cur5->next;
     1425                  xmlDocSetRootElement(doc1,cur5);
    14581426                  xmlDocDumpFormatMemoryEnc(doc1, &mv, &buffersize, "utf-8", 1);
    14591427                  char size[1024];
     
    15561524         * storeExecuteResponse, lineage, status
    15571525         */
    1558         const char *ress[3];
    1559         ress[0]="storeExecuteResponse";
    1560         ress[1]="lineage";
    1561         ress[2]="status";
     1526        const char *ress[3]={"storeExecuteResponse","lineage","status"};
    15621527        xmlChar *val;
    15631528        for(int l=0;l<3;l++){
     
    15801545        xmlNodePtr cur1=cur->children;
    15811546        while(cur1){
    1582           if(xmlStrncasecmp(cur1->name,BAD_CAST "Output",xmlStrlen(cur1->name))==0){
     1547          /**
     1548           * Indentifier
     1549           */
     1550          if(xmlStrncasecmp(cur1->name,BAD_CAST "Identifier",xmlStrlen(cur1->name))==0){
     1551            xmlChar *val=
     1552              xmlNodeListGetString(doc,cur1->xmlChildrenNode,1);
     1553            if(tmpmaps==NULL){
     1554              tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1555              if(tmpmaps == NULL){
     1556                return errorException(m, _("Unable to allocate memory."), "InternalError");
     1557              }
     1558              tmpmaps->name=strdup((char*)val);
     1559              tmpmaps->content=NULL;
     1560              tmpmaps->next=NULL;
     1561            }
     1562            else
     1563              tmpmaps->name=strdup((char*)val);;
     1564            xmlFree(val);
     1565          }
     1566          /**
     1567           * Title, Asbtract
     1568           */
     1569          else if(xmlStrncasecmp(cur1->name,BAD_CAST "Title",xmlStrlen(cur1->name))==0 ||
     1570                  xmlStrncasecmp(cur1->name,BAD_CAST "Abstract",xmlStrlen(cur1->name))==0){
     1571            xmlChar *val=
     1572              xmlNodeListGetString(doc,cur1->xmlChildrenNode,1);
     1573            if(tmpmaps==NULL){
     1574              tmpmaps=(maps*)calloc(1,MAPS_SIZE);
     1575              if(tmpmaps == NULL){
     1576                return errorException(m, _("Unable to allocate memory."), "InternalError");
     1577              }
     1578              tmpmaps->name=strdup("missingIndetifier");
     1579              tmpmaps->content=createMap((char*)cur1->name,(char*)val);
     1580              tmpmaps->next=NULL;
     1581            }
     1582            else{
     1583              if(tmpmaps->content!=NULL)
     1584                addToMap(tmpmaps->content,
     1585                         (char*)cur1->name,(char*)val);
     1586              else
     1587                tmpmaps->content=
     1588                  createMap((char*)cur1->name,(char*)val);
     1589            }
     1590            xmlFree(val);
     1591          }
     1592          else if(xmlStrncasecmp(cur1->name,BAD_CAST "Output",xmlStrlen(cur1->name))==0){
    15831593            /**
    15841594             * Get every attribute from a Output node
    15851595             * mimeType, encoding, schema, uom, asReference
    15861596             */
    1587             const char *outs[5];
    1588             outs[0]="mimeType";
    1589             outs[1]="encoding";
    1590             outs[2]="schema";
    1591             outs[3]="uom";
    1592             outs[4]="asReference";
     1597            const char *outs[5]={"mimeType","encoding","schema","uom","asReference"};
    15931598            for(int l=0;l<5;l++){
    15941599#ifdef DEBUG
     
    16321637               * Title, Asbtract
    16331638               */
    1634               if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 ||
     1639              else if(xmlStrncasecmp(cur2->name,BAD_CAST "Title",xmlStrlen(cur2->name))==0 ||
    16351640                 xmlStrncasecmp(cur2->name,BAD_CAST "Abstract",xmlStrlen(cur2->name))==0){
    16361641                xmlChar *val=
     
    16841689  dumpMaps(request_output_real_format);
    16851690  dumpMap(request_inputs);
     1691  fprintf(stderr,"\n%i\n",i);
    16861692#endif
    16871693
     
    16911697   */
    16921698  char *dfv=addDefaultValues(&request_input_real_format,s1->inputs,m,0);
    1693   if(strcmp(dfv,"")!=0){
     1699  char *dfv1=addDefaultValues(&request_output_real_format,s1->outputs,m,1);
     1700  if(strcmp(dfv1,"")!=0 || strcmp(dfv,"")!=0){
    16941701    char tmps[1024];
    1695     snprintf(tmps,1024,_("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."),dfv);
     1702    if(strcmp(dfv,"")!=0){
     1703      snprintf(tmps,1024,_("The <%s> argument was not specified in DataInputs but defined as requested in ZOO ServicesProvider configuration file, please correct your query or the ZOO Configuration file."),dfv);
     1704    }
     1705    else if(strcmp(dfv1,"")!=0){
     1706      snprintf(tmps,1024,_("The <%s> argument was specified as Output identifier but not defined in the ZOO Configuration File. Please, correct your query or the ZOO Configuration File."),dfv1);
     1707    }
    16961708    map* tmpe=createMap("text",tmps);
    16971709    addToMap(tmpe,"code","MissingParameterValue");
     
    17131725    return 1;
    17141726  }
    1715   addDefaultValues(&request_output_real_format,s1->outputs,m,1);
    17161727
    17171728  ensureDecodedBase64(&request_input_real_format);
     
    18071818  addToMap(_tmpMaps->content,"status","0");
    18081819  addToMap(_tmpMaps->content,"cwd",ntmp);
     1820  map* ltmp=getMap(request_inputs,"soap");
     1821  if(ltmp!=NULL)
     1822    addToMap(_tmpMaps->content,"soap",ltmp->value);
     1823  else
     1824    addToMap(_tmpMaps->content,"soap","false");
    18091825  if(cgiCookie!=NULL && strlen(cgiCookie)>0){
    18101826    addToMap(_tmpMaps->content,"sessid",strstr(cgiCookie,"=")+1);
     
    18241840    if(istat==0 && file_status.st_size>0){
    18251841      conf_read(session_file_path,tmpSess);
    1826       dumpMaps(tmpSess);
    18271842      addMapsToMaps(&m,tmpSess);
    18281843      freeMaps(&tmpSess);
     
    18491864    addToMap(request_inputs,"status","true");
    18501865    status=getMap(request_inputs,"status");
    1851     dumpMap(request_inputs);
    18521866    fprintf(stderr,"cgiSID : %s",cgiSid);
    18531867  }
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