Index: /trunk/zoo-api/js/ZOO-api.js
===================================================================
--- /trunk/zoo-api/js/ZOO-api.js	(revision 30)
+++ /trunk/zoo-api/js/ZOO-api.js	(revision 20)
@@ -74,10 +74,5 @@
 
     return Class;
-  },
-  UpdateStatus: function(env,value) {
-    return ZOOUpdateStatus(env,value);
   }
-};
-
 };
 
Index: /trunk/zoo-kernel/Makefile.in
===================================================================
--- /trunk/zoo-kernel/Makefile.in	(revision 30)
+++ /trunk/zoo-kernel/Makefile.in	(revision 20)
@@ -55,5 +55,5 @@
 
 service_internal.o: service_internal.c service.h
-	gcc ${JS_ENABLED} ${JSCFLAGS} ${XML2CFLAGS} ${CFLAGS} -c service_internal.c
+	g++ ${XML2CFLAGS} ${CFLAGS} -c service_internal.c
 
 service_internal_python.o: service_internal_python.c service.h
@@ -78,5 +78,5 @@
 
 zoo_service_loader.o: zoo_service_loader.c service.h
-	g++ -g -O2 -Wall ${XML2CFLAGS} ${CFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PERLCFLAGS} ${PHPCFLAGS} ${JS_ENABLED} ${PHP_ENABLED} ${PERL_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c  -fno-common -DPIC -o zoo_service_loader.o
+	g++ -g -O2 -Wall ${XML2CFLAGS} ${CFLAGS} ${PYTHONCFLAGS} ${JAVACFLAGS} ${JSCFLAGS} ${PHPCFLAGS} ${JS_ENABLED} ${PHP_ENABLED} ${JAVA_ENABLED} -c zoo_service_loader.c  -fno-common -DPIC -o zoo_service_loader.o
 
 zoo_loader.cgi: zoo_loader.c zoo_service_loader.o  ulinet.o service.h lex.sr.o service_conf.tab.o service_conf.y service_internal_python.o  ulinet.o main_conf_read.tab.o lex.cr.o service_internal.o ${PHP_FILE} ${JAVA_FILE} ${JS_FILE} ${PERL_FILE}
Index: /trunk/zoo-kernel/configure.ac
===================================================================
--- /trunk/zoo-kernel/configure.ac	(revision 30)
+++ /trunk/zoo-kernel/configure.ac	(revision 20)
@@ -128,47 +128,49 @@
 # ===========================================================================
 
-
-
-
 AC_ARG_WITH([python], 
-	[AS_HELP_STRING([--with-python=PATH], [To enabled python support or specify an alternative directory for python installation,  disabled by default])], 
-	[PYTHON_PATH="$withval"; PYTHON_ENABLED="-DUSE_PYTHON"], [PYTHON_ENABLED=""])
-
-
-if test -z "$PYTHON_ENABLED"
-then
-	PYTHON_FILE=""
-else
-	PYTHONCONFIG="$PYTHON_PATH/bin/python-config"
-	PYTHON_FILE="service_internal_python.o"
-	if test  "$PYTHON_PATH" = "yes"
-	then
-		# PHP was not specified, so search within the current path
-		AC_PATH_PROG([PYTHONCONFIG], [python-config])
-	else
-		PYTHONCONFIG="$PYTHON_PATH/bin/python-config"
-	fi
-
-	# Extract the linker and include flags 
-	PYTHON_LDFLAGS=`$PYTHONCONFIG --ldflags`
-	PYTHON_CPPFLAGS=`$PYTHONCONFIG --cflags`
-
-	# Check headers file
-	CPPFLAGS_SAVE="$CPPFLAGS"
-	CPPFLAGS="$PYTHON_CPPFLAGS"
-	AC_CHECK_HEADERS([Python.h],
+	[AS_HELP_STRING([--with-python=PATH], [specify an alternative directory for python installation])], 
+	[PYTHONCONFIG="$withval/bin/python-config"], [PYTHONCONFIG=""])
+
+if test "x$PYTHONCONFIG" = "x"; then
+	# PYTHON was not specified, so search within the current path
+	AC_PATH_PROG([PYTHONCONFIG], [python-config])
+
+	# If we couldn't find python-config, display a warning
+	if test "x$PYTHONCONFIG" = "x"; then
+		AC_MSG_ERROR([could not find python-config from libpython within the current path. You may need to try re-running configure with a --with-python parameter.])
+	fi
+else
+	# PYTHON was specified; display a message to the user
+	if test "x$PYTHON" = "xyes"; then
+		AC_MSG_ERROR([you must specify a parameter to --with-python, e.g. --with-python=/path/to/python])
+	else
+		if test -f $PYTHONCONFIG; then
+			AC_MSG_RESULT([Using user-specified python-config file: $PYTHONCONFIG])
+		else
+			AC_MSG_ERROR([the user-specified python-config file $PYTHONCONFIG does not exist])
+		fi	
+	fi
+fi
+
+
+# Extract the linker and include flags 
+PYTHON_LDFLAGS=`$PYTHONCONFIG --libs`
+PYTHON_CPPFLAGS=`$PYTHONCONFIG --cflags`
+
+# Check headers file
+CPPFLAGS_SAVE="$CPPFLAGS"
+CPPFLAGS="$PYTHON_CPPFLAGS"
+AC_CHECK_HEADERS([Python.h],
 		 [], [AC_MSG_ERROR([could not find headers include related to libpython])])
 
-	# Ensure we can link against libphp
-	LIBS_SAVE="$LIBS"
-	LIBS="$PYTHON_LDFLAGS"
-	PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'`
-	AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
-	AC_SUBST([PYTHON_CPPFLAGS])
-	AC_SUBST([PYTHON_LDFLAGS])
-fi
-
-AC_SUBST([PYTHON_ENABLED])
-AC_SUBST([PYTHON_FILE])
+# Ensure we can link against libpython
+LIBS_SAVE="$LIBS"
+LIBS="$PYTHON_LDFLAGS"
+# Shouldn't we get python here rather than python2.6 :) ??
+PY_LIB=`$PYTHONCONFIG --libs | sed -e 's/^.*\(python2\..\)$/\1/'`
+AC_CHECK_LIB([$PY_LIB], [PyObject_CallObject], [], [AC_MSG_ERROR([could not find libpython])], [])
+
+AC_SUBST([PYTHON_CPPFLAGS])
+AC_SUBST([PYTHON_LDFLAGS])
 
 # ===========================================================================
@@ -180,22 +182,35 @@
 
 AC_ARG_WITH([php], 
-	[AS_HELP_STRING([--with-php=PATH], [To enabled php support or specify an alternative directory for php installation,  disabled by default])], 
-	[PHP_PATH="$withval"; PHP_ENABLED="-DUSE_PHP"], [PHP_ENABLED=""])
-
-
-if test -z "$PHP_ENABLED"
-then
-	PHP_FILE=""
-else
+	[AS_HELP_STRING([--with-php=PATH], [specify an alternative directory for php installation or --with-php=no  to disable php support])], 
+	[PHP_PATH="$withval"], [PHP_PATH=""])
+if test "$PHP_PATH" != "no";
+then 
 	PHPCONFIG="$PHP_PATH/bin/php-config"
+	PHP_ENABLED="-DUSE_PHP"
 	PHP_FILE="service_internal_php.o"
-	if test  "$PHP_PATH" = "yes"
-	then
-		# PHP was not specified, so search within the current path
-		AC_PATH_PROG([PHPCONFIG], [php-config])
-	else
-		PHPCONFIG="$PHP_PATH/bin/php-config"
-	fi
-
+	if test "x$PHPCONFIG" = "x"; 
+	then
+	# PHP was not specified, so search within the current path
+	AC_PATH_PROG([PHPCONFIG], [php-config])
+
+	# If we couldn't find php-config, display a warning
+	if test "x$PHPCONFIG" = "x"; 
+	then
+		AC_MSG_ERROR([could not find php-config from libphp within the current path. You may need to try re-running configure with a --with-php parameter.])
+	fi
+	else
+		# PHP was specified; display a message to the user
+		if test "x$PHP" = "xyes"; 
+		then
+			AC_MSG_ERROR([you must specify a parameter to --with-php, e.g. --with-php=/path/to/php])
+		else
+			if test -f $PHPCONFIG; 
+			then
+				AC_MSG_RESULT([Using user-specified php-config file: $PHPCONFIG])
+			else
+				AC_MSG_ERROR([the user-specified php-config file $PHPCONFIG does not exist])
+			fi	
+		fi
+	fi
 	# Extract the linker and include flags 
 	PHP_LDFLAGS="-L/`$PHPCONFIG --prefix`/lib -lphp5"
@@ -215,4 +230,7 @@
 	AC_SUBST([PHP_CPPFLAGS])
 	AC_SUBST([PHP_LDFLAGS])
+else
+	PHP_ENABLED=""
+	PHP_FILE=""
 fi
 
@@ -226,18 +244,13 @@
 
 
+
+
 AC_ARG_WITH([perl], 
-	[AS_HELP_STRING([--with-perl=PATH], [To enabled perl support or specify an alternative directory for perl installation,  disabled by default])], 
-	[PERL_PATH="$withval"; PERL_ENABLED="-DUSE_PERL"], [PERL_ENABLED=""])
-
-
-if test -z "$PERL_ENABLED"
-then
-	PERL_FILE=""
-else
-	PERLCONFIG="$PERL_PATH/bin/perl"
-	PHP_FILE="service_internal_perl.o"
-	if test  "$PERL_PATH" = "yes"
-	then
-		# PHP was not specified, so search within the current path
+	[AS_HELP_STRING([--with-perl=PATH], [specify an alternative directory for perl installation or --with-perl=no  to disable perl support])], 
+	[PERL_PATH="$withval"], [PERL_PATH=""])
+if test "$PERL_PATH" != "no";
+then 
+	if test "x$PERL_PATH" = "xyes";
+	then
 		AC_PATH_PROG([PERLCONFIG], [perl])
 	else
@@ -245,4 +258,14 @@
 	fi
 
+	if test -f $PERLCONFIG;
+	then
+		AC_MSG_RESULT([Using user-specified perl file: $PERLCONFIG])
+	else
+		AC_MSG_ERROR([the user-specified perl file $PERLCONFIG does not exist])
+	fi
+
+	PERL_ENABLED="-DUSE_PERL"
+	PERL_FILE="service_internal_perl.o"
+	
 	# Extract the linker and include flags 
 	PERL_LDFLAGS=`$PERLCONFIG -MExtUtils::Embed -e ldopts`
@@ -257,4 +280,7 @@
 	AC_SUBST([PERL_CPPFLAGS])
 	AC_SUBST([PERL_LDFLAGS])
+else
+	PERL_ENABLED=""
+	PERL_FILE=""
 fi
 
Index: /trunk/zoo-kernel/service.c
===================================================================
--- /trunk/zoo-kernel/service.c	(revision 20)
+++ /trunk/zoo-kernel/service.c	(revision 20)
@@ -0,0 +1,58 @@
+#include "service.h"
+
+map* createMap(char* name,char* value){
+  map* tmp=(map *)malloc(sizeof(map*));
+  tmp->name=strdup(name);
+  tmp->value=strdup(value);
+  tmp->next=NULL;
+  return tmp;
+}
+
+bool hasKey(map* m,char *key){
+  map* tmp=m;
+  while(tmp!=NULL){
+    if(strcmp(tmp->name,key)==0)
+      return true;
+    tmp=tmp->next;
+  }
+#ifdef DEBUG_MAP
+  printf("NOT FOUND \n");
+#endif
+  return false;
+}
+
+map* getMap(map* m,char *key){
+  map* tmp=m;
+  while(tmp!=NULL){
+    if(strcmp(tmp->name,key)==0)
+      return tmp;
+    tmp=tmp->next;
+  }
+  return NULL;
+}
+
+void* addToMap(map* m,char* n,char* v){
+  if(hasKey(m,n)==false){
+    map* _cursor=m;
+    while(_cursor->next)
+      _cursor=_cursor->next;
+    _cursor->next=createMap(n,v);
+  }
+  else{
+    map *tmp=getMap(m,n);
+    tmp->value=strdup(v);
+  }
+}
+
+void* _dumpMap(map* t){
+  fprintf(stderr,"[%s] => [%s] \n",t->name,t->value);
+  fflush(stderr);
+}
+
+void* dumpMap(map* t){
+  map* tmp=t;
+  while(tmp!=NULL){
+    _dumpMap(tmp);
+    tmp=tmp->next;
+  }
+}
Index: /trunk/zoo-kernel/service.h
===================================================================
--- /trunk/zoo-kernel/service.h	(revision 30)
+++ /trunk/zoo-kernel/service.h	(revision 20)
@@ -53,5 +53,19 @@
 #define SERVICE_SIZE (ELEMENTS_SIZE*2)+(MAP_SIZE*2)+sizeof(char*)
 
-#define SHMSZ     27
+
+  /*  static char* mtoupper(char* str){
+    char* tmp=strdup(str);
+    if(tmp){
+      int cnt=strlen(tmp);
+      int i;
+      for(i=0;i<cnt;i++){
+	tmp[i]=toupper(str[i]);
+	tmp[i+1]=0;
+      }
+    }
+    else
+      tmp[0]=0;
+    return tmp;
+    }*/
 
   /**
@@ -423,19 +437,4 @@
       }
       tmp=tmp->next;
-    }
-  }
-
-
-  static void* setMapInMaps(maps* m,char* key,char* subkey,char *value){
-    maps* _tmpm=getMaps(m,key);
-    if(_tmpm!=NULL){
-      map* _ztmpm=getMap(_tmpm->content,subkey);
-      if(_ztmpm!=NULL){
-	free(_ztmpm->value);
-	_ztmpm->value=strdup(value);
-	dumpMap(_ztmpm);
-      }else{
-	addToMap(_tmpm->content,subkey,value);
-      }
     }
   }
Index: /trunk/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-kernel/service_internal.c	(revision 30)
+++ /trunk/zoo-kernel/service_internal.c	(revision 20)
@@ -35,122 +35,4 @@
   return hex[code & 15];
 }
-
-void* unhandleStatus(maps *conf){
-  int shmid,i;
-  key_t key;
-  void *shm;
-  struct shmid_ds shmids;
-  char *s,*s1;
-  map *tmpMap=getMapFromMaps(conf,"lenv","sid");
-  if(tmpMap!=NULL){
-    key=atoi(tmpMap->value);
-    if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) {
-#ifdef DEBUG
-      fprintf(stderr,"shmget failed to update value\n");
-#endif
-    }else{
-      if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
-#ifdef DEBUG
-	fprintf(stderr,"shmat failed to update value\n");
-#endif
-      }else{
-	shmdt(shm);
-	shmctl(shmid,IPC_RMID,&shmids);
-      }
-    }
-  }
-}
-
-#ifdef USE_JS
-
-JSBool
-JSUpdateStatus(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval)
-{
-  JS_MaybeGC(cx);
-  char *sid;
-  int istatus=0;
-  char *status=NULL;
-  maps *conf;
-  int i=0;
-  if(argc>2){
-#ifdef JS_DEBUG
-    fprintf(stderr,"Number of arguments used to call the function : %i",argc);
-#endif
-    return JS_FALSE;
-  }
-  conf=mapsFromJSObject(cx,argv[0]);
-  dumpMaps(conf);
-  if(JS_ValueToInt32(cx,argv[1],&istatus)==JS_TRUE){
-    char tmpStatus[4];
-    sprintf(tmpStatus,"%i",istatus);
-    tmpStatus[3]=0;
-    status=strdup(tmpStatus);
-  }
-  if(getMapFromMaps(conf,"lenv","status")!=NULL){
-    if(status!=NULL)
-      setMapInMaps(conf,"lenv","status",status);
-    else
-      setMapInMaps(conf,"lenv","status","15");
-    updateStatus(conf);
-  }
-  freeMaps(&conf);
-  free(conf);
-  JS_MaybeGC(cx);
-  return JS_TRUE;
-}
-
-#endif
-
-void* updateStatus(maps *conf){
-  int shmid,i;
-  key_t key;
-  char *shm,*s,*s1;
-  map *tmpMap=NULL;
-  tmpMap=getMapFromMaps(conf,"lenv","sid");
-  if(tmpMap!=NULL){
-    key=atoi(tmpMap->value);
-    if ((shmid = shmget(key, SHMSZ, IPC_CREAT | 0666)) < 0) {
-#ifdef DEBUG
-      fprintf(stderr,"shmget failed to update value\n");
-#endif
-    }else{
-      if ((shm = (char*) shmat(shmid, NULL, 0)) == (char *) -1) {
-#ifdef DEBUG
-	fprintf(stderr,"shmat failed to update value\n");
-#endif
-      }
-      else{
-	tmpMap=getMapFromMaps(conf,"lenv","status");
-	s1=shm;
-	for(s=tmpMap->value;*s!=NULL;s++)
-	  *s1++=*s;
-	shmdt((void *)shm);
-      }
-    }
-  }
-}
-
-char* getStatus(int pid){
-  int shmid,i;
-  key_t key;
-  void *shm;
-  char *s;
-  key=pid;
-  if ((shmid = shmget(key, SHMSZ, 0666)) < 0) {
-#ifdef DEBUG
-    fprintf(stderr,"shmget failed in getStatus\n");
-#endif
-  }else{
-    if ((shm = shmat(shmid, NULL, 0)) == (char *) -1) {
-#ifdef DEBUG
-      fprintf(stderr,"shmat failed in getStatus\n");
-#endif
-    }else{
-      return (char*)shm;
-    }
-  }
-  return "-1";
-}
-
 
 /* Returns a url-encoded version of str */
@@ -847,5 +729,5 @@
 	  char tmp[1024];
 	  sprintf(tmp,"http://www.w3.org/TR/xmlschema-2/#%s",tmp1->value);
-	  xmlNewNsProp(nc6,ns_ows,BAD_CAST "reference",BAD_CAST tmp);
+	  xmlNewNsProp(nc6,ns_xlink,BAD_CAST "reference",BAD_CAST tmp);
 	  xmlAddChild(nc3,nc6);
 	  tmp1=tmp1->next;
@@ -959,61 +841,20 @@
   xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");
   char tmp[256];
-  char url[1024];
+  char url[256];
   memset(tmp,0,256);
   memset(url,0,256);
   maps* tmp_maps=getMaps(m,"main");
   if(tmp_maps!=NULL){
-    dumpMaps(getMaps(m,"lenv"));
-    map* tmpm1=getMap(tmp_maps->content,"serverAddress");
-    /**
-     * Check if the ZOO Service GetStatus is available in the local directory.
-     * If yes, then it uses a reference to an URL which the client can access
-     * to get information on the status of a running Service (using the 
-     * percentCompleted attribute). 
-     * Else fallback to the initial method using the xml file to write in ...
-     */
-    char ntmp[1024];
-#ifndef WIN32
-    getcwd(ntmp,1024);
-#else
-    _getcwd(ntmp,1024);
-#endif
-    struct stat myFileInfo;
-    int statRes;
-    char file_path[1024];
-    sprintf(file_path,"%s/GetStatus.zcfg",ntmp);
-    statRes=stat(file_path,&myFileInfo);
-    if(statRes==0){
-      char currentSid[128];
-      map* tmpm=getMap(tmp_maps->content,"rewriteUrl");
-      map *tmp_lenv=NULL;
-      tmp_lenv=getMapFromMaps(m,"lenv","sid");
-      if(tmp_lenv==NULL)
-	sprintf(currentSid,"%i",pid);
-      else
-	sprintf(currentSid,"%s",tmp_lenv->value);
-      if(tmpm==NULL || strcasecmp(tmpm->value,"false")==0){
-	sprintf(url,"%s/?request=Execute&amp;service=WPS&amp;version=1.0.0&amp;Identifier=GetStatus&amp;DataInputs=sid=%s&amp;RawDataOutput=Result",tmpm1->value,currentSid);
-      }else{
-	if(strlen(tmpm->value)>0)
-	  if(strcasecmp(tmpm->value,"true")!=0)
-	    sprintf(url,"%s/%s/GetStatus/%s",tmpm1->value,tmpm->value,currentSid);
-	  else
-	    sprintf(url,"%s/GetStatus/%s",tmpm1->value,currentSid);
-	else
-	  sprintf(url,"%s/?request=Execute&amp;service=WPS&amp;version=1.0.0&amp;Identifier=GetStatus&amp;DataInputs=sid=%s&amp;RawDataOutput=Result",tmpm1->value,currentSid);
-      }
-    }else{
-      map* tmpm2=getMap(tmp_maps->content,"tmpUrl");
-      if(tmpm1!=NULL && tmpm2!=NULL){
-	sprintf(url,"%s/%s/%s_%i.xml",tmpm1->value,tmpm2->value,service,pid);
-      }
-    }
-    if(tmpm1!=NULL)
-      sprintf(tmp,"%s/",tmpm1->value);
+    map* tmpm=getMap(tmp_maps->content,"serverAddress");
+    map* tmpm1=getMap(tmp_maps->content,"tmpUrl");
+    if(tmpm!=NULL && tmpm1!=NULL){
+      sprintf(url,"%s/%s/%s_%i.xml",tmpm->value,tmpm1->value,service,pid);
+    }
+    if(tmpm!=NULL)
+      sprintf(tmp,"%s/",tmpm->value);
   }
 
   xmlNewProp(n,BAD_CAST "serviceInstance",BAD_CAST tmp);
-  if(status!=SERVICE_SUCCEEDED && status!=SERVICE_FAILED){
+  if(status!=SERVICE_SUCCEEDED){
     xmlNewProp(n,BAD_CAST "statusLocation",BAD_CAST url);
   }
@@ -1035,5 +876,4 @@
   time_t now;
   char *tmp1;
-  map *tmpStatus;
   
   now = time ( NULL );
@@ -1044,48 +884,24 @@
   len = strftime ( tmp1, TIME_SIZE, "%Y-%m-%dT%I:%M:%SZ", tm );
 
-  xmlNewProp(nc,BAD_CAST "creationTime",BAD_CAST tmp1);
-
-  char sMsg[2048];
   switch(status){
   case SERVICE_SUCCEEDED:
+    xmlNewProp(nc,BAD_CAST "creationTime",BAD_CAST tmp1);
     nc1 = xmlNewNode(ns, BAD_CAST "ProcessSucceeded");
-    sprintf(sMsg,"Service \"%s\" run successfully.",serv->name);
-    nc3=xmlNewText(BAD_CAST sMsg);
-    xmlAddChild(nc1,nc3);
     break;
   case SERVICE_STARTED:
+    xmlNewProp(nc,BAD_CAST "creationTime",BAD_CAST tmp1);
     nc1 = xmlNewNode(ns, BAD_CAST "ProcessStarted");
-    tmpStatus=getMapFromMaps(m,"lenv","status");
-    xmlNewProp(nc1,BAD_CAST "percentCompleted",BAD_CAST tmpStatus->value);
-    sprintf(sMsg,"ZOO Service \"%s\" is currently running. Please, reload this document to get the up-to-date status of the Service.",serv->name);
-    nc3=xmlNewText(BAD_CAST sMsg);
-    xmlAddChild(nc1,nc3);
+    xmlNewProp(nc1,BAD_CAST "percentCompleted",BAD_CAST "NEED_SERVICE_ACCESS"); 
     break;
   case SERVICE_ACCEPTED:
+    xmlNewProp(nc,BAD_CAST "creationTime",BAD_CAST tmp1);
     nc1 = xmlNewNode(ns, BAD_CAST "ProcessAccepted");
-    sprintf(sMsg,"Service \"%s\" was accepted by the ZOO Kernel and it run as a background task. Please consult the statusLocation attribtue providen in this document to get the up-to-date document.",serv->name);
-    nc3=xmlNewText(BAD_CAST sMsg);
-    xmlAddChild(nc1,nc3);
     break;
   case SERVICE_FAILED:
     nc1 = xmlNewNode(ns, BAD_CAST "ProcessFailed");
-    map *errorMap;
-    map *te;
-    te=getMapFromMaps(m,"lenv","code");
-    if(te!=NULL)
-      errorMap=createMap("code",te->value);
-    else
-      errorMap=createMap("code","NoApplicableCode");
-    te=getMapFromMaps(m,"lenv","message");
-    if(te!=NULL)
-      addToMap(errorMap,"text",te->value);
-    else
-      addToMap(errorMap,"text","No more information available");
-    nc3=createExceptionReportNode(m,errorMap,0);
-    xmlAddChild(nc1,nc3);
     break;
   default :
     printf("error code not know : %i\n",status);
-    //exit(1);
+    exit(1);
     break;
   }
@@ -1243,8 +1059,8 @@
   nc1=xmlNewNode(ns_wps, BAD_CAST type);
   map *tmp=e->content;
-#ifdef DEBUG
+  //#ifdef DEBUG
   dumpMap(tmp);
   dumpElements(e);
-#endif
+  //#endif
   nc2=xmlNewNode(ns_ows, BAD_CAST "Identifier");
   nc3=xmlNewText(BAD_CAST e->name);
@@ -1269,7 +1085,7 @@
    * IO type Reference or full Data ?
    */
-#ifdef DEBUG
+  //#ifdef DEBUG
   fprintf(stderr,"FORMAT %s %s\n",e->format,e->format);
-#endif
+  //#endif
   map *tmpMap=getMap(m->content,"Reference");
   if(tmpMap==NULL){
@@ -1394,7 +1210,5 @@
   maps* tmpMap=getMaps(m,"main");
   char *encoding=getEncoding(tmpMap);
-  map *tmpSid=getMapFromMaps(m,"lenv","sid");
-  if(tmpSid==NULL)
-    printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
+  printf("Content-Type: text/xml; charset=%s\r\nStatus: 200 OK\r\n\r\n",encoding);
 
   ns=xmlNewNs(NULL,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows");
@@ -1403,7 +1217,9 @@
   ns_xlink=xmlNewNs(n,BAD_CAST "http://www.w3.org/1999/xlink",BAD_CAST "xlink");
   ns_xsi=xmlNewNs(n,BAD_CAST "http://www.w3.org/2001/XMLSchema-instance",BAD_CAST "xsi");
-  xmlNewProp(n,BAD_CAST "xsi:schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd");
+  xmlNewProp(n,BAD_CAST "xsi:schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1/owsExceptionReport.xsd");
   xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");
-  xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0");
+  xmlNewProp(n,BAD_CAST "service",BAD_CAST "WPS");
+
+  xmlNewProp(n,BAD_CAST "version",BAD_CAST getVersion(tmpMap));
 
   nc = xmlNewNode(ns, BAD_CAST "Exception");  
@@ -1435,49 +1251,4 @@
   xmlFreeNs(ns);
   xmlCleanupParser();
-}
-
-xmlNodePtr createExceptionReportNode(maps* m,map* s,int use_ns){
-  
-  int buffersize;
-  xmlChar *xmlbuff;
-  xmlNsPtr ns,ns_ows,ns_xlink,ns_xsi;
-  xmlNodePtr n,nc,nc1,nc2;
-
-  maps* tmpMap=getMaps(m,"main");
-
-  ns=xmlNewNs(NULL,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows");
-  n = xmlNewNode(ns, BAD_CAST "ExceptionReport");
-
-  if(use_ns==1){
-    ns_ows=xmlNewNs(n,BAD_CAST "http://www.opengis.net/ows/1.1",BAD_CAST "ows");
-    int xsiId=zooXmlAddNs(n,"http://www.w3.org/2001/XMLSchema-instance","xsi");
-    ns_xsi=usedNs[xsiId];
-    int xlinkId=zooXmlAddNs(n,"http://www.w3.org/1999/xlink","xlink");
-    ns_xlink=usedNs[xlinkId];
-    xmlNewNsProp(n,ns_xsi,BAD_CAST "schemaLocation",BAD_CAST "http://www.opengis.net/ows/1.1 http://schemas.opengis.net/ows/1.1.0/owsExceptionReport.xsd");
-  }
-  xmlNewProp(n,BAD_CAST "xml:lang",BAD_CAST "en");
-  xmlNewProp(n,BAD_CAST "version",BAD_CAST "1.1.0");
-  
-  nc = xmlNewNode(ns, BAD_CAST "Exception");
-
-  map* tmp=getMap(s,"code");
-  if(tmp!=NULL)
-    xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST tmp->value);
-  else
-    xmlNewProp(nc,BAD_CAST "exceptionCode",BAD_CAST "NoApplicableCode");
-
-  tmp=getMap(s,"text");
-  nc1 = xmlNewNode(ns, BAD_CAST "ExceptionText");
-  nc2=NULL;
-  if(tmp!=NULL){
-    xmlNodeSetContent(nc1, BAD_CAST tmp->value);
-  }
-  else{
-    xmlNodeSetContent(nc1, BAD_CAST "No debug message available");
-  }
-  xmlAddChild(nc,nc1);
-  xmlAddChild(n,nc);
-  return n;
 }
 
@@ -1525,59 +1296,43 @@
 #endif
     printProcessResponse(m,request_inputs1,cpid,
-			 s,r_inputs->value,res,
-			 request_inputs,
-			 request_outputs);
-  }
-  else
-    if(res!=SERVICE_FAILED){
-      /**
-       * We get the first output only !!
-       */
-      char mime[1024];
-      map* mi=getMap(request_outputs->content,"mimeType");
-#ifdef DEBUG
-      fprintf(stderr,"SERVICE OUTPUTS\n");
-      dumpMaps(request_outputs);
-      fprintf(stderr,"SERVICE OUTPUTS\n");
-#endif
-      map* en=getMap(request_outputs->content,"encoding");
-      if(mi!=NULL && en!=NULL)
+			  s,r_inputs->value,res,
+			  request_inputs,
+			  request_outputs);
+  }
+  else{
+    /**
+     * We get the first output only !!
+     */
+    char mime[1024];
+    map* mi=getMap(request_outputs->content,"mimeType");
+#ifdef DEBUG
+    fprintf(stderr,"SERVICE OUTPUTS\n");
+    dumpMaps(request_outputs);
+    fprintf(stderr,"SERVICE OUTPUTS\n");
+#endif
+    map* en=getMap(request_outputs->content,"encoding");
+    if(mi!=NULL && en!=NULL)
+      sprintf(mime,
+	      "Content-Type: %s; charset=%s\r\nStatus: 200 OK\r\n\r\n",
+	      mi->value,en->value);
+    else
+      if(mi!=NULL)
 	sprintf(mime,
-		"Content-Type: %s; charset=%s\r\nStatus: 200 OK\r\n\r\n",
-		mi->value,en->value);
+		"Content-Type: %s; charset=UTF-8\r\nStatus: 200 OK\r\n\r\n",
+		mi->value);
       else
-	if(mi!=NULL)
-	  sprintf(mime,
-		  "Content-Type: %s; charset=UTF-8\r\nStatus: 200 OK\r\n\r\n",
-		  mi->value);
-	else
-	  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");
-	fwrite(toto->value,atoi(rs->value),1,stdout);
-      }
-      else
-	printf("%s",toto->value);
-#ifdef DEBUG
-      dumpMap(toto);
-#endif
-    }else{
-      char tmp[1024];
-      map * errormap;
-      map *lenv;
-      lenv=getMapFromMaps(m,"lenv","message");
-      if(lenv!=NULL)
-	sprintf(tmp,"Unable to run the Service. The message returned back by the Service was the following : %s",lenv->value);
-      else
-	sprintf(tmp,"Unable to run the Service. No more information was returned back by the Service.");
-      errormap = createMap("text",tmp);      
-      addToMap(errormap,"code", "InternalError");
-      printf("Content-Type: text/xml; charset=utf-8\r\nStatus: 200 OK\r\n\r\n");
-      printExceptionReportResponse(m,errormap);
-      freeMap(&errormap);
-      free(errormap);
-    }
+	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");
+      fwrite(toto->value,atoi(rs->value),1,stdout);
+    }
+    else
+      printf("%s",toto->value);
+#ifdef DEBUG
+    dumpMap(toto);
+#endif
+  }
 }
 
Index: /trunk/zoo-kernel/service_internal.h
===================================================================
--- /trunk/zoo-kernel/service_internal.h	(revision 30)
+++ /trunk/zoo-kernel/service_internal.h	(revision 20)
@@ -31,9 +31,5 @@
 #define TIME_SIZE 40
 
-#include <sys/stat.h>
 #include <sys/types.h>
-#include <sys/ipc.h>
-#include <sys/shm.h>
-#include <stdio.h>
 #include <unistd.h>
 #include <time.h>
@@ -52,9 +48,4 @@
 extern   int conf_read(char*,maps*);
 
-#ifdef USE_JS
-#define XP_UNIX 0
-#include "service_internal_js.h"
-#endif
-
 #ifdef __cplusplus
 extern "C" {
@@ -66,13 +57,5 @@
   static int nbNs=0;
 
-  void* unhandleStatus(maps*);
-  void* updateStatus(maps*);
-  char* getStatus(int);
 
-#ifdef USE_JS
-  char* JSValToChar(JSContext*,jsval*);
-  JSBool JSUpdateStatus(JSContext*,JSObject*,uintN,jsval *,jsval *);
-#endif
-  
   void URLDecode(char *);
   char *url_encode(char *);
@@ -84,5 +67,4 @@
   
   void printExceptionReportResponse(maps*,map*);
-  xmlNodePtr createExceptionReportNode(maps*,map*,int);
   void printProcessResponse(maps*,map*,int,service*,char*,int,maps*,maps*);
   xmlNodePtr printGetCapabilitiesHeader(xmlDocPtr,char*,maps*);
Index: /trunk/zoo-kernel/service_internal_js.c
===================================================================
--- /trunk/zoo-kernel/service_internal_js.c	(revision 30)
+++ /trunk/zoo-kernel/service_internal_js.c	(revision 20)
@@ -23,5 +23,5 @@
  */
 
-#include "service_internal.h"
+#include "service_internal_js.h"
 
 static char dbg[1024];
@@ -74,6 +74,4 @@
   if (!JS_DefineFunction(cx, global, "ZOORequest", JSRequest, 4, 0))
     return 1;
-  if (!JS_DefineFunction(cx, global, "ZOOUpdateStatus", JSUpdateStatus, 2, 0))
-    return 1;
 
   /* Your application code here. This may include JSAPI calls
@@ -84,10 +82,8 @@
   map* tmpm1=getMap(request,"metapath");
   map* tmpm2=getMap(s->content,"serviceProvider");
+  char filename[strlen(tmpm1->value)+strlen(tmpm2->value)+6];
   char ntmp[1024];
   getcwd(ntmp,1024);
-  char filename[strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+2];
   sprintf(filename,"%s/%s%s",ntmp,tmpm1->value,tmpm2->value);
-  filename[strlen(tmpm1->value)+strlen(tmpm2->value)+strlen(ntmp)+1]=0;
-  fprintf(stderr,"FILENAME %s\n",filename);
   struct stat file_status;
   stat(filename, &file_status);
@@ -207,6 +203,7 @@
 
   /* Cleanup. */
+  // The JS_MaybeGC call imply segmentation fault
+  //JS_MaybeGC(cx);
   JS_DestroyScript(cx, script);
-  JS_MaybeGC(cx);
   // If we use the DestroyContext as requested to release memory then we get 
   // issue getting back the main configuration maps after coming back to the 
@@ -390,7 +387,5 @@
 #endif
       if(res!=NULL){
-#ifdef JS_DEBUG
 	fprintf(stderr,"%s - %s\n",JS_GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));
-#endif
 	addToMap(res,JS_GetStringBytes(jsmsg),JS_GetStringBytes(jsmsg1));
       }
@@ -399,7 +394,5 @@
 	res->next=NULL;
       }
-#ifdef JS_DEBUG
       dumpMap(res);
-#endif
     }
   }
Index: /trunk/zoo-kernel/service_internal_perl.c
===================================================================
--- /trunk/zoo-kernel/service_internal_perl.c	(revision 30)
+++ /trunk/zoo-kernel/service_internal_perl.c	(revision 20)
@@ -127,75 +127,3 @@
 }
 	
-int zoo_perl_support(maps** main_conf,map* request,service* s,maps **real_inputs,maps **real_outputs){
-	maps* m=*main_conf;
- 	maps* inputs=*real_inputs;
-	maps* outputs=*real_outputs;
-  	int res=SERVICE_FAILED;
-  	map * tmp=getMap(s->content,"serviceProvide");
 
-	char *my_argv[] = { "", tmp->value };
-	if ((my_perl = perl_alloc()) == NULL){
-		fprintf(stderr,"no memmory");
-		exit(1);
-	}
-	perl_construct( my_perl );
-	perl_parse(my_perl, xs_init, 2, my_argv, (char **)NULL);
-	perl_run(my_perl);
-	
-
-	HV* h_main_conf = (HV *)sv_2mortal((SV *)newHV());
-	HV* h_real_inputs = (HV *)sv_2mortal((SV *)newHV());
-	HV* h_real_outputs = (HV *)sv_2mortal((SV *)newHV());
-	maps_to_hash(m,&h_main_conf);
-	maps_to_hash(inputs,&h_real_inputs);
-	maps_to_hash(outputs,&h_real_outputs);
-	dSP;
-    	ENTER;
-    	SAVETMPS;
-    	PUSHMARK(SP);
-	XPUSHs(sv_2mortal(newRV_inc((SV *)h_main_conf)));
-	XPUSHs(sv_2mortal(newRV_inc((SV *)h_real_inputs)));
-	XPUSHs(sv_2mortal(newRV_inc((SV *)h_real_outputs)));
-	PUTBACK;
-	call_pv(s->name, G_SCALAR);
-	SPAGAIN;
-	res = POPi;
-	hash_to_maps(h_real_outputs,real_outputs);
-	PUTBACK;
-    	FREETMPS;
-    	LEAVE;
-	return res;
-}
-
-	
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
Index: /trunk/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-kernel/zoo_service_loader.c	(revision 30)
+++ /trunk/zoo-kernel/zoo_service_loader.c	(revision 20)
@@ -44,9 +44,5 @@
 #include "service.h"
 #include "service_internal.h"
-
-
-#ifdef USE_PYTHON
 #include "service_internal_python.h"
-#endif
 
 #ifdef USE_JAVA
@@ -61,9 +57,4 @@
 #include "service_internal_js.h"
 #endif
-
-#ifdef USE_PERL
-#include "service_internal_perl.h"
-#endif
-
 
 
@@ -182,6 +173,4 @@
     freeMaps(&m);
     free(m);
-    freeMap(&request_inputs);
-    free(request_inputs);
     return 1;
   }
@@ -194,6 +183,4 @@
       freeMaps(&m);
       free(m);
-      freeMap(&request_inputs);
-      free(request_inputs);
       free(REQUEST);
       return 1;
@@ -1588,10 +1575,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
@@ -1608,13 +1593,5 @@
 	  else
 #endif
-
-
-#ifdef USE_PERL
-          if(strncasecmp(r_inputs->value,"PERL",4)==0){
-            eres=zoo_perl_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format);
-          }
-          else
-#endif
-
+	  
 #ifdef USE_JS
 	    if(strncasecmp(r_inputs->value,"JS",2)==0){
@@ -1810,11 +1787,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
@@ -1832,10 +1806,4 @@
 #endif
 	      
-#ifdef USE_PERL
-          if(strncasecmp(r_inputs->value,"PERL",4)==0){
-            eres=zoo_perl_support(&m,request_inputs,s1,&request_input_real_format,&request_output_real_format);
-          }
-          else
-#endif
 #ifdef USE_JS
 	      if(strncasecmp(r_inputs->value,"JS",2)==0){
@@ -1873,22 +1841,15 @@
 		   cpid,m,eres);
 
-  //if(getpid()==cpid){
   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);
-  */
+  /*freeMaps(&request_output_real_format);
+  free(request_output_real_format);*/
   
   free(REQUEST);
@@ -1899,5 +1860,4 @@
   fflush(stderr);
 #endif
-    //}
 
   return 0;
Index: /trunk/zoo-services/ogr/base-vect-ops/Makefile
===================================================================
--- /trunk/zoo-services/ogr/base-vect-ops/Makefile	(revision 30)
+++ /trunk/zoo-services/ogr/base-vect-ops/Makefile	(revision 20)
@@ -1,9 +1,7 @@
-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
+CFLAGS=-I../../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags`  `gdal-config --cflags`   -DLINUX_FREE_ISSUE #-DDEBUG
+CC=gcc
 
-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`
+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`
 
 clean:
Index: /trunk/zoo-services/ogr/base-vect-ops/service.c
===================================================================
--- /trunk/zoo-services/ogr/base-vect-ops/service.c	(revision 30)
+++ /trunk/zoo-services/ogr/base-vect-ops/service.c	(revision 20)
@@ -74,4 +74,5 @@
     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);
@@ -86,9 +87,11 @@
     free(tmp);
     if(res==NULL){
-      setMapInMaps(conf,"lenv","message","Unable to call OGR_G_CreatFromGML");
-      return NULL;
+      map* tmp=createMap("text","Unable to call OGR_G_CreatFromGML");
+      addToMap(tmp,"code","NoApplicableCode");
+      printExceptionReportResponse(conf,tmp);
+      exit(0);
     }
     else
-      return res;
+      return res;//OGR_G_CreateFromGML(tmp);
   }
 
@@ -105,52 +108,36 @@
     fprintf(stderr,"Tolerance for Simplify %f",tolerance);
     map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
-    if(!tmp){
-      setMapInMaps(conf,"lenv","message","Unagle to parse the input geometry from InputPolygon");
+    if(!tmp)
       return SERVICE_FAILED;
-    }
-    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
+    map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeTime");
     if(tmp1!=NULL){
       if(strncmp(tmp1->value,"text/js",7)==0 ||
-	 strncmp(tmp1->value,"application/json",16)==0)
+	 strncmp(tmp1->value,"application/json",7)==0)
         geometry=OGR_G_CreateGeometryFromJson(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");
+    else
+      geometry=createGeometryFromGML(conf,tmp->value);
     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){
-	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->content=createMap("value",OGR_G_ExportToJson(tmp->value));
+	addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
+	addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
       }
       else{
-	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);
+        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"));
       }
     }else{
-      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->content=createMap("value",OGR_G_ExportToJson(res));
+      addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
+      addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
     }
     outputs->next=NULL;
@@ -191,6 +178,4 @@
     else
       geometry=createGeometryFromGML(conf,tmp->value);
-    if(geometry==NULL)
-      return SERVICE_FAILED;
     res=(*myFunc)(geometry);
     fprintf(stderr,"Service internal print \n");
@@ -204,24 +189,21 @@
       if(strncmp(tmp_2->value,"text/js",7)==0 ||
 	 strncmp(tmp_2->value,"application/json",16)==0){
-	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);
+	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");
       }
       else{
-	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);
-
+	char *tres=OGR_G_ExportToGML(res);
+        addToMap(outputs->content,"value",tres);
+	free(tres);
       }
     }else{
-      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);
+      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");
     }
     outputs->next=NULL;
@@ -253,30 +235,16 @@
    else
      geometry=createGeometryFromGML(conf,tmp->value);
-   if(geometry==NULL){
-     setMapInMaps(conf,"lenv","message","Unable to parse input geometry");
-     return SERVICE_FAILED;
-   }
-   double bufferDistance;
+   int bufferDistance=1;
    tmp=getMapFromMaps(inputs,"BufferDistance","value");
-   if(tmp==NULL){
-     bufferDistance=atof("10.0");
-   }
-   else
-     bufferDistance=atof(tmp->value);
+   if(tmp!=NULL)
+		bufferDistance=atoi(tmp->value);
    res=OGR_G_Buffer(geometry,bufferDistance,30);
    tmp1=getMapFromMaps(outputs,"Result","mimeType");
    if(strncmp(tmp1->value,"application/json",16)==0){
-     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);
+		addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
+		addToMap(outputs->content,"mimeType","text/plain");
    }
    else{
-     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");
+		addToMap(outputs->content,"value",OGR_G_ExportToGML(res));
    }
    outputs->next=NULL;
@@ -286,4 +254,101 @@
 }
 
+/*  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)
@@ -322,9 +387,6 @@
 #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;
@@ -343,47 +405,26 @@
       	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
-      fprintf(stderr,"MY MAP \n[%s] - %i\n",tmp1->value,strncmp(tmp1->value,"application/json",16));
-      //dumpMap(tmp);
+#ifdef DEBUG
       fprintf(stderr,"MY MAP\n");
-      ///#endif
-      fprintf(stderr,"\nService internal print1 InputEntity2\n");
+      dumpMap(tmp1);
+      fprintf(stderr,"MY MAP\n");
+#endif
       if(tmp1!=NULL){
-        if(strncmp(tmp1->value,"application/json",16)==0){
-	  fprintf(stderr,"\nService internal print1 InputEntity2 as JSON\n");
+        if(strncmp(tmp1->value,"application/json",16)==0)
       	  geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
-	}
-	else{
-	  fprintf(stderr,"\nService internal print1 InputEntity2 as GML\n");
+	else
 	  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);
-    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);
+    addToMap(outputs->content,"value",OGR_G_ExportToJson(res));
+    addToMap(outputs->content,"mimeType","text/plain");
+    addToMap(outputs->content,"encoding","UTF-8");
+    outputs->next=NULL;
     OGR_G_DestroyGeometry(geometry1);
     OGR_G_DestroyGeometry(geometry2);
@@ -428,4 +469,5 @@
 #endif
     fflush(stderr);
+
     maps* cursor=inputs;
     OGRGeometryH geometry1,geometry2;
@@ -449,9 +491,4 @@
       	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");
@@ -472,14 +509,12 @@
       	geometry2=createGeometryFromGML(conf,tmp->value);
     }
-    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);    
+    res=OGR_G_Distance(geometry1,geometry2);
+    outputs=(maps*)malloc(sizeof(maps*));
+    outputs->name="Distance";
     char tmpres[100];
     sprintf(tmpres,"%d",res);
-    setMapInMaps(outputs,"Distance","value",tmpres);
-    setMapInMaps(outputs,"Distance","dataType","float");
+    outputs->content=createMap("value",tmpres);
+    addMapToMap(&outputs->content,createMap("datatype","float"));
+    outputs->next=NULL;
 #ifdef DEBUG
     dumpMaps(outputs);
@@ -496,28 +531,23 @@
     double res;
     /**
-     * Extract Geometry from the InputPolygon value
+     * Extract Geometry from the 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;
-    }
+    OGRGeometryH geometry1;
+    map* tmp=getMapFromMaps(inputs,"InputEntity1","value");
     fprintf(stderr,"geometry creation %s \n",tmp->value);
-    geometry=createGeometryFromGML(conf,tmp->value);
-    if(geometry==NULL){
-      setMapInMaps(conf,"lenv","message","Unable to parse input geometry from InputPolygon");
-      return SERVICE_FAILED;
-    }
+    geometry1=createGeometryFromGML(conf,tmp->value);
     fprintf(stderr,"geometry created %s \n",tmp->value);
-    res=OGR_G_GetArea(geometry);
+    res=OGR_G_GetArea(geometry1);
     fprintf(stderr,"area %d \n",res);
     /**
-     * Filling the outputs
+     * Creating the outputs
      */
+    outputs=(maps*)malloc(sizeof(maps*));
+    outputs->name="Area";
     char tmp1[100];
     sprintf(tmp1,"%d",res);
-    setMapInMaps(outputs,"Area","value",tmp1);
-    setMapInMaps(outputs,"Area","dataType","float");
+    outputs->content=createMap("value",tmp1);
+    addMapToMap(&outputs->content,createMap("datatype","float"));
+    outputs->next=NULL;
 #ifdef DEBUG
     dumpMaps(outputs);
