Index: /trunk/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-kernel/service_internal.c	(revision 31)
+++ /trunk/zoo-kernel/service_internal.c	(revision 32)
@@ -80,5 +80,4 @@
   }
   conf=mapsFromJSObject(cx,argv[0]);
-  dumpMaps(conf);
   if(JS_ValueToInt32(cx,argv[1],&istatus)==JS_TRUE){
     char tmpStatus[4];
@@ -350,5 +349,4 @@
   else{
     fprintf(stderr,"TMP4 NOT FOUND !!");
-    //dumpMaps(tmp4);
     return NULL;
   }
@@ -439,5 +437,4 @@
   else{
     fprintf(stderr,"TMP4 NOT FOUND !!");
-    //dumpMaps(tmp4);
   }
   xmlAddChild(nc4,nc5);
@@ -964,5 +961,4 @@
   maps* tmp_maps=getMaps(m,"main");
   if(tmp_maps!=NULL){
-    dumpMaps(getMaps(m,"lenv"));
     map* tmpm1=getMap(tmp_maps->content,"serverAddress");
     /**
@@ -1285,4 +1281,8 @@
     while(tmp!=NULL){
       if(strncasecmp(tmp->name,"value",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"extension",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"asReference",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"status",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"storeExecuteResponse",strlen(tmp->name))!=0 &&
 	 strncasecmp(tmp->name,"extension",strlen(tmp->name))!=0)
 	xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value);
@@ -1306,5 +1306,6 @@
     }
     else if(tmp!=NULL){
-      if(strcmp(tmp->value,"text/js")==0)
+      if(strncmp(tmp->value,"text/js",4)==0 ||
+	 strncmp(tmp->value,"application/js",14)==0)
 	xmlAddChild(nc3,xmlNewCDataBlock(doc,BAD_CAST toto->value,strlen(toto->value)));
       else
@@ -1394,6 +1395,13 @@
   maps* tmpMap=getMaps(m,"main");
   char *encoding=getEncoding(tmpMap);
-  map *tmpSid=getMapFromMaps(m,"lenv","sid");
-  if(tmpSid==NULL)
+  if(m!=NULL){
+    map *tmpSid=getMapFromMaps(m,"lenv","sid");
+    if(tmpSid!=NULL){
+      if( getpid()==atoi(tmpSid->value) )
+	printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
+    }
+    else
+      printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
+  }else
     printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
 
@@ -1534,4 +1542,13 @@
        * We get the first output only !!
        */
+      toto=getMap(request_outputs->content,"value");
+      if(toto==NULL){
+	map * errormap = createMap("text","Unable to fetch any result");
+	addToMap(errormap,"code", "InternalError");
+	fprintf(stderr,"DISPLAY ERROR MESSAGE !!!\n");
+	printExceptionReportResponse(m,errormap);
+	freeMap(&errormap);
+	free(errormap);
+      }
       char mime[1024];
       map* mi=getMap(request_outputs->content,"mimeType");
@@ -1554,5 +1571,4 @@
 	  sprintf(mime,"Content-Type: text/plain; charset=utf-8\r\nStatus: 200 OK\r\n\r\n");
       printf("%s",mime);
-      toto=getMap(request_outputs->content,"value");
       if(mi!=NULL && strncmp(mi->value,"image",5)==0){
 	map* rs=getMapFromMaps(request_outputs,request_outputs->name,"size");
@@ -1575,5 +1591,5 @@
       errormap = createMap("text",tmp);      
       addToMap(errormap,"code", "InternalError");
-      printf("Content-Type: text/xml; charset=utf-8\r\nStatus: 200 OK\r\n\r\n");
+      fprintf(stderr,"DISPLAY ERROR MSG !!!!\n");
       printExceptionReportResponse(m,errormap);
       freeMap(&errormap);
Index: /trunk/zoo-kernel/zoo_loader.c
===================================================================
--- /trunk/zoo-kernel/zoo_loader.c	(revision 31)
+++ /trunk/zoo-kernel/zoo_loader.c	(revision 32)
@@ -54,5 +54,5 @@
 int errorException(maps *m, const char *message, const char *errorcode) 
 {
-  map * errormap = createMap("text", message);
+  map* errormap = createMap("text", message);
   addToMap(errormap,"code", errorcode);
   printExceptionReportResponse(m,errormap);
Index: /trunk/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-kernel/zoo_service_loader.c	(revision 31)
+++ /trunk/zoo-kernel/zoo_service_loader.c	(revision 32)
@@ -44,9 +44,5 @@
 #include "service.h"
 #include "service_internal.h"
-
-
-#ifdef USE_PYTHON
 #include "service_internal_python.h"
-#endif
 
 #ifdef USE_JAVA
@@ -182,6 +178,4 @@
     freeMaps(&m);
     free(m);
-    freeMap(&request_inputs);
-    free(request_inputs);
     return 1;
   }
@@ -194,6 +188,4 @@
       freeMaps(&m);
       free(m);
-      freeMap(&request_inputs);
-      free(request_inputs);
       free(REQUEST);
       return 1;
@@ -418,4 +410,8 @@
   s1=(service*)calloc(1,SERVICE_SIZE);
   if(s1 == NULL){
+    freeMaps(&m);
+    free(m);
+    free(REQUEST);
+    free(SERVICE_URL);
     return errorException(m, "Unable to allocate memory.","InternalError");
   }
@@ -437,9 +433,17 @@
   fflush(stdout);
   dup2(saved_stdout,fileno(stdout));
-  if(t==22){
-    errorException(m, "The value for <indetifier> seems to be wrong. Please, ensure that the process exsits using the GetCapabilities request.", "InvalidParameterValue");
-    exit(0);
+  if(t<0){
+    char tmpMsg[2048+strlen(r_inputs->value)];
+    sprintf(tmpMsg,"The value for <indetifier> seems to be wrong (%s). Please, ensure that the process exist using the GetCapabilities request.",r_inputs->value);
+    errorException(m, tmpMsg, "InvalidParameterValue");
+    freeService(&s1);
+    free(s1);
+    freeMaps(&m);
+    free(m);
+    free(REQUEST);
+    free(SERVICE_URL);
+    return 0;
   }
-  //s[0]=s1;
+  close(saved_stdout);
 
 #ifdef DEBUG
@@ -483,11 +487,11 @@
     if(r_inputs==NULL) r_inputs=getMap(request_inputs,"RawDataOutput");
     
-    //#ifdef DEBUG
+#ifdef DEBUG
     fprintf(stderr,"OUTPUT Parsing ... \n");
-    //#endif
+#endif
     if(r_inputs!=NULL){
-      //#ifdef DEBUG
+#ifdef DEBUG
       fprintf(stderr,"OUTPUT Parsing start now ... \n");
-      //#endif
+#endif
       char current_output_as_string[10240];
       char cursor_output[10240];
@@ -765,7 +769,9 @@
 #endif
 	xmlNodePtr cur2=cur->children;
-	while(cur2){
-	  while(cur2->type!=XML_ELEMENT_NODE)
+	while(cur2!=NULL){
+	  while(cur2!=NULL && cur2->type!=XML_ELEMENT_NODE)
 	    cur2=cur2->next;
+	  if(cur2==NULL)
+	    break;
 	  /**
 	   * Indentifier
@@ -1024,8 +1030,9 @@
 #endif
 	    xmlNodePtr cur4=cur2->children;
-	    while(cur4){
-	      while(cur4->type!=XML_ELEMENT_NODE)
+	    while(cur4!=NULL){
+	      while(cur4!=NULL &&cur4->type!=XML_ELEMENT_NODE)
 		cur4=cur4->next;
-
+	      if(cur4==NULL)
+		break;
 	      if(xmlStrcasecmp(cur4->name, BAD_CAST "LiteralData")==0){
 		/**
@@ -1103,6 +1110,7 @@
 	dumpMaps(request_input_real_format);
 #endif
-	tmpmaps=tmpmaps->next;
-	      
+	freeMaps(&tmpmaps);
+	free(tmpmaps);
+	tmpmaps=NULL;	      
       }
 #ifdef DEBUG
@@ -1427,4 +1435,16 @@
   int eres=SERVICE_STARTED;
   int cpid=getpid();
+  
+  maps *_tmpMaps=(maps*)malloc(MAPS_SIZE);
+  _tmpMaps->name=strdup("lenv");
+  char tmpBuff[100];
+  sprintf(tmpBuff,"%i",cpid);
+  _tmpMaps->content=createMap("sid",tmpBuff);
+  _tmpMaps->next=NULL;
+  addToMap(_tmpMaps->content,"status","0");
+  addMapsToMaps(&m,_tmpMaps);
+  freeMaps(&_tmpMaps);
+  free(_tmpMaps);
+
 #ifdef DEBUG
   dumpMap(request_inputs);
@@ -1588,10 +1608,8 @@
     }
     else{
-#ifdef USE_PYTHON
       if(strncasecmp(r_inputs->value,"PYTHON",6)==0){
 	eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format);
       }
       else
-#endif
 	
 #ifdef USE_JAVA
@@ -1660,9 +1678,8 @@
       r_inputs=getMapFromMaps(m,"main","tmpPath");
       map* r_inputs1=getMap(s1->content,"ServiceProvider");
-      char* fbkp=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+16)*sizeof(char));
+      char* fbkp=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+100)*sizeof(char));
       sprintf(fbkp,"%s/%s_%d.xml",r_inputs->value,r_inputs1->value,cpid);
-      char* flog=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+22)*sizeof(char));
+      char* flog=(char*)malloc((strlen(r_inputs->value)+strlen(r_inputs1->value)+100)*sizeof(char));
       sprintf(flog,"%s/%s_%d_error.log",r_inputs->value,r_inputs1->value,cpid);
-      fprintf(stderr,"File to use as backup %s\n",fbkp);
 #ifdef DEBUG
       fprintf(stderr,"RUN IN BACKGROUND MODE \n");
@@ -1675,4 +1692,6 @@
       free(fbkp);
       free(flog);
+      if(setsid()<0)
+	return errorException(m, "Unable to run the child process properly", "InternalError");
       /**
        * set status to SERVICE_STARTED and flush stdout to ensure full 
@@ -1681,6 +1700,7 @@
        * this way the data will be updated at the end of the process run.
        */
+      updateStatus(m);
       printProcessResponse(m,request_inputs,cpid,
-			    s1,r_inputs->value,SERVICE_STARTED,
+			    s1,r_inputs1->value,SERVICE_STARTED,
 			    request_input_real_format,
 			    request_output_real_format);
@@ -1810,11 +1830,8 @@
 	}
       } else{
-
-#ifdef USE_PYTHON
 	if(strncasecmp(r_inputs->value,"PYTHON",6)==0){
 	  eres=zoo_python_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format);
 	}
 	else
-#endif
 
 #ifdef USE_JAVA
@@ -1853,5 +1870,4 @@
       }
   
-      //res=execute(&m,&request_input_real_format,&request_output_real_format);
     } else {
       /**
@@ -1873,22 +1889,21 @@
 		   cpid,m,eres);
 
-  //if(getpid()==cpid){
+  if(((int)getpid())!=cpid){
+    fclose(stdout);
+    fclose(stderr);
+    unhandleStatus(m);
+  }
+
   freeService(&s1);
   free(s1);
   freeMaps(&m);
   free(m);
-  freeMaps(&tmpmaps);
-  free(tmpmaps);
   
   freeMaps(&request_input_real_format);
   free(request_input_real_format);
   
-  //freeMap(&request_inputs);
-  //free(request_inputs);
-    
   /* The following is requested but get issue using with Python support :/ */
   /* freeMaps(&request_output_real_format);
-     free(request_output_real_format);
-  */
+     free(request_output_real_format);*/
   
   free(REQUEST);
@@ -1899,5 +1914,4 @@
   fflush(stderr);
 #endif
-    //}
 
   return 0;
Index: /trunk/zoo-services/ogr/base-vect-ops/service.c
===================================================================
--- /trunk/zoo-services/ogr/base-vect-ops/service.c	(revision 31)
+++ /trunk/zoo-services/ogr/base-vect-ops/service.c	(revision 32)
@@ -246,6 +246,12 @@
    OGRGeometryH geometry,res;
    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
-   if(tmp==NULL)
+   if(tmp==NULL){
+     setMapInMaps(conf,"lenv","message","Unable to fetch input geometry");
      return SERVICE_FAILED;
+   }else
+     if(strlen(tmp->value)<=0){
+       setMapInMaps(conf,"lenv","message","Unable to fetch input geometry");
+       return SERVICE_FAILED;
+     }
    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
    if(strncmp(tmp1->value,"application/json",16)==0)
Index: /trunk/zoo-services/utils/status/cgi-env/updateStatus.xsl
===================================================================
--- /trunk/zoo-services/utils/status/cgi-env/updateStatus.xsl	(revision 32)
+++ /trunk/zoo-services/utils/status/cgi-env/updateStatus.xsl	(revision 32)
@@ -0,0 +1,22 @@
+<xsl:stylesheet version="1.0"
+                xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
+                xmlns:ows="http://www.opengis.net/ows/1.1"
+                xmlns:wps="http://www.opengis.net/wps/1.0.0"
+                xmlns:xlink="http://www.w3.org/1999/xlink">
+
+  <xsl:output method="xml"/>
+  <xsl:param name="value" select="string('-1')"/>
+
+  <xsl:template match="@*|node()">
+    <xsl:copy>
+      <xsl:apply-templates select="@*|node()"/>
+    </xsl:copy>
+  </xsl:template>
+
+  <xsl:template match="/wps:ExecuteResponse/wps:Status/wps:ProcessStarted/@percentCompleted">
+    <xsl:attribute name="percentCompleted">
+      <xsl:value-of select="$value"/>
+    </xsl:attribute>
+  </xsl:template>
+
+</xsl:stylesheet>
Index: /trunk/zoo-services/utils/status/service.c
===================================================================
--- /trunk/zoo-services/utils/status/service.c	(revision 31)
+++ /trunk/zoo-services/utils/status/service.c	(revision 32)
@@ -64,12 +64,23 @@
     DIR *dirp = opendir(tmpTmap->value);
     char fileName[1024],xslFileName[1024];
+    int hasFile=-1;
     if(dirp!=NULL){
       char tmp[128];
       sprintf(tmp,"_%s.xml",tmpMap->value);
       while ((dp = readdir(dirp)) != NULL)
-	if(strstr(dp->d_name,tmp)!=0)
+	if(strstr(dp->d_name,tmp)!=0){
 	  sprintf(fileName,"%s/%s",tmpTmap->value,dp->d_name);
-    }else{  
-      setMapInMaps(conf,"lenv","message","GetStatus was unable to use the tmpPath value set in main.cfg file.");
+	  hasFile=1;
+	}
+    }else{
+      char tmp[1024];
+      snprintf(tmp,1024,"GetStatus was unable to use the tmpPath value set in main.cfg file as directory %s.",tmpTmap->value);
+      setMapInMaps(conf,"lenv","message",tmp);
+      return SERVICE_FAILED;
+    }
+    if(hasFile<0){
+      char tmp[1024];
+      snprintf(tmp,1024,"GetStatus was unable to find any cache file for Service ID %s.",tmpMap->value);
+      setMapInMaps(conf,"lenv","message",tmp);
       return SERVICE_FAILED;
     }
@@ -94,7 +105,7 @@
       xmlFree(xmlbuff);
     }
-    else{   
+    else{
       char tmp[1024];
-      sprintf(tmp,"ZOO GetStatus Service was unable to find or parse the cache xml file available for the Service ID %s.",tmpMap->value);
+      sprintf(tmp,"ZOO GetStatus Service was unable to parse the cache xml file available for the Service ID %s.",tmpMap->value);
       setMapInMaps(conf,"lenv","message",tmp);
       return SERVICE_FAILED;
