Changeset 72


Ignore:
Timestamp:
Jan 13, 2011, 5:36:55 PM (13 years ago)
Author:
djay
Message:

Fix for use of status and storeExecuteResponse parameters.

Location:
trunk/zoo-kernel
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/zoo-kernel/service_internal.c

    r71 r72  
    22 * Author : Gérald FENOY
    33 *
    4  * Copyright (c) 2009-2010 GeoLabs SARL
     4 * Copyright (c) 2009-2011 GeoLabs SARL
    55 *
    66 * Permission is hereby granted, free of charge, to any person obtaining a copy
     
    10481048  char tmp[256];
    10491049  char url[1024];
     1050  char stored_path[1024];
    10501051  memset(tmp,0,256);
    1051   memset(url,0,256);
     1052  memset(url,0,1024);
     1053  memset(stored_path,0,1024);
    10521054  maps* tmp_maps=getMaps(m,"main");
    10531055  if(tmp_maps!=NULL){
     
    10991101    if(tmpm1!=NULL)
    11001102      sprintf(tmp,"%s/",tmpm1->value);
    1101   }
     1103    tmpm1=getMapFromMaps(m,"main","TmpPath");
     1104    sprintf(stored_path,"%s/%s_%i.xml",tmpm1->value,service,pid);
     1105  }
     1106
     1107 
    11021108
    11031109  xmlNewProp(n,BAD_CAST "serviceInstance",BAD_CAST tmp);
    1104   if(status!=SERVICE_SUCCEEDED && status!=SERVICE_FAILED){
     1110  map* test=getMap(request,"storeExecuteResponse");
     1111  bool hasStoredExecuteResponse=false;
     1112  if(test!=NULL && strcasecmp(test->value,"true")==0){
    11051113    xmlNewProp(n,BAD_CAST "statusLocation",BAD_CAST url);
     1114    hasStoredExecuteResponse=true;
    11061115  }
    11071116
     
    12361245#endif
    12371246  xmlDocSetRootElement(doc, n);
     1247  if(hasStoredExecuteResponse){
     1248    /* We need to write the ExecuteResponse Document somewhere */
     1249    FILE* output=fopen(stored_path,"w");
     1250    xmlChar *xmlbuff;
     1251    int buffersize;
     1252    xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "UTF-8", 1);
     1253    fwrite(xmlbuff,1,strlen(xmlbuff)*sizeof(char),output);
     1254    xmlFree(xmlbuff);
     1255    fclose(output);
     1256  }
    12381257  printDocument(m,doc,pid);
    12391258
  • trunk/zoo-kernel/zoo_service_loader.c

    r69 r72  
    17001700   */
    17011701  r_inputs=NULL;
     1702  map* store=getMap(request_inputs,"storeExecuteResponse");
     1703  map* status=getMap(request_inputs,"status");
     1704  /**
     1705   * 05-007r7 WPS 1.0.0 page 57 :
     1706   * 'If status="true" and storeExecuteResponse is "false" then the service
     1707   * shall raise an exception.'
     1708   */
     1709  if(status!=NULL && strcmp(status->value,"true")==0 &&
     1710     store!=NULL && strcmp(store->value,"false")==0){
     1711    errorException(m, _("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."), "InvalidParameterValue");
     1712    freeService(&s1);
     1713    free(s1);
     1714    freeMaps(&m);
     1715    free(m);
     1716   
     1717    freeMaps(&request_input_real_format);
     1718    free(request_input_real_format);
     1719   
     1720    freeMaps(&request_output_real_format);
     1721    free(request_output_real_format);
     1722   
     1723    free(REQUEST);
     1724    free(SERVICE_URL);
     1725    return 1;
     1726  }
    17021727  r_inputs=getMap(request_inputs,"storeExecuteResponse");
    17031728  int eres=SERVICE_STARTED;
     
    17191744#endif
    17201745
    1721   if(r_inputs!=NULL)
    1722     if(strcasecmp(r_inputs->value,"false")==0)
    1723       r_inputs=NULL;
    1724   if(r_inputs==NULLMAP){
     1746  if(status!=NULL)
     1747    if(strcasecmp(status->value,"false")==0)
     1748      status=NULL;
     1749  if(status==NULLMAP){
    17251750    loadServiceAndRun(&m,s1,request_inputs,&request_input_real_format,&request_output_real_format,&eres);
    17261751  }
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