Index: trunk/zoo-services/ogr/base-vect-ops/Makefile
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops/Makefile	(revision 24)
+++ trunk/zoo-services/ogr/base-vect-ops/Makefile	(revision 26)
@@ -1,7 +1,9 @@
-CFLAGS=-I../../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags`  `gdal-config --cflags`   -DLINUX_FREE_ISSUE #-DDEBUG
-CC=gcc
+CFLAGS=-I../../../zoo-kernel/ -I./ `xsl-config --cflags`  `gdal-config --cflags`  -DLINUX_FREE_ISSUE #-DDEBUG
+# if JS_ENABLED flag is set to true in your ZOO-Kernel Makefile then you'll have
+# uncomment the following line
+# JS_LDFLAGS=../../../zoo-kernel/ulinet.o ../../../zoo-kernel/service_internal_js.o
 
-cgi-env/service.zo: service.c
-	g++ ${CFLAGS} -shared -fpic -o cgi-env/ogr_service.zo ./service.c ../../../zoo-kernel/service_internal.o `gdal-config --libs`
+cgi-env/ogr_service.zo: service.c
+	g++ ${CFLAGS} -shared -fpic -o cgi-env/ogr_service.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} `xsl-config --libs` `gdal-config --libs` `geos-config --libs`
 
 clean:
Index: trunk/zoo-services/ogr/base-vect-ops/service.c
===================================================================
--- trunk/zoo-services/ogr/base-vect-ops/service.c	(revision 24)
+++ trunk/zoo-services/ogr/base-vect-ops/service.c	(revision 26)
@@ -74,5 +74,4 @@
     char *tmp=(char*)calloc((xmlStrlen(xmlStrstr(xmlbuff,BAD_CAST "?>"))-1),sizeof(char));
     sprintf(tmp,"%s",xmlStrstr(xmlbuff,BAD_CAST "?>")+2);
-    //strdup(strstr((char*)xmlbuff,"?>")+2);
     xmlXPathFreeObject(xpathObj);
     xmlXPathFreeContext(xpathCtx);
@@ -87,11 +86,9 @@
     free(tmp);
     if(res==NULL){
-      map* tmp=createMap("text","Unable to call OGR_G_CreatFromGML");
-      addToMap(tmp,"code","NoApplicableCode");
-      printExceptionReportResponse(conf,tmp);
-      exit(0);
+      setMapInMaps(conf,"lenv","message","Unable to call OGR_G_CreatFromGML");
+      return NULL;
     }
     else
-      return res;//OGR_G_CreateFromGML(tmp);
+      return res;
   }
 
@@ -108,36 +105,52 @@
     fprintf(stderr,"Tolerance for Simplify %f",tolerance);
     map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
-    if(!tmp)
-      return SERVICE_FAILED;
-    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeTime");
+    if(!tmp){
+      setMapInMaps(conf,"lenv","message","Unagle to parse the input geometry from InputPolygon");
+      return SERVICE_FAILED;
+    }
+    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
     if(tmp1!=NULL){
       if(strncmp(tmp1->value,"text/js",7)==0 ||
-	 strncmp(tmp1->value,"application/json",7)==0)
+	 strncmp(tmp1->value,"application/json",16)==0)
         geometry=OGR_G_CreateGeometryFromJson(tmp->value);
       else
         geometry=createGeometryFromGML(conf,tmp->value);
     }
-    else
-      geometry=createGeometryFromGML(conf,tmp->value);
+    else{
+      setMapInMaps(conf,"lenv","message","Unable to find any geometry for InputPolygon");
+      return SERVICE_FAILED;
+    }
+    if(geometry==NULL){
+      setMapInMaps(conf,"lenv","message","Unagle to parse the input geometry from InputPolygon");
+      return SERVICE_FAILED;
+    }
+    fprintf(stderr,"Create GEOSGeometry object");
     GEOSGeometry* ggeometry=((OGRGeometry *) geometry)->exportToGEOS();
     GEOSGeometry* gres=GEOSTopologyPreserveSimplify(ggeometry,tolerance);
     res=OGRGeometryFactory::createFromGEOS(gres);
+    tmp1=getMapFromMaps(outputs,"Result","mimeType");
     if(tmp1!=NULL){
       if(strncmp(tmp1->value,"text/js",7)==0 ||
 	 strncmp(tmp1->value,"application/json",16)==0){
-        outputs->content=createMap("value",OGR_G_ExportToJson(tmp->value));
-	addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
-	addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
+	char *tmpS=OGR_G_ExportToJson(res);
+	setMapInMaps(outputs,"Result","value",tmpS);
+	setMapInMaps(outputs,"Result","mimeType","text/plain");
+	setMapInMaps(outputs,"Result","encoding","UTF-8");
+	free(tmpS);
       }
       else{
-        outputs->content=createMap("value",OGR_G_ExportToGML(res));
-	addMapToMap(&outputs->content,createMap("mimeType","text/xml"));
-	addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
-	addMapToMap(&outputs->content,createMap("schema","http://fooa/gml/3.1.0/polygon.xsd"));
+	char *tmpS=OGR_G_ExportToGML(res);
+	setMapInMaps(outputs,"Result","value",tmpS);
+	setMapInMaps(outputs,"Result","mimeType","text/xml");
+	setMapInMaps(outputs,"Result","encoding","UTF-8");
+	setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
+	free(tmpS);
       }
     }else{
-      outputs->content=createMap("value",OGR_G_ExportToJson(res));
-      addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
-      addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
+      char *tmpS=OGR_G_ExportToJson(tmp->value);
+      setMapInMaps(outputs,"Result","value",tmpS);
+      setMapInMaps(outputs,"Result","mimeType","text/plain");
+      setMapInMaps(outputs,"Result","encoding","UTF-8");
+      free(tmpS);
     }
     outputs->next=NULL;
@@ -178,4 +191,6 @@
     else
       geometry=createGeometryFromGML(conf,tmp->value);
+    if(geometry==NULL)
+      return SERVICE_FAILED;
     res=(*myFunc)(geometry);
     fprintf(stderr,"Service internal print \n");
@@ -189,21 +204,24 @@
       if(strncmp(tmp_2->value,"text/js",7)==0 ||
 	 strncmp(tmp_2->value,"application/json",16)==0){
-	char *tres=OGR_G_ExportToJson(res);
-        addToMap(outputs->content,"value",tres);
-	free(tres);
-	addToMap(outputs->content,"mimeType","text/plain");
-	addToMap(outputs->content,"encoding","UTF-8");
+	char *tmpS=OGR_G_ExportToJson(res);
+	setMapInMaps(outputs,"Result","value",tmpS);
+	setMapInMaps(outputs,"Result","mimeType","text/plain");
+	setMapInMaps(outputs,"Result","encoding","UTF-8");
+	free(tmpS);
       }
       else{
-	char *tres=OGR_G_ExportToGML(res);
-        addToMap(outputs->content,"value",tres);
-	free(tres);
+	char *tmpS=OGR_G_ExportToGML(res);
+	setMapInMaps(outputs,"Result","value",tmpS);
+	setMapInMaps(outputs,"Result","mimeType","text/plain");
+	setMapInMaps(outputs,"Result","encoding","UTF-8");
+	free(tmpS);
+
       }
     }else{
-      char *tres=OGR_G_ExportToJson(res);
-      addToMap(outputs->content,"value",tres);
-      free(tres);
-      addToMap(outputs->content,"mimeType","text/plain");
-      addToMap(outputs->content,"encoding","UTF-8");
+      char *tmpS=OGR_G_ExportToJson(res);
+      setMapInMaps(outputs,"Result","value",tmpS);
+      setMapInMaps(outputs,"Result","mimeType","text/plain");
+      setMapInMaps(outputs,"Result","encoding","UTF-8");
+      free(tmpS);
     }
     outputs->next=NULL;
@@ -235,16 +253,30 @@
    else
      geometry=createGeometryFromGML(conf,tmp->value);
-   int bufferDistance=1;
+   if(geometry==NULL){
+     setMapInMaps(conf,"lenv","message","Unable to parse input geometry");
+     return SERVICE_FAILED;
+   }
+   double bufferDistance;
    tmp=getMapFromMaps(inputs,"BufferDistance","value");
-   if(tmp!=NULL)
-		bufferDistance=atoi(tmp->value);
+   if(tmp==NULL){
+     bufferDistance=atof("10.0");
+   }
+   else
+     bufferDistance=atof(tmp->value);
    res=OGR_G_Buffer(geometry,bufferDistance,30);
    tmp1=getMapFromMaps(outputs,"Result","mimeType");
    if(strncmp(tmp1->value,"application/json",16)==0){
-		addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
-		addToMap(outputs->content,"mimeType","text/plain");
+     char *tmpS=OGR_G_ExportToJson(res);
+     setMapInMaps(outputs,"Result","value",tmpS);
+     setMapInMaps(outputs,"Result","mimeType","text/plain");
+     setMapInMaps(outputs,"Result","encoding","UTF-8");
+     free(tmpS);
    }
    else{
-		addToMap(outputs->content,"value",OGR_G_ExportToGML(res));
+     char *tmpS=OGR_G_ExportToGML(res);
+     setMapInMaps(outputs,"Result","value",tmpS);
+     setMapInMaps(outputs,"Result","mimeType","text/xml");
+     setMapInMaps(outputs,"Result","encoding","UTF-8");
+     setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
    }
    outputs->next=NULL;
@@ -254,101 +286,4 @@
 }
 
-/*  int Buffer(maps*& conf,maps*& inputs,maps*& outputs){
-#ifdef DEBUG
-    fprintf(stderr,"\nService internal print\n");
-#endif
-    maps* cursor=inputs;
-    OGRGeometryH geometry,res;
-    int bufferDistance;    
-    if(cursor!=NULL){
-#ifdef DEBUG
-      fprintf(stderr,"\nService internal print\n");
-      dumpMaps(cursor);
-      fprintf(stderr,"\nService internal print\n");
-      dumpMaps(inputs);
-      fprintf(stderr,"\nService internal print\n");
-#endif
-      map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
-      map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
-      if(tmp1!=NULL){
-        if(strncmp(tmp1->value,"application/json",16)==0 ||
-	   strncmp(tmp1->value,"text/js",7)==0)
-      	  geometry=OGR_G_CreateGeometryFromJson(tmp->value);
-	else
-	  geometry=createGeometryFromGML(conf,tmp->value);
-      }
-      else
-      	geometry=createGeometryFromGML(conf,tmp->value);
-    }
-    if(cursor!=NULL){
-      map* tmp=getMapFromMaps(cursor,"BufferDistance","value");
-      if(tmp==NULL){
-	bufferDistance=10;
-      }
-      else
-	bufferDistance=atoi(tmp->value);
-#ifdef DEBUG
-      fprintf(stderr,"\nService internal print (BufferDistance value: %i)\n",bufferDistance);
-#endif
-    }
-#ifdef DEBUG
-    dumpMaps(outputs);
-#endif
-    map* tmp=getMapFromMaps(outputs,"Result","mimeType");
-    res=OGR_G_Buffer(geometry,bufferDistance,30);
-#ifdef DEBUG
-    dumpMap(tmp);
-#endif
-    if(tmp!=NULL){
-#ifdef DEBUG
-      dumpMap(tmp);
-#endif
-      if(strncmp(tmp->value,"application/json",16)==0){
-	addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
-	addToMap(outputs->content,"mimeType","text/plain");
-	addToMap(outputs->content,"encoding","UTF-8");
-      }
-      else if(strcmp(tmp->value,"text/xml")==0){
-	xmlInitParser();
-	xmlDocPtr doc = xmlParseMemory(tmp->value,strlen(tmp->value));
-	xmlChar *xmlbuff;
-	int buffersize;
-	char *buff=OGR_G_ExportToGML(res);
-	addToMap(outputs->content,"value",buff);
-	map* tmp1=getMapFromMaps(outputs,"Result","encoding");
-	if(tmp1!=NULL)
-	  addToMap(outputs->content,"encoding",tmp1->value);
-	else
-	  addToMap(outputs->content,"encoding","UTF-8");
-	xmlDocDumpFormatMemory(doc, &xmlbuff, &buffersize, 1);
-	xmlFree(xmlbuff);
-	xmlFreeDoc(doc);
-	xmlCleanupParser();
-      }
-      else{
-	addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
-	addToMap(outputs->content,"mimeType","text/plain");
-	addToMap(outputs->content,"encoding","UTF-8");
-	outputs->next=NULL;
-      }
-      outputs->next=NULL;
-    }
-    else{
-      addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
-      addToMap(outputs->content,"mimeType","text/plain");
-      addToMap(outputs->content,"encoding","UTF-8");
-      outputs->next=NULL;
-    }
-    outputs->next=NULL;
-#ifdef DEBUG
-    dumpMaps(outputs);
-    fprintf(stderr,"\nService internal print\n===\n");
-#endif
-    OGR_G_DestroyGeometry(geometry);
-    OGR_G_DestroyGeometry(res);
-    return SERVICE_SUCCEEDED;
-  }
-*/
-
 #ifdef WIN32
   __declspec(dllexport)
@@ -387,6 +322,9 @@
 #ifdef DEBUG
     fprintf(stderr,"\nService internal print1\n");
-#endif
     fflush(stderr);
+#endif
+    fprintf(stderr,"\nService internal print1\n");
+    dumpMaps(inputs);
+    fprintf(stderr,"\nService internal print1\n");
 
     maps* cursor=inputs;
@@ -405,26 +343,47 @@
       	geometry1=createGeometryFromGML(conf,tmp->value);
     }
+    if(geometry1==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity1.");
+      fprintf(stderr,"SERVICE FAILED !\n");
+      return SERVICE_FAILED;
+    }
+    fprintf(stderr,"\nService internal print1 InputEntity1\n");
     {
       map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
       map* tmp1=getMapFromMaps(inputs,"InputEntity2","mimeType");
-#ifdef DEBUG
+      //#ifdef DEBUG
+      fprintf(stderr,"MY MAP \n[%s] - %i\n",tmp1->value,strncmp(tmp1->value,"application/json",16));
+      //dumpMap(tmp);
       fprintf(stderr,"MY MAP\n");
-      dumpMap(tmp1);
-      fprintf(stderr,"MY MAP\n");
-#endif
+      ///#endif
+      fprintf(stderr,"\nService internal print1 InputEntity2\n");
       if(tmp1!=NULL){
-        if(strncmp(tmp1->value,"application/json",16)==0)
+        if(strncmp(tmp1->value,"application/json",16)==0){
+	  fprintf(stderr,"\nService internal print1 InputEntity2 as JSON\n");
       	  geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
-	else
+	}
+	else{
+	  fprintf(stderr,"\nService internal print1 InputEntity2 as GML\n");
 	  geometry2=createGeometryFromGML(conf,tmp->value);
+	}
       }
       else
       	geometry2=createGeometryFromGML(conf,tmp->value);
-    }
+      fprintf(stderr,"\nService internal print1 InputEntity2 PreFinal\n");
+    }
+    fprintf(stderr,"\nService internal print1 InputEntity2 Final\n");
+    if(geometry2==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity2.");
+      fprintf(stderr,"SERVICE FAILED !\n");
+      return SERVICE_FAILED;
+    }
+    fprintf(stderr,"\nService internal print1\n");
     res=(*myFunc)(geometry1,geometry2);
-    addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
-    addToMap(outputs->content,"mimeType","text/plain");
-    addToMap(outputs->content,"encoding","UTF-8");
-    outputs->next=NULL;
+    fprintf(stderr,"\nService internal print1\n");
+    char *tmpS=OGR_G_ExportToJson(res);
+    setMapInMaps(outputs,"Result","value",tmpS);
+    setMapInMaps(outputs,"Result","mimeType","text/plain");
+    setMapInMaps(outputs,"Result","encoding","UTF-8");
+    free(tmpS);
     OGR_G_DestroyGeometry(geometry1);
     OGR_G_DestroyGeometry(geometry2);
@@ -469,5 +428,4 @@
 #endif
     fflush(stderr);
-
     maps* cursor=inputs;
     OGRGeometryH geometry1,geometry2;
@@ -491,4 +449,9 @@
       	geometry1=createGeometryFromGML(conf,tmp->value);
     }
+    if(geometry1==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity1.");
+      fprintf(stderr,"SERVICE FAILED !\n");
+      return SERVICE_FAILED;
+    }
     {
       map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
@@ -509,12 +472,14 @@
       	geometry2=createGeometryFromGML(conf,tmp->value);
     }
-    res=OGR_G_Distance(geometry1,geometry2);
-    outputs=(maps*)malloc(sizeof(maps*));
-    outputs->name="Distance";
+    if(geometry2==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to parse input geometry for InputEntity2.");
+      fprintf(stderr,"SERVICE FAILED !\n");
+      return SERVICE_FAILED;
+    }
+    res=OGR_G_Distance(geometry1,geometry2);    
     char tmpres[100];
     sprintf(tmpres,"%d",res);
-    outputs->content=createMap("value",tmpres);
-    addMapToMap(&outputs->content,createMap("datatype","float"));
-    outputs->next=NULL;
+    setMapInMaps(outputs,"Distance","value",tmpres);
+    setMapInMaps(outputs,"Distance","dataType","float");
 #ifdef DEBUG
     dumpMaps(outputs);
@@ -531,23 +496,28 @@
     double res;
     /**
-     * Extract Geometry from the InputEntity1 value
+     * Extract Geometry from the InputPolygon value
      */
-    OGRGeometryH geometry1;
-    map* tmp=getMapFromMaps(inputs,"InputEntity1","value");
+    OGRGeometryH geometry;
+    map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
+    if(tmp==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to parse input geometry from InputPolygon");
+      return SERVICE_FAILED;
+    }
     fprintf(stderr,"geometry creation %s \n",tmp->value);
-    geometry1=createGeometryFromGML(conf,tmp->value);
+    geometry=createGeometryFromGML(conf,tmp->value);
+    if(geometry==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to parse input geometry from InputPolygon");
+      return SERVICE_FAILED;
+    }
     fprintf(stderr,"geometry created %s \n",tmp->value);
-    res=OGR_G_GetArea(geometry1);
+    res=OGR_G_GetArea(geometry);
     fprintf(stderr,"area %d \n",res);
     /**
-     * Creating the outputs
+     * Filling the outputs
      */
-    outputs=(maps*)malloc(sizeof(maps*));
-    outputs->name="Area";
     char tmp1[100];
     sprintf(tmp1,"%d",res);
-    outputs->content=createMap("value",tmp1);
-    addMapToMap(&outputs->content,createMap("datatype","float"));
-    outputs->next=NULL;
+    setMapInMaps(outputs,"Area","value",tmp1);
+    setMapInMaps(outputs,"Area","dataType","float");
 #ifdef DEBUG
     dumpMaps(outputs);
Index: trunk/zoo-services/utils/status/Makefile
===================================================================
--- trunk/zoo-services/utils/status/Makefile	(revision 26)
+++ trunk/zoo-services/utils/status/Makefile	(revision 26)
@@ -0,0 +1,10 @@
+CFLAGS=-I../../../zoo-kernel/ -I./ `xslt-config --cflags` `xml2-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
+# if JS_ENABLED flag is set to true in your ZOO-Kernel Makefile then you'll have
+# uncomment the following line
+# JS_LDFLAGS=../../../zoo-kernel/ulinet.o ../../../zoo-kernel/service_internal_js.o
+
+cgi-env/wps_status.zo: service.c
+	g++ ${CFLAGS} -shared -fpic -o cgi-env/wps_status.zo ./service.c ../../../zoo-kernel/service_internal.o ${JS_LDFLAGS} `xml2-config --libs` `xslt-config --libs`
+
+clean:
+	rm -f cgi-env/wps_status.zo
Index: trunk/zoo-services/utils/status/cgi-env/GetStatus.zcfg
===================================================================
--- trunk/zoo-services/utils/status/cgi-env/GetStatus.zcfg	(revision 26)
+++ trunk/zoo-services/utils/status/cgi-env/GetStatus.zcfg	(revision 26)
@@ -0,0 +1,44 @@
+[GetStatus]
+ Title = Produce an updated ExecuteResponse document. 
+ Abstract = Create an ExecuteResponse document from a sid (Service ID), it will use the niternal ZOO Kernel mechanisms to access the current status from a running Service and update the percentCompleted from the original backup file used by the ZOO Kernel when running a Service in background. 
+ processVersion = 1
+ storeSupported = true
+ statusSupported = true
+ serviceProvider = wps_status.zo
+ serviceType = C
+ <MetaData lang="en">
+   title = Demo GetStatus request
+ </MetaData>
+ <DataInputs>
+  [sid]
+   Title = Service ID
+   Abstract = The ZOO Service ID of the ZOO Service we want to get the current status.
+   minOccurs = 1
+   maxOccurs = 1
+   <LiteralData>
+    DataType = integer
+    <Default>
+     uom = meters
+    </Default>
+    <Supported>
+     uom = feet
+    </Supported>
+   </LiteralData>
+ </DataInputs>
+ <DataOutputs>
+  [Result]
+   Title = ExecuteResponse document
+   Abstract = The resulting ExecuteResponse document.
+   <MetaData lang="en">
+    title = Demo XSL use case
+   </MetaData>   
+   <LiteralData>
+    DataType = string
+    <Default>
+     uom = meters
+    </Default>
+    <Supported>
+     uom = feet
+    </Supported>
+   </LiteralData>
+ </DataOutputs>  
Index: trunk/zoo-services/utils/status/cgi-env/longProcess.zcfg
===================================================================
--- trunk/zoo-services/utils/status/cgi-env/longProcess.zcfg	(revision 26)
+++ trunk/zoo-services/utils/status/cgi-env/longProcess.zcfg	(revision 26)
@@ -0,0 +1,44 @@
+[longProcess]
+ Title = Demo long process. 
+ Abstract = This service doesn't do anything except taking its time, it demonstrates how to use the updateStatus function from your ZOO Service. 
+ processVersion = 1
+ storeSupported = true
+ statusSupported = true
+ serviceProvider = wps_status.zo
+ serviceType = C
+ <MetaData lang="en">
+   title = Demo GetStatus request
+ </MetaData>
+ <DataInputs>
+  [sid]
+   Title = Service ID
+   Abstract = A ZOO Service ID (unused).
+   minOccurs = 0
+   maxOccurs = 1
+   <LiteralData>
+    dataType = integer
+    <Default>
+     uom = meters
+    </Default>
+    <Supported>
+     uom = feet
+    </Supported>
+   </LiteralData>
+ </DataInputs>
+ <DataOutputs>
+  [Result]
+   Title = ExecuteResponse document
+   Abstract = The resulting ExecuteResponse document.
+   <MetaData lang="en">
+    title = Demo XSL use case
+   </MetaData>   
+   <LiteralData>
+    dataType = string
+    <Default>
+     uom = meters
+    </Default>
+    <Supported>
+     uom = feet
+    </Supported>
+   </LiteralData>
+ </DataOutputs>  
Index: trunk/zoo-services/utils/status/service.c
===================================================================
--- trunk/zoo-services/utils/status/service.c	(revision 26)
+++ trunk/zoo-services/utils/status/service.c	(revision 26)
@@ -0,0 +1,132 @@
+/**
+ * Author : Gérald FENOY
+ *
+ * Copyright 2008-2009 GeoLabs SARL. All rights reserved.
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+ * THE SOFTWARE.
+ */
+#include "service.h"
+
+extern "C" {
+#include <libxml/tree.h>
+#include <libxml/parser.h>
+#include <libxml/xpath.h>
+#include <libxml/xpathInternals.h>
+
+#include <libxslt/xslt.h>
+#include <libxslt/xsltInternals.h>
+#include <libxslt/transform.h>
+#include <libxslt/xsltutils.h>
+
+#include <dirent.h>
+#include "service_internal.h"
+
+  /**
+   * GetStatus ZOO Service :
+   * This service is used in the ZOO-Project to get information about Services
+   * running as background tasks. The service will first get the XML document 
+   * cached by the ZOO-Kernel before calling effectively the Service, then 
+   * will access the shared memory space created by the Kernel to extract the 
+   * current status of the running Service. Using a simple XSL file it will 
+   * finally produce the final ExecuteResponse including the updated 
+   * percentCompleted attribute of the ProcessStarted node of the cached
+   * document if any (so if the Service is currently running) else it will 
+   * return the final ExecuteResponse stored on the Server file system.
+   */
+#ifdef WIN32
+  __declspec(dllexport)
+#endif
+  int GetStatus(maps*& conf,maps*& inputs,maps*& outputs){
+    const char *params[2 + 1];
+    int xmlLoadExtDtdDefaultValue;
+    map* tmpMap=NULL,*tmpMmap=NULL, *tmpTmap=NULL;
+    tmpMap=getMapFromMaps(inputs,"sid","value");
+    tmpTmap=getMapFromMaps(conf,"main","tmpPath");
+    tmpMmap=getMapFromMaps(conf,"main","dataPath");
+    xmlInitParser();
+    struct dirent *dp;
+    DIR *dirp = opendir(tmpTmap->value);
+    char fileName[1024],xslFileName[1024];
+    if(dirp!=NULL){
+      char tmp[128];
+      sprintf(tmp,"_%s.xml",tmpMap->value);
+      while ((dp = readdir(dirp)) != NULL)
+	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.");
+      return SERVICE_FAILED;
+    }
+    sprintf(xslFileName,"%s/updateStatus.xsl",tmpMmap->value);
+    xmlSubstituteEntitiesDefault(1);
+    xmlLoadExtDtdDefaultValue = 0;
+    xsltStylesheetPtr cur = NULL;
+    xmlDocPtr doc, res;
+    cur = xsltParseStylesheetFile(BAD_CAST xslFileName);
+    doc = xmlParseFile(fileName);
+    if(cur!=NULL && doc!=NULL){
+      params[0]="value";
+      params[1]=getStatus(atoi(tmpMap->value));
+      params[2]=NULL;
+      res = xsltApplyStylesheet(cur, doc, params);
+      xmlChar *xmlbuff;
+      int buffersize;
+      xmlDocDumpFormatMemory(res, &xmlbuff, &buffersize, 1);
+      setMapInMaps(outputs,"Result","value",(char*)xmlbuff);
+      setMapInMaps(outputs,"Result","mimeType","text/xml");
+      setMapInMaps(outputs,"Result","encoding","UTF-8");
+      xmlFree(xmlbuff);
+    }
+    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);
+      setMapInMaps(conf,"lenv","message",tmp);
+      return SERVICE_FAILED;
+    }
+    return SERVICE_SUCCEEDED;
+  }
+
+
+  /**
+   * longProcess ZOO Service :
+   * Simple Service which just loop over 100 times then return a welcome message
+   * string, at each step the service will sleep for one second.
+   */
+#ifdef WIN32
+  __declspec(dllexport)
+#endif
+  int longProcess(maps*& conf,maps*& inputs,maps*& outputs){
+    int i=0;
+    while(i<100){
+      char tmp[4];
+      sprintf(tmp,"%i",i);
+      map* tmpMap=NULL;
+      tmpMap=getMapFromMaps(conf,"lenv","sid");
+      if(tmpMap!=NULL)
+	fprintf(stderr,"Status %s %s\n",tmpMap->value,tmp);
+      setMapInMaps(conf,"lenv","status",tmp);
+      updateStatus(conf);
+      sleep(1);
+      i+=5;
+    }
+    setMapInMaps(outputs,"Result","value","\"Running long process successfully\"");
+    return SERVICE_SUCCEEDED;
+  }
+
+}
