Index: trunk/zoo-project/zoo-kernel/Makefile.in
===================================================================
--- trunk/zoo-project/zoo-kernel/Makefile.in	(revision 966)
+++ trunk/zoo-project/zoo-kernel/Makefile.in	(revision 967)
@@ -4,5 +4,5 @@
 
 version.h: Makefile
-	echo "#define ZOO_VERSION \"1.7.0 `svnversion`\"" > version.h
+	echo "#define ZOO_VERSION \"1.8.0-rc1 `svnversion`\"" > version.h
 	echo "@ETC_DEF@" >> version.h
 	echo "#define LOCALEDIR \"@localedir@\"" >>  version.h
@@ -57,5 +57,5 @@
 
 response_print.o: response_print.c response_print.h
-	g++ -fPIC ${GDAL_CFLAGS} ${XML2CFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} ${HPC_ENABLED} -c response_print.c
+	g++ -fPIC ${JSON_CFLAGS} ${GDAL_CFLAGS} ${XML2CFLAGS} ${CFLAGS} ${JSCFLAGS} ${JS_ENABLED} ${HPC_ENABLED} -c response_print.c
 
 server_internal.o: server_internal.c server_internal.h service.h mimetypes.h
Index: trunk/zoo-project/zoo-kernel/ZOOMakefile.opts.in
===================================================================
--- trunk/zoo-project/zoo-kernel/ZOOMakefile.opts.in	(revision 966)
+++ trunk/zoo-project/zoo-kernel/ZOOMakefile.opts.in	(revision 967)
@@ -4,5 +4,5 @@
 INST_LIB=@libdir@
 INST_INCLUDE=@includedir@
-VERSION=1.5
+VERSION=1.8
 REVISION=0
 EXT=so
Index: trunk/zoo-project/zoo-kernel/configure.ac
===================================================================
--- trunk/zoo-project/zoo-kernel/configure.ac	(revision 966)
+++ trunk/zoo-project/zoo-kernel/configure.ac	(revision 967)
@@ -1,3 +1,3 @@
-AC_INIT([ZOO Kernel], [1.7.0], [bugs@zoo-project.org])
+AC_INIT([ZOO Kernel], [1.8.0-rc1], [bugs@zoo-project.org])
 
 AC_CONFIG_MACRO_DIR([macros])
@@ -1079,5 +1079,5 @@
 	WX_ISSUE="-D_WX_WXCRTVARARG_H_"
 	SAGA_DEFS="-D_SAGA_LINUX -D_TYPEDEF_BYTE -D_TYPEDEF_WORD -DMODULE_LIBRARY_PATH=\\\"$SAGAPATH/lib/saga\\\""
-	SAGA_CPPFLAGS="-DSAGA_VERSION=${SAGAVERS} -fPIC -I$SAGAPATH/include/saga/saga_core/saga_api/ `$WXCFG --unicode=yes --static=no --cxxflags` -D_SAGA_UNICODE $SAGA_DEFS $WX_ISSUE"
+	SAGA_CPPFLAGS="-DSAGA_VERSION=${SAGAVERS} -fPIC -I$SAGAPATH/include/saga/saga_core/saga_api/ -I$SAGAPATH/include/saga_api/ `$WXCFG --unicode=yes --static=no --cxxflags` -D_SAGA_UNICODE $SAGA_DEFS $WX_ISSUE"
 	SAGA_LDFLAGS="-fPIC `$WXCFG --unicode=yes --static=no --libs` -lsaga_api"
 	SAGA_ENABLED="-DUSE_SAGA"
Index: trunk/zoo-project/zoo-kernel/oas.cfg
===================================================================
--- trunk/zoo-project/zoo-kernel/oas.cfg	(revision 966)
+++ trunk/zoo-project/zoo-kernel/oas.cfg	(revision 967)
@@ -12,4 +12,5 @@
 wsUrl=wss://demo.mapmint.com:4430/
 publisherUrl=http://127.0.0.1/cgi-bin3/publish.py?jobid=
+io_as_array=true
 
 [/]
@@ -24,5 +25,5 @@
 tags=Home
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/LandingPage.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/LandingPage.yaml
 
 [/index.html]
@@ -53,5 +54,5 @@
 rel=conformance
 type=application/json
-title=WPS 2.0 REST/JSON Binding Extension conformance classes implemented by this server
+title=OGC API - Processes conformance classes implemented by this server
 
 [conformance]
@@ -61,5 +62,5 @@
 tags=Conformance
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ConformanceDeclaration.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ConformanceDeclaration.yaml
 
 [/conformance.html]
@@ -78,5 +79,5 @@
 tags=GetCapabilities
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ProcessList.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessList.yaml
 
 [/processes.html]
@@ -90,5 +91,5 @@
 tags=ProcessDescription
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ProcessDescription.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ProcessDescription.yaml
 ecode=404
 parameters=/components/parameters/id
@@ -107,5 +108,5 @@
 tags=JobList
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/JobList.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/JobList.yaml
 parameters=/components/parameters/id
 ecode=404,500
@@ -115,8 +116,8 @@
 tags_1=Execute Endpoint
 tags_description_1=
-schema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ExecuteSync.yaml
+schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteSync.yaml
 parameters_1=/components/parameters/id
 ecode_1=400,404,500
-eschema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ExecuteAsync.yaml
+eschema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ExecuteAsync.yaml
 ep=,/components/parameters/oas-header1
 
@@ -124,5 +125,5 @@
 abstract=Mandatory execute request in JSON format
 type=application/json
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/execute.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/execute.yaml
 
 [/processes/{id}/jobs/{jobID}]
@@ -138,5 +139,5 @@
 tags=GetStatus
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/Status.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml
 parameters=/components/parameters/id,/components/parameters/jobID
 method_1=delete
@@ -145,5 +146,5 @@
 tags_1=Dismiss
 tags_description_1=Cencel a job execution
-schema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/Status.yaml
+schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Status.yaml
 parameters_1=/components/parameters/id,/components/parameters/jobID
 ecode_1=404,500
@@ -161,5 +162,5 @@
 tags=GetResult
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/Results.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/Results.yaml
 parameters=/components/parameters/id,/components/parameters/jobID
 ecode=404,500
@@ -177,5 +178,5 @@
 tags=GetResult
 tags_description=
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/valueType.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/valueType.yaml
 parameters=/components/parameters/id,/components/parameters/jobID,/components/parameters/resultID
 ep=,/components/parameters/oas-header2
@@ -226,27 +227,27 @@
 abstract=Exception
 type=application/json
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/NotFound.yaml
-default_schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ServerError.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml
+default_schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml
 
 [responses]
 length=5
 code=404
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/NotFound.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotFound.yaml
 type=application/json
 title=NotFound
 code_1=500
-schema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/ServerError.yaml
+schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/ServerError.yaml
 type_1=application/json
 title_1=ServerError
 code_2=400
-schema_2=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/InvalidParameter.yaml
+schema_2=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/InvalidParameter.yaml
 type_2=appliction/json
 title_2=InvalidParameter
 code_3=405
-schema_3=https://github.com/opengeospatial/wps-rest-binding/blob/master/core/openapi/responses/NotAllowed.yaml
+schema_3=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/NotAllowed.yaml
 type_3=appliction/json
 title_3=NotAllowed
 code_4=406
-schema_4=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/responses/NotSupported.yaml
+schema_4=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/responses/NotSupported.yaml
 type_4=appliction/json
 title_4=NotSupported
@@ -256,15 +257,15 @@
 state=jobSuccess
 uri=successUri
-schema=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/result.yaml
+schema=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/result.yaml
 type=application/json
 title=Results received successfully
 state_1=jobInProgress
 uri_1=inProgressUri
-schema_1=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/statusInfo.yaml
+schema_1=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/statusInfo.yaml
 type_1=application/json
 title_1=Results received successfully
 state_2=jobFailed
 uri_2=failedUrii
-schema_2=https://raw.githubusercontent.com/opengeospatial/wps-rest-binding/master/core/openapi/schemas/exception.yaml
+schema_2=https://raw.githubusercontent.com/gfenoy/wps-rest-binding/change-request/95/core/openapi/schemas/exception.yaml
 type_2=application/json
 title_2=Exception received successfully
Index: trunk/zoo-project/zoo-kernel/request_parser.c
===================================================================
--- trunk/zoo-project/zoo-kernel/request_parser.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/request_parser.c	(revision 967)
@@ -1689,13 +1689,14 @@
 int validateRequest(maps** main_conf,service* s,map* original_request, maps** request_inputs,maps** request_outputs,HINTERNET* hInternet){
 
-  map* errI0=NULL;
-  runHttpRequests (main_conf, request_inputs, hInternet,&errI0);
-  if(errI0!=NULL){
-    printExceptionReportResponse (*main_conf, errI0);
+  if(hInternet!=NULL){
+    map* errI0=NULL;
+    runHttpRequests (main_conf, request_inputs, hInternet,&errI0);
+    if(errI0!=NULL){
+      printExceptionReportResponse (*main_conf, errI0);
+      InternetCloseHandle (hInternet);
+      return -1;
+    }
     InternetCloseHandle (hInternet);
-    return -1;
   }
-  InternetCloseHandle (hInternet);
-
 
   map* errI=NULL;
@@ -1720,5 +1721,5 @@
               addToMap (tmpe, "locator", ptr->name);
               addToMap (tmpe, "text", tmps);
-              printExceptionReportResponse (*main_conf, tmpe);
+	      printExceptionReportResponse (*main_conf, tmpe);
               freeMap (&tmpe);
               free (tmpe);
Index: trunk/zoo-project/zoo-kernel/response_print.c
===================================================================
--- trunk/zoo-project/zoo-kernel/response_print.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/response_print.c	(revision 967)
@@ -2,5 +2,5 @@
  * Author : Gérald FENOY
  *
- * Copyright (c) 2009-2015 GeoLabs SARL
+ * Copyright (c) 2009-2020 GeoLabs SARL
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -41,40 +41,41 @@
 
 #include "mimetypes.h"
+#include "service_json.h"
 
 /**
  * Add prefix to the service name.
  * 
- * @param conf the conf maps containing the main.cfg settings
- * @param level the map containing the level information
- * @param serv the service structure created from the zcfg file
- */
-void addPrefix(maps* conf,map* level,service* serv){
-  if(level!=NULL){
-    char key[25];
-    char* prefix=NULL;
-    int clevel=atoi(level->value);
-    int cl=0;
-    for(cl=0;cl<clevel;cl++){
-      sprintf(key,"sprefix_%d",cl);
-      map* tmp2=getMapFromMaps(conf,"lenv",key);
+ * @param pmsConf the conf maps containing the main.cfg settings
+ * @param pmLevel the map containing the level information
+ * @param psService the service structure created from the zcfg file
+ */
+void addPrefix(maps* pmsConf,map* pmLevel,service* psService){
+  if(pmLevel!=NULL){
+    char acKey[25];
+    char* pcaPrefix=NULL;
+    int iClevel=atoi(pmLevel->value);
+    int iCl=0;
+    for(iCl=0;iCl<iClevel;iCl++){
+      sprintf(acKey,"sprefix_%d",iCl);
+      map* tmp2=getMapFromMaps(pmsConf,"lenv",acKey);
       if(tmp2!=NULL){
-	if(prefix==NULL)
-	  prefix=zStrdup(tmp2->value);
+	if(pcaPrefix==NULL)
+	  pcaPrefix=zStrdup(tmp2->value);
 	else{
-	  int plen=strlen(prefix);
-	  prefix=(char*)realloc(prefix,(plen+strlen(tmp2->value)+2)*sizeof(char));
-	  memcpy(prefix+plen,tmp2->value,strlen(tmp2->value)*sizeof(char));
-	  prefix[plen+strlen(tmp2->value)]=0;
-	}
-      }
-    }
-    if(prefix!=NULL){
-      char* tmp0=zStrdup(serv->name);
-      free(serv->name);
-      serv->name=(char*)malloc((strlen(prefix)+strlen(tmp0)+1)*sizeof(char));
-      sprintf(serv->name,"%s%s",prefix,tmp0);
-      free(tmp0);
-      free(prefix);
-      prefix=NULL;
+	  int plen=strlen(pcaPrefix);
+	  pcaPrefix=(char*)realloc(pcaPrefix,(plen+strlen(tmp2->value)+2)*sizeof(char));
+	  memcpy(pcaPrefix+plen,tmp2->value,strlen(tmp2->value)*sizeof(char));
+	  pcaPrefix[plen+strlen(tmp2->value)]=0;
+	}
+      }
+    }
+    if(pcaPrefix!=NULL){
+      char* pcaTmp=zStrdup(psService->name);
+      free(psService->name);
+      psService->name=(char*)malloc((strlen(pcaPrefix)+strlen(pcaTmp)+1)*sizeof(char));
+      sprintf(psService->name,"%s%s",pcaPrefix,pcaTmp);
+      free(pcaTmp);
+      free(pcaPrefix);
+      pcaPrefix=NULL;
     }
   }
@@ -84,16 +85,16 @@
  * Print the HTTP headers based on a map.
  * 
- * @param m the map containing the headers information
- */
-void printHeaders(maps* m){
-  maps *_tmp=getMaps(m,"headers");
-  if(_tmp!=NULL){
-    map* _tmp1=_tmp->content;
-    while(_tmp1!=NULL){
-      printf("%s: %s\r\n",_tmp1->name,_tmp1->value);
-      _tmp1=_tmp1->next;
-    }
-  }
-  printSessionHeaders(m);
+ * @param pmsConf the map containing the headers information
+ */
+void printHeaders(maps* pmsConf){
+  maps *pmsTmp=getMaps(pmsConf,"headers");
+  if(pmsTmp!=NULL){
+    map* pmTmp=pmsTmp->content;
+    while(pmTmp!=NULL){
+      printf("%s: %s\r\n",pmTmp->name,pmTmp->value);
+      pmTmp=pmTmp->next;
+    }
+  }
+  printSessionHeaders(pmsConf);
 }
 
@@ -104,34 +105,33 @@
  * The session file (sess_<SESSID>_.cfg where <SESSID> is the cookie value) is
  * stored in the conf["main"]["tmpPath"] directory.
- * @param m the main configuration map
- */
-void printSessionHeaders(maps* m){
-  maps* tmpSess=getMaps(m,"senv");
-  if(tmpSess!=NULL){
-    map *_tmp=getMapFromMaps(m,"lenv","cookie");
-    maps *tmps=getMaps(m,"senv");
+ * @param pmsConf the main configuration map
+ */
+void printSessionHeaders(maps* pmsConf){
+  maps* pmsSess=getMaps(pmsConf,"senv");
+  if(pmsSess!=NULL){
+    map *pmTmp=getMapFromMaps(pmsConf,"lenv","cookie");
     char* sessId=NULL;
-    if(_tmp!=NULL){
-      printf("Set-Cookie: %s; HttpOnly\r\n",_tmp->value);
-      map *_tmp1=getMapFromMaps(m,"senv","ecookie_length");
-      if(_tmp1!=NULL){
-        int len=atoi(_tmp1->value);
+    if(pmTmp!=NULL){
+      printf("Set-Cookie: %s; HttpOnly\r\n",pmTmp->value);
+      map *pmTmp1=getMapFromMaps(pmsConf,"senv","ecookie_length");
+      if(pmTmp1!=NULL){
+        int len=atoi(pmTmp1->value);
         int cnt=0;
         for(cnt=0;cnt<len;cnt++){
-          map* _tmp2=getMapArray(tmps->content,"ecookie",cnt);
-          if(_tmp2!=NULL)
-            printf("Set-Cookie: %s; HttpOnly\r\n",_tmp2->value);
+          map* pmTmp2=getMapArray(pmsSess->content,"ecookie",cnt);
+          if(pmTmp2!=NULL)
+            printf("Set-Cookie: %s; HttpOnly\r\n",pmTmp2->value);
         }
       }
       printf("P3P: CP=\"IDC DSP COR ADM DEVi TAIi PSA PSD IVAi IVDi CONi HIS OUR IND CNT\"\r\n");
       char session_file_path[100];
-      char *tmp1=strtok(_tmp->value,";");
+      char *tmp1=strtok(pmTmp->value,";");
       if(tmp1!=NULL)
         sprintf(session_file_path,"%s",strstr(tmp1,"=")+1);
       else
-        sprintf(session_file_path,"%s",strstr(_tmp->value,"=")+1);
+        sprintf(session_file_path,"%s",strstr(pmTmp->value,"=")+1);
       sessId=zStrdup(session_file_path);
     }else{
-      maps* t=getMaps(m,"senv");
+      maps* t=getMaps(pmsConf,"senv");
       map*p=t->content;
       while(p!=NULL){
@@ -144,7 +144,7 @@
     }
     char session_file_path[1024];
-    map *tmpPath=getMapFromMaps(m,"main","sessPath");
+    map *tmpPath=getMapFromMaps(pmsConf,"main","sessPath");
     if(tmpPath==NULL)
-      tmpPath=getMapFromMaps(m,"main","tmpPath");
+      tmpPath=getMapFromMaps(pmsConf,"main","tmpPath");
     sprintf(session_file_path,"%s/sess_%s.cfg",tmpPath->value,sessId);
     FILE* teste=fopen(session_file_path,"w");
@@ -152,10 +152,10 @@
       char tmpMsg[1024];
       sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the session maps."),session_file_path);
-      errorException(m,tmpMsg,"InternalError",NULL);
+      errorException(pmsConf,tmpMsg,"InternalError",NULL);
       return;
     }
     else{
       fclose(teste);
-      dumpMapsToFile(tmpSess,session_file_path,1);
+      dumpMapsToFile(pmsSess,session_file_path,1);
     }
   }  
@@ -2096,5 +2096,5 @@
 	    if(vid==0)
 	      printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
-	    else
+	    else 
 	      printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
 	  }	
@@ -2535,4 +2535,30 @@
 
 /**
+ * Produce the status string used in HTTP headers.
+ * 
+ * @param pmConf the maps containing the settings of the main.cfg file
+ * @param pmCode the map containing the error code (or a map array of the same keys)
+ */
+const char* produceStatusString(maps* pmConf,map* pmCode){
+  if(pmCode!=NULL){
+    int iI=0;
+    for(iI=0;iI<3;iI++){
+      int iJ=0;
+      for(iJ=0;;iJ++){
+	if(aapccStatusCodes[iI][iJ]==NULL)
+	  break;
+	else{
+	  if(strcmp(aapccStatusCodes[iI][iJ],pmCode->value)==0)
+	    return aapccStatusCodes[iI][0];
+	}
+      }
+    }
+  }
+  else{
+    return aapccStatusCodes[3][0];
+  }
+}
+
+/**
  * Print an OWS ExceptionReport Document and HTTP headers (when required) 
  * depending on the code.
@@ -2542,7 +2568,5 @@
  * @param s the map containing the text,code,locator keys (or a map array of the same keys)
  */
-void printExceptionReportResponse(maps* m,map* s){
-  if(getMapFromMaps(m,"lenv","hasPrinted")!=NULL)
-    return;
+void _printExceptionReportResponse(maps* m,map* s){
   int buffersize;
   xmlDocPtr doc;
@@ -2557,20 +2581,5 @@
   
   map* tmp=getMap(s,"code");
-  if(tmp!=NULL){
-    if(strcmp(tmp->value,"OperationNotSupported")==0 ||
-       strcmp(tmp->value,"NoApplicableCode")==0)
-      exceptionCode="501 Not Implemented";
-    else
-      if(strcmp(tmp->value,"MissingParameterValue")==0 ||
-	 strcmp(tmp->value,"InvalidUpdateSequence")==0 ||
-	 strcmp(tmp->value,"OptionNotSupported")==0 ||
-	 strcmp(tmp->value,"VersionNegotiationFailed")==0 ||
-	 strcmp(tmp->value,"InvalidParameterValue")==0)
-	exceptionCode="400 Bad request";
-      else
-	exceptionCode="501 Internal Server Error";
-  }
-  else
-    exceptionCode="501 Internal Server Error";
+  exceptionCode=produceStatusString(m,tmp);
   tmp=getMapFromMaps(m,"lenv","status_code");
   if(tmp!=NULL)
@@ -2601,5 +2610,22 @@
   zooXmlCleanupNs();
   if(m!=NULL)
-    setMapInMaps(m,"lenv","hasPrinted","true");
+    setMapInMaps(m,"lenv","hasPrinted","true");  
+}
+
+/**
+ * Print an OWS ExceptionReport or exception.yaml Document and HTTP headers
+ * (when required) depending on the code.
+ * 
+ * @param pmsConf the maps containing the settings of the main.cfg file
+ * @param psService the service
+ */
+void printExceptionReportResponse(maps* pmsConf,map* psService){
+  if(getMapFromMaps(pmsConf,"lenv","hasPrinted")!=NULL)
+    return;
+  map* pmExecutionType=getMapFromMaps(pmsConf,"main","executionType");
+  if(pmExecutionType!=NULL && strncasecmp(pmExecutionType->value,"xml",3)==0)
+    _printExceptionReportResponse(pmsConf,psService);
+  else
+    printExceptionReportResponseJ(pmsConf,psService);
 }
 
@@ -2694,4 +2720,5 @@
 int errorException(maps *m, const char *message, const char *errorcode, const char *locator) 
 {
+  map* pmExectionType=getMapFromMaps(m,"main","executionType");
   map* errormap = createMap("text", message);
   addToMap(errormap,"code", errorcode);
@@ -2700,8 +2727,112 @@
   else
     addToMap(errormap,"locator", "NULL");
-  printExceptionReportResponse(m,errormap);
+  if(pmExectionType!=NULL && strncasecmp(pmExectionType->value,"xml",3)==0)
+    printExceptionReportResponse(m,errormap);
+  else{
+    printExceptionReportResponseJ(m,errormap);
+    setMapInMaps(m,"lenv","no-headers","true");
+  }
   freeMap(&errormap);
   free(errormap);
   return -1;
+}
+
+/**
+ * Produce a copy file and the corresponding url in case it is required
+ * Please, free the returned ressource while used
+ *
+ * @param pmConf maps* pointing to the main configuration file
+ */
+char* produceFileUrl(service* psService,maps* pmsConf,maps* pmsOutputs,const char* pccFormat, int itn){
+  // Create file for reference data if not existing
+  map *pmGFile=getMap(pmsOutputs->content,"generated_file");
+  map *pmTmpPath=getMapFromMaps(pmsConf,"main","tmpPath");
+  map *pmTmpUrl=getMapFromMaps(pmsConf,"main","tmpUrl");
+  char *pcaFileName=NULL;
+  char *pcaFilePath=NULL;
+  char *pcaFileUrl=NULL;
+  if(pmGFile!=NULL){
+    pmGFile=getMap(pmsOutputs->content,"expected_generated_file");
+    if(pmGFile==NULL){
+      pmGFile=getMap(pmsOutputs->content,"generated_file");
+    }
+    if(strstr(pmGFile->value,pmTmpPath->value)!=NULL)
+      pcaFileName=zStrdup(strstr(pmGFile->value,pmTmpPath->value)+strlen(pmTmpPath->value));
+  }
+  // Create file for reference data
+  map *pmUsid=getMapFromMaps(pmsConf,"lenv","usid");
+  map *pmExt=getMap(pmsOutputs->content,"extension");
+  if(pmGFile==NULL){
+    char acFileExt[32];	    
+    if( pmExt != NULL && pmExt->value != NULL) {
+      strncpy(acFileExt, pmExt->value, 32);
+    }
+    else {
+      // Obtain default file extension (see mimetypes.h).	      
+      // If the MIME type is not recognized, txt is used as the default extension
+      map* pmType=getMap(pmsOutputs->content,"mimeType");
+      getFileExtension(pmType != NULL ? pmType->value : NULL, acFileExt, 32);
+    }
+    if(pcaFileName!=NULL)
+      free(pcaFileName);
+	      
+    pcaFileName=(char*)malloc((strlen(psService->name)+strlen(pmUsid->value)+strlen(acFileExt)+strlen(pmsOutputs->name)+45)*sizeof(char));
+    sprintf(pcaFileName,"ZOO_DATA_%s_%s_%s_%d.%s",psService->name,pmsOutputs->name,pmUsid->value,itn,acFileExt);
+
+    pcaFilePath=(char*)malloc((strlen(pmTmpPath->value)+strlen(pcaFileName)+2)*sizeof(char));
+    sprintf(pcaFilePath,"%s/%s",pmTmpPath->value,pcaFileName);
+  }else{
+    pcaFilePath=(char*)malloc((strlen(pmGFile->value)+1)*sizeof(char));
+    sprintf(pcaFilePath,"%s",pmGFile->value);
+  }
+  
+  pcaFileUrl=(char*)malloc((strlen(pmTmpUrl->value)+
+			  strlen(pcaFileName)+2)*sizeof(char));
+  sprintf(pcaFileUrl,"%s/%s",pmTmpUrl->value,pcaFileName);
+
+  if(pmGFile==NULL) {
+    FILE *pfOfile=fopen(pcaFilePath,"wb");
+    if(pfOfile==NULL){
+      char acTmpMsg[1024];
+      sprintf(acTmpMsg,
+	      _("Unable to create the file \"%s\" for storing the %s final result."),
+	      pcaFileName,pmsOutputs->name);
+      map* pmError=createMap("code","InternalError");
+      addToMap(pmError,"message",acTmpMsg);
+      printExceptionReportResponseJ(pmsConf,pmError);
+      free(pcaFileName);
+      free(pcaFilePath);
+      return NULL;
+    }
+
+    map* pmValue=getMap(pmsOutputs->content,"value");
+    if(pmValue==NULL){
+      char acTmpMsg[1024];
+      sprintf(acTmpMsg,
+	      _("No value found for the requested output %s."),
+	      pmsOutputs->name);
+      map* pmError=createMap("code","InternalError");
+      addToMap(pmError,"message",acTmpMsg);
+      printExceptionReportResponseJ(pmsConf,pmError);
+      fclose(pfOfile);
+      free(pcaFileName);
+      free(pcaFilePath);
+      return NULL;
+    }
+    if(pccFormat==NULL || strcasecmp(pccFormat,"BoundingBoxData")!=0){
+      map* size=getMap(pmsOutputs->content,"size");
+      if(size!=NULL && pmValue!=NULL)
+	fwrite(pmValue->value,1,(atoi(size->value))*sizeof(char),pfOfile);
+      else
+	if(pmValue!=NULL && pmValue->value!=NULL)
+	  fwrite(pmValue->value,1,
+		 strlen(pmValue->value)*sizeof(char),pfOfile);
+    }else
+      printBoundingBoxDocument(pmsConf,pmsOutputs,pfOfile);
+    fclose(pfOfile);
+  }
+  free(pcaFileName);
+  free(pcaFilePath);
+  return pcaFileUrl;
 }
 
@@ -2724,7 +2855,7 @@
   fprintf(stderr,"printProcessResponse\n");
 #endif  
-  map* toto=getMap(request_inputs1,"RawDataOutput");
+  map* pmRawData=getMap(request_inputs1,"RawDataOutput");
   int asRaw=0;
-  if(toto!=NULL)
+  if(pmRawData!=NULL)
     asRaw=1;
   map* version=getMapFromMaps(m,"main","rversion");
@@ -2776,5 +2907,5 @@
       map* testMap=getMap(tmpI->content,"useMapserver");	
 #endif
-      map *gfile=getMap(tmpI->content,"generated_file");
+      /*map *gfile=getMap(tmpI->content,"generated_file");
       char *file_name=NULL;	  
       if(gfile!=NULL){
@@ -2785,14 +2916,15 @@
 	readGeneratedFile(m,tmpI->content,gfile->value);
 	file_name=zStrdup((gfile->value)+strlen(tmp1->value));
-      }	  
-      toto=getMap(tmpI->content,"asReference");
+	}*/
+      char *pcaFileUrl=NULL;
+      pmRawData=getMap(tmpI->content,"asReference");
 #ifdef USE_MS
       map* geodatatype=getMap(tmpI->content,"geodatatype");
-      if(toto!=NULL && strcasecmp(toto->value,"true")==0 &&
+      if(pmRawData!=NULL && strcasecmp(pmRawData->value,"true")==0 &&
 	 (testMap==NULL ||
 	  strncasecmp(testMap->value,"true",4)!=0 ||
 	  (geodatatype!=NULL && strcasecmp(geodatatype->value,"other")==0) ) ) 
 #else
-	if(toto!=NULL && strcasecmp(toto->value,"true")==0)
+	if(pmRawData!=NULL && strcasecmp(pmRawData->value,"true")==0)
 #endif
 	  {		
@@ -2811,77 +2943,10 @@
 	      addToMap(tmpI->content,"encoding","UTF-8");
 	      addToMap(tmpI->content,"schema","http://schemas.opengis.net/ows/1.1.0/owsCommon.xsd");
-	    }		
-	    char *file_path=NULL;
-	    if(gfile==NULL) {
-	      map *ext=getMap(tmpI->content,"extension");
-	      char file_ext[32];
-	    
-	      if( ext != NULL && ext->value != NULL) {
-		strncpy(file_ext, ext->value, 32);
-	      }
-	      else {
-		// Obtain default file extension (see mimetypes.h).	      
-		// If the MIME type is not recognized, txt is used as the default extension
-		map* mtype=getMap(tmpI->content,"mimeType");
-		getFileExtension(mtype != NULL ? mtype->value : NULL, file_ext, 32);
-	      }
-	      if(file_name!=NULL)
-		free(file_name);
-	      file_name=(char*)malloc((strlen(s->name)+strlen(usid->value)+strlen(file_ext)+strlen(tmpI->name)+45)*sizeof(char));
-	      sprintf(file_name,"ZOO_DATA_%s_%s_%s_%d.%s",s->name,tmpI->name,usid->value,itn,file_ext);
-	      itn++;
-	      file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char));
-	      sprintf(file_path,"%s/%s",tmp1->value,file_name);
-
-	      FILE *ofile=fopen(file_path,"wb");
-	      if(ofile==NULL){
-		char tmpMsg[1024];
-		sprintf(tmpMsg,_("Unable to create the file \"%s\" for storing the %s final result."),file_name,tmpI->name);
-		errorException(m,tmpMsg,"InternalError",NULL);
-		free(file_name);
-		free(file_path);
-		return;
-	      }
-
-	      toto=getMap(tmpI->content,"value");
-	      if(toto==NULL){
-		char tmpMsg[1024];
-		sprintf(tmpMsg,_("No value found for the requested output %s."),tmpI->name);
-		errorException(m,tmpMsg,"InternalError",NULL);
-		fclose(ofile);
-		free(file_name);
-		free(file_path);
-		return;
-	      }
-	      if(strcasecmp(format,"BoundingBoxData")!=0){
-		map* size=getMap(tmpI->content,"size");
-		if(size!=NULL && toto!=NULL)
-		  fwrite(toto->value,1,(atoi(size->value))*sizeof(char),ofile);
-		else
-		  if(toto!=NULL && toto->value!=NULL)
-		    fwrite(toto->value,1,strlen(toto->value)*sizeof(char),ofile);
-	      }else{
-		printBoundingBoxDocument(m,tmpI,ofile);
-	      }
-	      fclose(ofile);
 	    }
-
-	    map *tmp2=getMapFromMaps(m,"main","tmpUrl");
-	    map *tmp3=getMapFromMaps(m,"main","serverAddress");
-	    char *file_url=NULL;
-	    if(strncasecmp(tmp2->value,"http://",7)==0 ||
-	       strncasecmp(tmp2->value,"https://",8)==0){
-	      file_url=(char*)malloc((strlen(tmp2->value)+strlen(file_name)+2)*sizeof(char));
-	      sprintf(file_url,"%s/%s",tmp2->value,file_name);
-	    }else{
-	      file_url=(char*)malloc((strlen(tmp3->value)+strlen(tmp2->value)+strlen(file_name)+3)*sizeof(char));
-	      sprintf(file_url,"%s/%s/%s",tmp3->value,tmp2->value,file_name);
-	    }
-	    addToMap(tmpI->content,"Reference",file_url);
-	    if(file_name!=NULL)
-	      free(file_name);
-	    if(file_url!=NULL)
-	      free(file_url);
-	    file_name=NULL;
+	    pcaFileUrl=produceFileUrl(s,m,tmpI,format,itn);
+	    itn++;
+	    if(pcaFileUrl==NULL)
+	      return;
+	    addToMap(tmpI->content,"Reference",pcaFileUrl);
 	  }
 #ifdef USE_MS
@@ -2901,7 +2966,7 @@
 	}
 #endif	
-      if(file_name!=NULL){
-	free(file_name);
-	file_name=NULL;
+      if(pcaFileUrl!=NULL){
+	free(pcaFileUrl);
+	pcaFileUrl=NULL;
       }
       tmpI=tmpI->next;
@@ -2947,55 +3012,63 @@
       printBoundingBoxDocument(m,tmpI,NULL);
     }else{
-      map *gfile=getMap(tmpI->content,"generated_file");
-      if(gfile!=NULL){
-	gfile=getMap(tmpI->content,"expected_generated_file");	
-	if(gfile==NULL){
-	  gfile=getMap(tmpI->content,"generated_file");
-	}
-	readGeneratedFile(m,tmpI->content,gfile->value);
-      }
-      toto=getMap(tmpI->content,"value");	 
-      if(toto==NULL){
-	char tmpMsg[1024];
-	sprintf(tmpMsg,_("Wrong RawDataOutput parameter: unable to fetch any result for the given parameter name: \"%s\"."),tmpI->name);
-	errorException(m,tmpMsg,"InvalidParameterValue","RawDataOutput");
-	return;
-      }	  
-      map* fname=getMapFromMaps(tmpI,tmpI->name,"filename");	  	  
-      if(fname!=NULL)
-	printf("Content-Disposition: attachment; filename=\"%s\"\r\n",fname->value);
-      map* rs=getMapFromMaps(tmpI,tmpI->name,"size");
-      if(rs!=NULL)
-	printf("Content-Length: %s\r\n",rs->value);
-      printHeaders(m);
-      char mime[1024];
-      map* mi=getMap(tmpI->content,"mimeType");
-#ifdef DEBUG
-      fprintf(stderr,"SERVICE OUTPUTS\n");
-      dumpMaps(request_outputs);
-      fprintf(stderr,"SERVICE OUTPUTS\n");
-#endif
-      map* en=getMap(tmpI->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=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);
-      if(rs!=NULL)
-	fwrite(toto->value,1,atoi(rs->value),stdout);
-      else
-	fwrite(toto->value,1,strlen(toto->value),stdout);
-#ifdef DEBUG
-      dumpMap(toto);
-#endif
-    }
-  }
+      printRawdataOutput(m,tmpI);
+    }
+  }
+}
+
+/**
+ * Print one outputs as raw
+ * 
+ * @param conf the main configuration maps
+ * @param outputs the output to be print as raw
+ */
+void* printRawdataOutput(maps* conf,maps* outputs){
+  map *gfile=getMap(outputs->content,"generated_file");
+  if(gfile!=NULL){
+    gfile=getMap(outputs->content,"expected_generated_file");
+    if(gfile==NULL){
+      gfile=getMap(outputs->content,"generated_file");
+    }
+    readGeneratedFile(conf,outputs->content,gfile->value);
+  }
+  map* toto=getMap(outputs->content,"value");
+  if(toto==NULL){
+    char tmpMsg[1024];
+    sprintf(tmpMsg,_("Wrong RawDataOutput parameter: unable to fetch any result for the given parameter name: \"%s\"."),outputs->name);
+    map* pmExecutionType=getMapFromMaps(conf,"main","executionType");
+    if(pmExecutionType!=NULL && strncasecmp(pmExecutionType->value,"xml",3)==0)
+      errorException(conf,tmpMsg,"InvalidParameterValue","RawDataOutput");
+    else{
+      setMapInMaps(conf,"lenv","error","true");
+      setMapInMaps(conf,"lenv","code","InvalidParameterValue");
+      setMapInMaps(conf,"lenv","message",tmpMsg);
+    }
+    return NULL;
+  }
+  map* fname=getMapFromMaps(outputs,outputs->name,"filename");	  	  
+  if(fname!=NULL)
+    printf("Content-Disposition: attachment; filename=\"%s\"\r\n",fname->value);
+  map* rs=getMapFromMaps(outputs,outputs->name,"size");
+  if(rs!=NULL)
+    printf("Content-Length: %s\r\n",rs->value);
+  char mime[1024];
+  map* mi=getMap(outputs->content,"mimeType");
+  map* en=getMap(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=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);
+  if(rs!=NULL)
+    fwrite(toto->value,1,atoi(rs->value),stdout);
+  else
+    fwrite(toto->value,1,strlen(toto->value),stdout);	
 }
 
Index: trunk/zoo-project/zoo-kernel/response_print.h
===================================================================
--- trunk/zoo-project/zoo-kernel/response_print.h	(revision 966)
+++ trunk/zoo-project/zoo-kernel/response_print.h	(revision 967)
@@ -194,4 +194,36 @@
   };
 
+
+  static const char* const aapccStatusCodes[][8] = {
+    {
+      "500 Not Implemented",
+      "OperationNotSupported",
+      "NoApplicableCode",
+      NULL
+    },
+    {
+      "400 Bad request",
+      "MissingParameterValue"
+      "InvalidParameterValue",
+      "InvalidUpdateSequence",
+      "OptionNotSupported",
+      "VersionNegotiationFailed",
+      "NoSuchMode",
+      NULL
+    },
+    {
+      "404 Not Found",
+      "NotFound",
+      "NoSuchProcess",
+      "NoSuchJob",
+      "ResultNotReady",
+      NULL
+    },
+    {
+      "500 Not Implemented",
+      NULL
+    }
+  };
+  
   void addLangAttr(xmlNodePtr,maps*);
 
@@ -205,5 +237,6 @@
   int zooXmlAddDoc(xmlNodePtr,const char*,const char*);
   void zooXmlCleanupDocs();
-  
+
+  const char* produceStatusString(maps*,map*);
   void printExceptionReportResponse(maps*,map*);
   xmlNodePtr createExceptionReportNode(maps*,map*,int);
@@ -217,4 +250,5 @@
   void printDescription(xmlNodePtr,xmlNsPtr,const char*,map*,int);
   void printIOType(xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,xmlNsPtr,elements*,maps*,const char*,int);
+  void* printRawdataOutput(maps*,maps*);
   map* parseBoundingBox(const char*);
   void printBoundingBox(xmlNsPtr,xmlNodePtr,map*);
@@ -225,4 +259,5 @@
   void addMetadata(map*,xmlDocPtr,xmlNodePtr,xmlNsPtr,xmlNsPtr,int);
 
+  char* produceFileUrl(service*,maps*,maps*,const char*, int);
   void outputResponse(service*,maps*,maps*,map*,int,maps*,int);
 
Index: trunk/zoo-project/zoo-kernel/server_internal.c
===================================================================
--- trunk/zoo-project/zoo-kernel/server_internal.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/server_internal.c	(revision 967)
@@ -377,20 +377,17 @@
   sprintf(rsize,"%lld",f_status.st_size);
   if(getMap(content,"storage")==NULL){
-    map* memUse=getMapFromMaps(m,"main","memory");
-    if(memUse==NULL || strncmp(memUse->value,"load",4)==0){
-      map* tmpMap1=getMap(content,"value");
-      if(tmpMap1==NULL){
-	addToMap(content,"value","");
-	tmpMap1=getMap(content,"value");
-      }
-      free(tmpMap1->value);
-      tmpMap1->value=(char*) malloc((f_status.st_size+1)*sizeof(char));
-      if(tmpMap1->value==NULL){
-	setMapInMaps(m,"lenv","message","Unable to allocate the memory required to read the produced file.");
-	return;
-      }
-      fread(&tmpMap1->value,1,f_status.st_size,file);
-      tmpMap1->value[f_status.st_size]=0;
-    }
+    map* tmpMap1=getMap(content,"value");
+    if(tmpMap1==NULL){
+      addToMap(content,"value","");
+      tmpMap1=getMap(content,"value");
+    }
+    free(tmpMap1->value);
+    tmpMap1->value=(char*) malloc((f_status.st_size+1)*sizeof(char));
+    if(tmpMap1->value==NULL){
+      setMapInMaps(m,"lenv","message","Unable to allocate the memory required to read the produced file.");
+      return;
+    }
+    fread(tmpMap1->value,1,f_status.st_size,file);
+    tmpMap1->value[f_status.st_size]=0;
   }
   fclose(file);
@@ -994,5 +991,5 @@
 void runGetStatus(maps* conf,char* pid,char* req){
   map* r_inputs = getMapFromMaps (conf, "main", "tmpPath");
-  map* e_type = getMapFromMaps (conf, "lenv", "executionType");
+  map* e_type = getMapFromMaps (conf, "main", "executionType");
   char *sid=getStatusId(conf,pid);
   if(sid==NULL){
@@ -1101,5 +1098,5 @@
 void runDismiss(maps* conf,char* pid){
   map* r_inputs = getMapFromMaps (conf, "main", "tmpPath");
-  map* e_type = getMapFromMaps (conf, "lenv", "executionType");
+  map* e_type = getMapFromMaps (conf, "main", "executionType");
   char *sid=getStatusId(conf,pid);
   if(sid==NULL){
Index: trunk/zoo-project/zoo-kernel/service.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/service.c	(revision 967)
@@ -39,11 +39,11 @@
  * See https://dxr.mozilla.org/mozilla-central/source/media/mtransport/third_party/nrappkit/src/util/util.c
  */
-int snprintf(char *buffer, size_t n, const char *format, ...)
+int snprintf(char *pcBuffer, size_t n, const char *pccFormat, ...)
 {
   va_list argp;
   int ret;
-  va_start(argp, format);
-  ret = _vscprintf(format, argp);
-  vsnprintf_s(buffer, n, _TRUNCATE, format, argp);
+  va_start(argp, pccFormat);
+  ret = _vscprintf(pccFormat, argp);
+  vsnprintf_s(pcBuffer, n, _TRUNCATE, pccFormat, argp);
   va_end(argp);
   return ret;
@@ -54,9 +54,9 @@
  * Dump a map on stderr
  *
- * @param t the map to dump
- */
-void _dumpMap(map* t){
-  if(t!=NULL){
-    fprintf(stderr,"%s: %s\n",t->name,t->value);
+ * @param pmMap the map to dump
+ */
+void _dumpMap(map* pmMap){
+  if(pmMap!=NULL){
+    fprintf(stderr,"%s: %s\n",pmMap->name,pmMap->value);
     fflush(stderr);
   }else{
@@ -69,11 +69,11 @@
  * Dump a map on stderr, see _dumpMap()
  *
- * @param t the map to dump
- */
-void dumpMap(map* t){
-  map* tmp=t;
-  while(tmp!=NULL){
-    _dumpMap(tmp);
-    tmp=tmp->next;
+ * @param pmMap the map to dump
+ */
+void dumpMap(map* pmMap){
+  map* pmTmp=pmMap;
+  while(pmTmp!=NULL){
+    _dumpMap(pmTmp);
+    pmTmp=pmTmp->next;
   }
 }
@@ -82,12 +82,12 @@
  * Dump a map to a file 
  *
- * @param t the map to dump to file
- * @param file the file pointer to store the map
- */
-void dumpMapToFile(map* t,FILE* file){
-  map* tmp=t;
-  while(tmp!=NULL){
-    fprintf(file,"%s = %s\n",tmp->name,tmp->value);
-    tmp=tmp->next;
+ * @param pmMap the map to dump to file
+ * @param pfFile the file pointer to store the map
+ */
+void dumpMapToFile(map* pmMap,FILE* pfFile){
+  map* pmTmp=pmMap;
+  while(pmTmp!=NULL){
+    fprintf(pfFile,"%s = %s\n",pmTmp->name,pmTmp->value);
+    pmTmp=pmTmp->next;
   }
 }
@@ -96,18 +96,18 @@
  * Dump a maps on stderr, see dumpMap().
  *
- * @param m the map to dump
- */
-void dumpMaps(maps* m){
-  maps* tmp=m;
-  while(tmp!=NULL){
-    fprintf(stderr,"MAP => [%s] \n",tmp->name);
-    fprintf(stderr," * CONTENT [%s] \n",tmp->name);
-    dumpMap(tmp->content);
-    if(tmp->child!=NULL){
-      fprintf(stderr," * CHILD [%s] \n",tmp->name);
-      dumpMaps(tmp->child);
-      fprintf(stderr," * /CHILD [%s] \n",tmp->name);
-    }
-    tmp=tmp->next;
+ * @param pmMap the map to dump
+ */
+void dumpMaps(maps* pmMap){
+  maps* pmTmp=pmMap;
+  while(pmTmp!=NULL){
+    fprintf(stderr,"MAP => [%s] \n",pmTmp->name);
+    fprintf(stderr," * CONTENT [%s] \n",pmTmp->name);
+    dumpMap(pmTmp->content);
+    if(pmTmp->child!=NULL){
+      fprintf(stderr," * CHILD [%s] \n",pmTmp->name);
+      dumpMaps(pmTmp->child);
+      fprintf(stderr," * /CHILD [%s] \n",pmTmp->name);
+    }
+    pmTmp=pmTmp->next;
   }
 }
@@ -116,23 +116,24 @@
  * Dump a maps to a file, see dumpMapToFile().
  *
- * @param m the map to dump
- * @param file the the file pointer to store the map
- */
-void _dumpMapsToFile(maps* m,FILE* file,int limit){
-  maps* tmp=m;
+ * @param pmsMaps the map to dump
+ * @param psFile the the file pointer to store the map
+ * @param iLimit the number of maps to print (0 for no limit)
+ */
+void _dumpMapsToFile(maps* pmsMaps,FILE* psFile,int iLimit){
+  maps* tmp=pmsMaps;
   int cnt=0;
   while(tmp!=NULL){
-    fprintf(file,"[%s]\n",tmp->name);
+    fprintf(psFile,"[%s]\n",tmp->name);
     if(tmp->child!=NULL){
-      _dumpMapsToFile(tmp->child,file,limit);
+      _dumpMapsToFile(tmp->child,psFile,iLimit);
     }else
-      dumpMapToFile(tmp->content,file);
-    fflush(file);
+      dumpMapToFile(tmp->content,psFile);
+    fflush(psFile);
     tmp=tmp->next;
     cnt++;
-    if(limit>=0 && cnt==limit)
+    if(iLimit>=0 && cnt==iLimit)
       tmp=NULL;
   }
-  fflush(file);
+  fflush(psFile);
 }
 
@@ -140,13 +141,13 @@
  * Dump a maps to a file, see _dumpMapsToFile().
  *
- * @param m the map to dump
- * @param file_path the full path to the file name to store the map
- * @param limit the number limiting the maps to be dumped
- */
-void dumpMapsToFile(maps* m,char* file_path,int limit){
-  FILE* file=fopen(file_path,"w+");
-  _dumpMapsToFile(m,file,limit);
-  fflush(file);
-  fclose(file);
+ * @param pmsMaps the map to dump
+ * @param pcaFilePath the the file pointer to store the map
+ * @param iLimit the number of maps to print (0 for no limit)
+ */
+void dumpMapsToFile(maps* pmsMaps,char* pcaFilePath,int iLimit){
+  FILE* psFile=fopen(pcaFilePath,"w+");
+  _dumpMapsToFile(pmsMaps,psFile,iLimit);
+  fflush(psFile);
+  fclose(psFile);
 }
 
@@ -157,8 +158,8 @@
  */
 iotype* createIoType(){
-  iotype* io=(iotype*)malloc(IOTYPE_SIZE);
-  io->content=NULL;
-  io->next=NULL;
-  return io;
+  iotype* pioIO=(iotype*)malloc(IOTYPE_SIZE);
+  pioIO->content=NULL;
+  pioIO->next=NULL;
+  return pioIO;
 }
 
@@ -166,14 +167,14 @@
  * Create a new map
  *
- * @param name the key to add to the map
- * @param value the corresponding value to add to the map
+ * @param pccName the key to add to the map
+ * @param pccValue the corresponding value to add to the map
  * @return a pointer to the allocated map 
  */
-map* createMap(const char* name,const char* value){
-  map* tmp=(map *)malloc(MAP_SIZE);
-  tmp->name=zStrdup(name);
-  tmp->value=zStrdup(value);
-  tmp->next=NULL;
-  return tmp;
+map* createMap(const char* pccName,const char* pccValue){
+  map* pmTtmp=(map *)malloc(MAP_SIZE);
+  pmTtmp->name=zStrdup(pccName);
+  pmTtmp->value=zStrdup(pccValue);
+  pmTtmp->next=NULL;
+  return pmTtmp;
 }
 
@@ -181,14 +182,14 @@
  * Create a new maps with the given name
  *
- * @param name of the maps
+ * @param pccName of the maps
  * @return the allocated map
  */
-maps* createMaps(const char* name){
-  maps* tmp = (maps *) malloc (MAPS_SIZE);
-  tmp->name = zStrdup (name);
-  tmp->content = NULL;
-  tmp->child = NULL;
-  tmp->next = NULL;
-  return tmp;
+maps* createMaps(const char* pccName){
+  maps* pmTmp = (maps *) malloc (MAPS_SIZE);
+  pmTmp->name = zStrdup (pccName);
+  pmTmp->content = NULL;
+  pmTmp->child = NULL;
+  pmTmp->next = NULL;
+  return pmTmp;
 }
 
@@ -196,13 +197,13 @@
  * Count number of map in a map
  *
- * @param m the map to count
+ * @param pmMap the map to count
  * @return number of map in a map
  */
-int count(map* m){
-  map* tmp=m;
+int count(map* pmMap){
+  map* pmTmp=pmMap;
   int c=0;
-  while(tmp!=NULL){
+  while(pmTmp!=NULL){
     c++;
-    tmp=tmp->next;
+    pmTmp=pmTmp->next;
   }
   return c;
@@ -212,13 +213,13 @@
  * Count number of maps in a maps
  *
- * @param m the maps to count
+ * @param pmMap the maps to count
  * @return number of maps in a maps
  */
-int maps_length(maps* m){
-  maps* tmp=m;
+int maps_length(maps* pmMap){
+  maps* pmTmp=pmMap;
   int c=0;
-  while(tmp!=NULL){
+  while(pmTmp!=NULL){
     c++;
-    tmp=tmp->next;
+    pmTmp=pmTmp->next;
   }
   return c;
@@ -228,14 +229,14 @@
  * Verify if a key exist in a map
  *
- * @param m the map to search for the key
- * @param key the key to search in the map
+ * @param pmMap the map to search for the key
+ * @param pccKey the key to search in the map
  * @return true if the key wwas found, false in other case
  */
-bool hasKey(map* m,const char *key){
-  map* tmp=m;
-  while(tmp!=NULL){
-    if(strcasecmp(tmp->name,key)==0)
+bool hasKey(map* pmMap,const char *pccKey){
+  map* pmTmp=pmMap;
+  while(pmTmp!=NULL){
+    if(strcasecmp(pmTmp->name,pccKey)==0)
       return true;
-    tmp=tmp->next;
+    pmTmp=pmTmp->next;
   }
 #ifdef DEBUG_MAP
@@ -248,15 +249,15 @@
  * Access a specific maps
  *
- * @param m the maps to search for the key
- * @param key the key to search in the maps
+ * @param pmMap the maps to search for the key
+ * @param pccKey the key to search in the maps
  * @return a pointer on the maps found or NULL if not found
  */
-maps* getMaps(maps* m,const char *key){
-  maps* tmp=m;
-  while(tmp!=NULL){
-    if(strcasecmp(tmp->name,key)==0){
-      return tmp;
-    }
-    tmp=tmp->next;
+maps* getMaps(maps* pmsMaps,const char *pccKey){
+  maps* pmTmp=pmsMaps;
+  while(pmTmp!=NULL){
+    if(strcasecmp(pmTmp->name,pccKey)==0){
+      return pmTmp;
+    }
+    pmTmp=pmTmp->next;
   }
   return NULL;
@@ -266,15 +267,15 @@
  * Access a specific map
  *
- * @param m the map to search for the key
- * @param key the key to search in the map
+ * @param pmMap the map to search for the key
+ * @param pccKey the key to search in the map
  * @return a pointer on the map found or NULL if not found
  */
-map* getMap(map* m,const char *key){
-  map* tmp=m;
-  while(tmp!=NULL){
-    if(strcasecmp(tmp->name,key)==0){
-      return tmp;
-    }
-    tmp=tmp->next;
+map* getMap(map* pmMap,const char *pccKey){
+  map* pmTmp=pmMap;
+  while(pmTmp!=NULL){
+    if(strcasecmp(pmTmp->name,pccKey)==0){
+      return pmTmp;
+    }
+    pmTmp=pmTmp->next;
   }
   return NULL;
@@ -285,14 +286,14 @@
  * Access the last map
  *
- * @param m the map to search for the lastest map
+ * @param pmMap the map to search for the lastest map
  * @return a pointer on the lastest map found or NULL if not found
  */
-map* getLastMap(map* m){
-  map* tmp=m;
-  while(tmp!=NULL){
-    if(tmp->next==NULL){
-      return tmp;
-    }
-    tmp=tmp->next;
+map* getLastMap(map* pmMap){
+  map* pmTmp=pmMap;
+  while(pmTmp!=NULL){
+    if(pmTmp->next==NULL){
+      return pmTmp;
+    }
+    pmTmp=pmTmp->next;
   }
   return NULL;
@@ -302,14 +303,14 @@
  * Access a specific map from a maps
  *
- * @param m the maps to search for the key
- * @param key the key to search in the maps
- * @param subkey the key to search in the map (found for the key, if any)
+ * @param pmMap the maps to search for the key
+ * @param pccKey the key to search in the maps
+ * @param pccSubkey the key to search in the map (found for the key, if any)
  * @return a pointer on the map found or NULL if not found
  */
-map* getMapFromMaps(maps* m,const char* key,const char* subkey){
-  maps* _tmpm=getMaps(m,key);
-  if(_tmpm!=NULL){
-    map* _ztmpm=getMap(_tmpm->content,subkey);
-    return _ztmpm;
+map* getMapFromMaps(maps* pmMap,const char* pccKey,const char* pccSubkey){
+  maps* pmTmp=getMaps(pmMap,pccKey);
+  if(pmTmp!=NULL){
+    map* pmTmp1=getMap(pmTmp->content,pccSubkey);
+    return pmTmp1;
   }
   else return NULL;
@@ -320,20 +321,20 @@
  * Require to call free on mo after calling this function.
  *
- * @param mo the map to free
- */
-void freeMap(map** mo){
-  map* _cursor=*mo;
-  if(_cursor!=NULL){
+ * @param pmMap the map to free
+ */
+void freeMap(map** pmMap){
+  map* pmCursor=*pmMap;
+  if(pmCursor!=NULL){
 #ifdef DEBUG
     fprintf(stderr,"freeMap\n");
 #endif
-    if(_cursor->name!=NULL)
-      free(_cursor->name);
-    if(_cursor->value!=NULL)
-      free(_cursor->value);
-    if(_cursor->next!=NULL){
-      freeMap(&_cursor->next);
-      if(_cursor->next!=NULL)
-	free(_cursor->next);
+    if(pmCursor->name!=NULL)
+      free(pmCursor->name);
+    if(pmCursor->value!=NULL)
+      free(pmCursor->value);
+    if(pmCursor->next!=NULL){
+      freeMap(&pmCursor->next);
+      if(pmCursor->next!=NULL)
+	free(pmCursor->next);
     }
   }
@@ -344,24 +345,24 @@
  * Require to call free on mo after calling this function.
  *
- * @param mo the maps to free
- */
-void freeMaps(maps** mo){
-  maps* _cursor=*mo;
-  if(_cursor && _cursor!=NULL){
+ * @param pmMap the maps to free
+ */
+void freeMaps(maps** pmMap){
+  maps* pmCursor=*pmMap;
+  if(pmCursor && pmCursor!=NULL){
 #ifdef DEBUG
     fprintf(stderr,"freeMaps\n");
 #endif
-    free(_cursor->name);
-    if(_cursor->content!=NULL){
-      freeMap(&_cursor->content);
-      free(_cursor->content);
-    }
-    if(_cursor->child!=NULL){
-      freeMaps(&_cursor->child);
-      free(_cursor->child);
-    }
-    if(_cursor->next!=NULL){
-      freeMaps(&_cursor->next);
-      free(_cursor->next);
+    free(pmCursor->name);
+    if(pmCursor->content!=NULL){
+      freeMap(&pmCursor->content);
+      free(pmCursor->content);
+    }
+    if(pmCursor->child!=NULL){
+      freeMaps(&pmCursor->child);
+      free(pmCursor->child);
+    }
+    if(pmCursor->next!=NULL){
+      freeMaps(&pmCursor->next);
+      free(pmCursor->next);
     }
   }
@@ -371,14 +372,14 @@
  * Verify if an elements contains a name equal to the given key.
  *
- * @param e the elements to search for the key
- * @param key the elements name to search
+ * @param peElem the elements to search for the key
+ * @param pccKey the elements name to search
  * @return true if the elements contains the name, false in other cases.
  */ 
-bool hasElement(elements* e,const char* key){
-  elements* tmp=e;
-  while(tmp!=NULL){
-    if(strcasecmp(key,tmp->name)==0)
+bool hasElement(elements* peElem,const char* pccKey){
+  elements* peTmp=peElem;
+  while(peTmp!=NULL){
+    if(strcasecmp(pccKey,peTmp->name)==0)
       return true;
-    tmp=tmp->next;
+    peTmp=peTmp->next;
   }
   return false;
@@ -388,14 +389,14 @@
  * Access a specific elements named key.
  *
- * @param m the elements to search
- * @param key the elements name to search
+ * @param peElem the elements to search
+ * @param pccKey the elements name to search
  * @return a pointer to the specific element if found, NULL in other case.
  */ 
-elements* getElements(elements* m,const char *key){
-  elements* tmp=m;
-  while(tmp!=NULL){
-    if(strcasecmp(tmp->name,key)==0)
-      return tmp;
-    tmp=tmp->next;
+elements* getElements(elements* peElem,const char *pccKey){
+  elements* peTmp=peElem;
+  while(peTmp!=NULL){
+    if(strcasecmp(peTmp->name,pccKey)==0)
+      return peTmp;
+    peTmp=peTmp->next;
   }
   return NULL;
@@ -406,15 +407,15 @@
  * Require to call free on i after calling this function.
  *
- * @param i the iotype to free
- */
-void freeIOType(iotype** i){
-  iotype* _cursor=*i;
-  if(_cursor!=NULL){
-    if(_cursor->next!=NULL){
-      freeIOType(&_cursor->next);
-      free(_cursor->next);
-    }
-    freeMap(&_cursor->content);
-    free(_cursor->content);
+ * @param piotIO the iotype to free
+ */
+void freeIOType(iotype** piotIO){
+  iotype* piotCursor=*piotIO;
+  if(piotCursor!=NULL){
+    if(piotCursor->next!=NULL){
+      freeIOType(&piotCursor->next);
+      free(piotCursor->next);
+    }
+    freeMap(&piotCursor->content);
+    free(piotCursor->content);
   }
 }
@@ -424,37 +425,37 @@
  * Require to call free on e after calling this function.
  *
- * @param e the iotype to free
- */
-void freeElements(elements** e){
-  elements* tmp=*e;
-  if(tmp!=NULL){
-    if(tmp->name!=NULL)
-      free(tmp->name);
-    freeMap(&tmp->content);
-    if(tmp->content!=NULL)
-      free(tmp->content);
-    freeMap(&tmp->metadata);
-    if(tmp->metadata!=NULL)
-      free(tmp->metadata);
-    freeMap(&tmp->additional_parameters);
-    if(tmp->additional_parameters!=NULL)
-      free(tmp->additional_parameters);
-    if(tmp->format!=NULL)
-      free(tmp->format);
-    freeElements(&tmp->child);
-    if(tmp->child!=NULL){
-      free(tmp->child);
-    }
-    if(tmp->defaults!=NULL){
-      freeIOType(&tmp->defaults);
-      free(tmp->defaults);
-    }
-    if(tmp->supported!=NULL){
-      freeIOType(&tmp->supported);
-      free(tmp->supported);
-    }
-    if(tmp->next!=NULL){
-      freeElements(&tmp->next);
-      free(tmp->next);
+ * @param peElem the iotype to free
+ */
+void freeElements(elements** peElem){
+  elements* peTmp=*peElem;
+  if(peTmp!=NULL){
+    if(peTmp->name!=NULL)
+      free(peTmp->name);
+    freeMap(&peTmp->content);
+    if(peTmp->content!=NULL)
+      free(peTmp->content);
+    freeMap(&peTmp->metadata);
+    if(peTmp->metadata!=NULL)
+      free(peTmp->metadata);
+    freeMap(&peTmp->additional_parameters);
+    if(peTmp->additional_parameters!=NULL)
+      free(peTmp->additional_parameters);
+    if(peTmp->format!=NULL)
+      free(peTmp->format);
+    freeElements(&peTmp->child);
+    if(peTmp->child!=NULL){
+      free(peTmp->child);
+    }
+    if(peTmp->defaults!=NULL){
+      freeIOType(&peTmp->defaults);
+      free(peTmp->defaults);
+    }
+    if(peTmp->supported!=NULL){
+      freeIOType(&peTmp->supported);
+      free(peTmp->supported);
+    }
+    if(peTmp->next!=NULL){
+      freeElements(&peTmp->next);
+      free(peTmp->next);
     }
   }
@@ -469,12 +470,12 @@
  */
 service* createService(){
-  service *s1 = (service *) malloc (SERVICE_SIZE);
-  s1->name=NULL;
-  s1->content=NULL;
-  s1->metadata=NULL;
-  s1->additional_parameters=NULL;
-  s1->inputs=NULL;
-  s1->outputs=NULL;
-  return s1;
+  service *psService = (service *) malloc (SERVICE_SIZE);
+  psService->name=NULL;
+  psService->content=NULL;
+  psService->metadata=NULL;
+  psService->additional_parameters=NULL;
+  psService->inputs=NULL;
+  psService->outputs=NULL;
+  return psService;
 }
 
@@ -483,26 +484,26 @@
  * Require to be invoked for every createService call.
  *
- * @param s the service to free
- */
-void freeService(service** s){
-  service* tmp=*s;
-  if(tmp!=NULL){
-    if(tmp->name!=NULL)
-      free(tmp->name);
-    freeMap(&tmp->content);
-    if(tmp->content!=NULL)
-      free(tmp->content);
-    freeMap(&tmp->metadata);
-    if(tmp->metadata!=NULL)
-      free(tmp->metadata);
-    freeMap(&tmp->additional_parameters);
-    if(tmp->additional_parameters!=NULL)
-      free(tmp->additional_parameters);
-    freeElements(&tmp->inputs);
-    if(tmp->inputs!=NULL)
-      free(tmp->inputs);
-    freeElements(&tmp->outputs);
-    if(tmp->outputs!=NULL)
-      free(tmp->outputs);
+ * @param psService the service to free
+ */
+void freeService(service** psService){
+  service* psTmp=*psService;
+  if(psTmp!=NULL){
+    if(psTmp->name!=NULL)
+      free(psTmp->name);
+    freeMap(&psTmp->content);
+    if(psTmp->content!=NULL)
+      free(psTmp->content);
+    freeMap(&psTmp->metadata);
+    if(psTmp->metadata!=NULL)
+      free(psTmp->metadata);
+    freeMap(&psTmp->additional_parameters);
+    if(psTmp->additional_parameters!=NULL)
+      free(psTmp->additional_parameters);
+    freeElements(&psTmp->inputs);
+    if(psTmp->inputs!=NULL)
+      free(psTmp->inputs);
+    freeElements(&psTmp->outputs);
+    if(psTmp->outputs!=NULL)
+      free(psTmp->outputs);
   }
 }
@@ -511,24 +512,24 @@
  * Add key value pair to an existing map.
  *
- * @param m the map to add the KVP
- * @param n the key to add
- * @param v the corresponding value to add
- */
-void addToMap(map* m,const char* n,const char* v){
-    if (m != NULL) { // knut: add NULL-pointer check
-        if (hasKey(m, n) == false) {
-            map* _cursor = m;
-            while (_cursor->next != NULL) {
-                _cursor = _cursor->next;
-            }
-            _cursor->next = createMap(n, v);
-        }
-        else {
-            map *tmp = getMap(m, n);
-            if (tmp->value != NULL)
-                free(tmp->value);
-            tmp->value = zStrdup(v);
-        }
-    }
+ * @param pMap the map to add the KVP
+ * @param pccName the key to add
+ * @param pccValue the corresponding value to add
+ */
+void addToMap(map* pMap,const char* pccName,const char* pccValue){
+  if (pMap != NULL) { // knut: add NULL-pointer check
+    if (hasKey(pMap, pccName) == false) {
+      map* pmCursor = pMap;
+      while (pmCursor->next != NULL) {
+	pmCursor = pmCursor->next;
+      }
+      pmCursor->next = createMap(pccName, pccValue);
+    }
+    else {
+      map *tmp = getMap(pMap, pccName);
+      if (tmp->value != NULL)
+	free(tmp->value);
+      tmp->value = zStrdup(pccValue);
+    }
+  }
 }
 
@@ -536,23 +537,23 @@
  * Add a key and an integer value to an existing map.
  *
- * @param m the map to add the KVP
- * @param n the key to add
- * @param v the corresponding value to add
- */
-void addIntToMap(map* m,const char* n,const int v){
-  char svalue[10];
-  sprintf(svalue,"%d",v);
-  if(hasKey(m,n)==false){
-    map* _cursor=m;
-    while(_cursor->next!=NULL){
-      _cursor=_cursor->next;
-    }
-    _cursor->next=createMap(n,svalue);
+ * @param pMap the map to add the KVP
+ * @param pccName the key to add
+ * @param iValue the corresponding value to add
+ */
+void addIntToMap(map* pMap,const char* pccName,const int iValue){
+  char acValue[10];
+  sprintf(acValue,"%d",iValue);
+  if(hasKey(pMap,pccName)==false){
+    map* pmCursor=pMap;
+    while(pmCursor->next!=NULL){
+      pmCursor=pmCursor->next;
+    }
+    pmCursor->next=createMap(pccName,acValue);
   }
   else{
-    map *tmp=getMap(m,n);
-    if(tmp->value!=NULL)
-      free(tmp->value);
-    tmp->value=zStrdup(svalue);
+    map *pmTmp=getMap(pMap,pccName);
+    if(pmTmp->value!=NULL)
+      free(pmTmp->value);
+    pmTmp->value=zStrdup(acValue);
   }
 }
@@ -561,34 +562,34 @@
  * Add a key and a binary value to an existing map.
  *
- * @param m the map to add the KVP
- * @param n the key to add
- * @param v the corresponding value to add
- * @param size the size of the given value
+ * @param pMap the map to add the KVP
+ * @param pccName the key to add
+ * @param pccValue the corresponding value to add
+ * @param iSize the size of the given value
  * @return a pointer to the updated map m
  */
-map* addToMapWithSize(map* m,const char* n,const char* v,int size){
-  char sin[128];
-  char sname[10]="size";
-  map *tmp;
-  if(hasKey(m,n)==false){
-    map* _cursor=m;
+map* addToMapWithSize(map* pMap,const char* pccName,const char* pccValue,int iSize){
+  char acIn[128];
+  char acName[10]="size";
+  map *pmTmp;
+  if(hasKey(pMap,pccName)==false){
+    map* _cursor=pMap;
     if(_cursor!=NULL){
-      addToMap(m,n,"");
+      addToMap(pMap,pccName,"");
     }else{
-      m=createMap(n,"");
-    }
-  }
-  if(strlen(n)>5)
-    sprintf(sname,"size_%s",n+6);
-  tmp=getMap(m,n);
-  if(tmp->value!=NULL)
-    free(tmp->value);
-  tmp->value=(char*)malloc((size+1)*sizeof(char));
-  if(v!=NULL)
-    memmove(tmp->value,v,size*sizeof(char));
-  tmp->value[size]=0;
-  sprintf(sin,"%d",size);
-  addToMap(m,sname,sin);
-  return m;
+      pMap=createMap(pccName,"");
+    }
+  }
+  if(strlen(pccName)>5)
+    sprintf(acName,"size_%s",pccName+6);
+  pmTmp=getMap(pMap,pccName);
+  if(pmTmp->value!=NULL)
+    free(pmTmp->value);
+  pmTmp->value=(char*)malloc((iSize+1)*sizeof(char));
+  if(pccValue!=NULL)
+    memmove(pmTmp->value,pccValue,iSize*sizeof(char));
+  pmTmp->value[iSize]=0;
+  sprintf(acIn,"%d",iSize);
+  addToMap(pMap,acName,acIn);
+  return pMap;
 }
 
@@ -596,28 +597,28 @@
  * Add a map at the end of another map.
  *
- * @param mo the map to add mi
- * @param mi the map to add to mo
- */
-void addMapToMap(map** mo,map* mi){
-  map* tmp=mi;
-  map* _cursor=*mo;
-  while(tmp!=NULL){
-    if(_cursor==NULL){
-      *mo=createMap(tmp->name,tmp->value);
-      (*mo)->next=NULL;
+ * @param pmMapOut the map to add pmMapIn to
+ * @param pmMapIn the map to add to pmMapOut
+ */
+void addMapToMap(map** pmMapOut,map* pmMapIn){
+  map* pmTmp=pmMapIn;
+  map* pmCursor=*pmMapOut;
+  while(pmTmp!=NULL){
+    if(pmCursor==NULL){
+      *pmMapOut=createMap(pmTmp->name,pmTmp->value);
+      (*pmMapOut)->next=NULL;
     }
     else{
-      map* tmp1=getMap(*mo,tmp->name);
-      if(tmp1==NULL){
-	while(_cursor->next!=NULL)
-	  _cursor=_cursor->next;
-	_cursor->next=createMap(tmp->name,tmp->value);
+      map* pmTmp1=getMap(*pmMapOut,pmTmp->name);
+      if(pmTmp1==NULL){
+	while(pmCursor->next!=NULL)
+	  pmCursor=pmCursor->next;
+	pmCursor->next=createMap(pmTmp->name,pmTmp->value);
       }
       else{
-	addToMap(*mo,tmp->name,tmp->value);
+	addToMap(*pmMapOut,pmTmp->name,pmTmp->value);
       }
     }
-    _cursor=*mo;
-    tmp=tmp->next;
+    pmCursor=*pmMapOut;
+    pmTmp=pmTmp->next;
   }
 }
@@ -626,16 +627,16 @@
  * Add a map to iotype.
  *
- * @param io the iotype to add the map
- * @param mi the map to add to io
- */
-void addMapToIoType(iotype** io,map* mi){
-  iotype* tmp=*io;
-  while(tmp->next!=NULL){
-    tmp=tmp->next;
-  }
-  tmp->next=(iotype*)malloc(IOTYPE_SIZE);
-  tmp->next->content=NULL;
-  addMapToMap(&tmp->next->content,mi);
-  tmp->next->next=NULL;
+ * @param piotType the iotype to add the map
+ * @param pmMap the map to add to io
+ */
+void addMapToIoType(iotype** piotType,map* pmMap){
+  iotype* piotTmp=*piotType;
+  while(piotTmp->next!=NULL){
+    piotTmp=piotTmp->next;
+  }
+  piotTmp->next=(iotype*)malloc(IOTYPE_SIZE);
+  piotTmp->next->content=NULL;
+  addMapToMap(&piotTmp->next->content,pmMap);
+  piotTmp->next->next=NULL;
 }
 
@@ -643,21 +644,21 @@
  * Access a specific map or set its value.
  *
- * @param m the map to search for the key
- * @param key the key to search/add in the map
- * @param value the value to add if the key does not exist
+ * @param ppmMap the map to search for the key
+ * @param pccKey the key to search/add in the map
+ * @param pccValue the value to add if the key does not exist
  * @return a pointer on the map found or NULL if not found
  */
-map* getMapOrFill(map** m,const char *key,const char* value){
-  map* tmp=*m;
-  map* tmpMap=getMap(tmp,key);
-  if(tmpMap==NULL){
-    if(tmp!=NULL){
-      addToMap((*m),key,value);
+map* getMapOrFill(map** ppmMap,const char *pccKey,const char* pccValue){
+  map* pmTmp=*ppmMap;
+  map* pmTmp1=getMap(pmTmp,pccKey);
+  if(pmTmp1==NULL){
+    if(pmTmp!=NULL){
+      addToMap((*ppmMap),pccKey,pccValue);
     }
     else
-      (*m)=createMap(key,value);
-    tmpMap=getMap(*m,key);
-  }
-  return tmpMap;
+      (*ppmMap)=createMap(pccKey,pccValue);
+    pmTmp1=getMap(*ppmMap,pccKey);
+  }
+  return pmTmp1;
 }
 
@@ -665,20 +666,21 @@
  * Verify if a map is contained in another map.
  *
- * @param m the map to search for i
- * @param i the map to search in m
+ * @param pmMap the map to search for i
+ * @param pmSearch the map to search in m
  * @return true if i was found in m, false in other case
  */
-bool contains(map* m,map* i){
-  while(i!=NULL){      
-    if(strcasecmp(i->name,"value")!=0 &&
-       strcasecmp(i->name,"xlink:href")!=0 &&
-       strcasecmp(i->name,"useMapServer")!=0 &&
-       strcasecmp(i->name,"asReference")!=0){
+bool contains(map* pmMap,map* pmSearch){
+  while(pmSearch!=NULL){      
+    if(strcasecmp(pmSearch->name,"value")!=0 &&
+       strcasecmp(pmSearch->name,"xlink:href")!=0 &&
+       strcasecmp(pmSearch->name,"useMapServer")!=0 &&
+       strcasecmp(pmSearch->name,"asReference")!=0){
       map *tmp;
-      if(hasKey(m,i->name) && (tmp=getMap(m,i->name))!=NULL && 
-	 strcasecmp(i->value,tmp->value)!=0)
+      if(hasKey(pmMap,pmSearch->name) &&
+	 (tmp=getMap(pmMap,pmSearch->name))!=NULL && 
+	 strcasecmp(pmSearch->value,tmp->value)!=0)
 	return false;
     }
-    i=i->next;
+    pmSearch=pmSearch->next;
   }
   return true;
@@ -688,21 +690,21 @@
  * Access a specific iotype from an elements.
  *
- * @param e the elements to search for the name
- * @param name the name to search in the elements e
- * @param values the map to verify it was contained in the defaults or 
+ * @param peElem the elements to search for the name
+ * @param pcName the name to search in the elements e
+ * @param pcValues the map to verify it was contained in the defaults or 
  *  supported content of the elements e
  * @return a pointer on the iotype found or NULL if not found
  */
-iotype* getIoTypeFromElement(elements* e,char *name, map* values){
-  elements* cursor=e;
-  if(values!=NULL){
-    while(cursor!=NULL){
-      if(strcasecmp(cursor->name,name)==0 && (cursor->defaults!=NULL || cursor->supported!=NULL)){
-	if(contains(cursor->defaults->content,values)==true)
-	  return cursor->defaults;
+iotype* getIoTypeFromElement(elements* peElem,char *pcName, map* pcValues){
+  elements* peCursor=peElem;
+  if(pcValues!=NULL){
+    while(peCursor!=NULL){
+      if(strcasecmp(peCursor->name,pcName)==0 && (peCursor->defaults!=NULL || peCursor->supported!=NULL)){
+	if(contains(peCursor->defaults->content,pcValues)==true)
+	  return peCursor->defaults;
 	else{
-	  iotype* tmp=cursor->supported;
+	  iotype* tmp=peCursor->supported;
 	  while(tmp!=NULL){
-	    if(contains(tmp->content,values)==true)
+	    if(contains(tmp->content,pcValues)==true)
 	      return tmp;	    
 	    tmp=tmp->next;
@@ -710,12 +712,12 @@
 	}
       }
-      cursor=cursor->next;
+      peCursor=peCursor->next;
     }
   }else{
-    while(cursor!=NULL){
-      if(strcasecmp(cursor->name,name)==0 && cursor->defaults!=NULL){
-	return cursor->defaults;
+    while(peCursor!=NULL){
+      if(strcasecmp(peCursor->name,pcName)==0 && peCursor->defaults!=NULL){
+	return peCursor->defaults;
       }
-      cursor=cursor->next;
+      peCursor=peCursor->next;
     }
   }
@@ -726,35 +728,35 @@
  * Load binary values from a map (in) and add them to another map (out)
  *
- * @param out the map to add binaries values
- * @param in the map containing the binary values to add ti out
- * @param pos index of the binary in an array (in case of "MapArray")
- */
-void loadMapBinary(map** out,map* in,int pos){
-  map* size=getMap(in,"size");
-  map *lout=*out;
-  map *tmpVin,*tmpVout;
-  if(size!=NULL && pos>0){
+ * @param pmOut the map to add binaries values
+ * @param pmIn the map containing the binary values to add ti out
+ * @param iPos index of the binary in an array (in case of "MapArray")
+ */
+void loadMapBinary(map** ppmOut,map* pmIn,int iPos){
+  map* pmSize=getMap(pmIn,"size");
+  map *pmOut=*ppmOut;
+  map *pmTmpVin,*pmTmpVout;
+  if(pmSize!=NULL && iPos>0){
     char tmp[11];
-    sprintf(tmp,"size_%d",pos);
-    size=getMap(in,tmp);
-    sprintf(tmp,"value_%d",pos);
-    tmpVin=getMap(in,tmp);
-    tmpVout=getMap(lout,tmp);
-    free(tmpVout->value);
-    tmpVout->value=(char*)malloc((atoi(size->value)+1)*sizeof(char));
-    memmove(tmpVout->value,tmpVin->value,atoi(size->value)*sizeof(char));
-    tmpVout->value[atoi(size->value)]=0;
+    sprintf(tmp,"size_%d",iPos);
+    pmSize=getMap(pmIn,tmp);
+    sprintf(tmp,"value_%d",iPos);
+    pmTmpVin=getMap(pmIn,tmp);
+    pmTmpVout=getMap(pmOut,tmp);
+    free(pmTmpVout->value);
+    pmTmpVout->value=(char*)malloc((atoi(pmSize->value)+1)*sizeof(char));
+    memmove(pmTmpVout->value,pmTmpVin->value,atoi(pmSize->value)*sizeof(char));
+    pmTmpVout->value[atoi(pmSize->value)]=0;
   }else{
-    if(size!=NULL){
-      tmpVin=getMap(in,"value");
-      tmpVout=getMap(lout,"value");
-      free(tmpVout->value);
-      tmpVout->value=(char*)malloc((atoi(size->value)+1)*sizeof(char));
-      memmove(tmpVout->value,tmpVin->value,atoi(size->value)*sizeof(char));
-      tmpVout->value[atoi(size->value)]=0;
-    }
-  }
-}
-  
+    if(pmSize!=NULL){
+      pmTmpVin=getMap(pmIn,"value");
+      pmTmpVout=getMap(pmOut,"value");
+      free(pmTmpVout->value);
+      pmTmpVout->value=(char*)malloc((atoi(pmSize->value)+1)*sizeof(char));
+      memmove(pmTmpVout->value,pmTmpVin->value,atoi(pmSize->value)*sizeof(char));
+      pmTmpVout->value[atoi(pmSize->value)]=0;
+    }
+  }
+}
+
 /**
  * Load binary values from a map (in) and add them to another map (out).
@@ -762,12 +764,12 @@
  * @see loadMapBinary
  *
- * @param out the map to add binaries values
- * @param in the map containing the binary values to add ti out
- */
-void loadMapBinaries(map** out,map* in){
-  map* size=getMap(in,"size");
-  map* length=getMap(in,"length");
-  map* toload=getMap(in,"to_load");
-  if(toload!=NULL && strcasecmp(toload->value,"false")==0){
+ * @param ppmOut the map to add binaries values
+ * @param pmIn the map containing the binary values to add ti out
+ */
+void loadMapBinaries(map** ppmOut,map* pmIn){
+  map* pmSize=getMap(pmIn,"size");
+  map* pmLength=getMap(pmIn,"length");
+  map* pmToload=getMap(pmIn,"to_load");
+  if(pmToload!=NULL && strcasecmp(pmToload->value,"false")==0){
 #ifdef DEBUG
     fprintf(stderr,"NO LOAD %s %d \n",__FILE__,__LINE__);
@@ -775,14 +777,14 @@
     return ;
   }
-  if(length!=NULL){
-    int len=atoi(length->value);
+  if(pmLength!=NULL){
+    int len=atoi(pmLength->value);
     int i=0;
     for(i=0;i<len;i++){
-      loadMapBinary(out,in,i);
+      loadMapBinary(ppmOut,pmIn,i);
     }
   }
   else
-    if(size!=NULL)
-      loadMapBinary(out,in,-1);
+    if(pmSize!=NULL)
+      loadMapBinary(ppmOut,pmIn,-1);
 }
 
@@ -790,24 +792,24 @@
  * Duplicate a Maps
  * 
- * @param mo the maps to clone
+ * @param ppmsOut the maps to clone
  * @return the allocated maps containing a copy of the mo maps
  */
-maps* dupMaps(maps** mo){
-  maps* _cursor=*mo;
-  maps* res=NULL;
-  if(_cursor!=NULL){
-    map* mc=_cursor->content;
-    maps* mcs=_cursor->child;
-    res=createMaps(_cursor->name);
-    if(mc!=NULL){
-      addMapToMap(&res->content,mc);
-      loadMapBinaries(&res->content,mc);
-    }
-    if(mcs!=NULL){
-      res->child=dupMaps(&mcs);
-    }
-    res->next=dupMaps(&_cursor->next);
-  }
-  return res;
+maps* dupMaps(maps** ppmsOut){
+  maps* pmsCursor=*ppmsOut;
+  maps* pmRes=NULL;
+  if(pmsCursor!=NULL){
+    map* pmContent=pmsCursor->content;
+    maps* pmsChild=pmsCursor->child;
+    pmRes=createMaps(pmsCursor->name);
+    if(pmContent!=NULL){
+      addMapToMap(&pmRes->content,pmContent);
+      loadMapBinaries(&pmRes->content,pmContent);
+    }
+    if(pmsChild!=NULL){
+      pmRes->child=dupMaps(&pmsChild);
+    }
+    pmRes->next=dupMaps(&pmsCursor->next);
+  }
+  return pmRes;
 }
 
@@ -816,35 +818,35 @@
  *
  * @see addMapToMap, dupMaps, getMaps
- * @param mo the maps to add mi
- * @param mi the maps to add to mo
- */
-void addMapsToMaps(maps** mo,maps* mi){
-  maps* tmp=mi;
-  maps* _cursor=*mo;
-  while(tmp!=NULL){
-    if(_cursor==NULL){
-      *mo=dupMaps(&mi);
+ * @param ppmsOut the maps to add mi
+ * @param pmIn the maps to add to mo
+ */
+void addMapsToMaps(maps** ppmsOut,maps* pmIn){
+  maps* pmsTmp=pmIn;
+  maps* pmsCursor=*ppmsOut;
+  while(pmsTmp!=NULL){
+    if(pmsCursor==NULL){
+      *ppmsOut=dupMaps(&pmIn);
     }
     else{
-      maps* tmp1=getMaps(*mo,tmp->name);
-      if(tmp1==NULL){
-	while(_cursor->next!=NULL)
-	  _cursor=_cursor->next;
-	_cursor->next=dupMaps(&tmp);
-	if(tmp->child!=NULL)
-	  _cursor->next->child=dupMaps(&tmp->child);
+      maps* pmsTmp1=getMaps(*ppmsOut,pmsTmp->name);
+      if(pmsTmp1==NULL){
+	while(pmsCursor->next!=NULL)
+	  pmsCursor=pmsCursor->next;
+	pmsCursor->next=dupMaps(&pmsTmp);
+	if(pmsTmp->child!=NULL)
+	  pmsCursor->next->child=dupMaps(&pmsTmp->child);
 	else
-	  _cursor->next->child=NULL;
+	  pmsCursor->next->child=NULL;
       }
       else{
-	addMapToMap(&tmp1->content,tmp->content);
-	if(tmp->child!=NULL)
-	  tmp1->child=dupMaps(&tmp->child);
+	addMapToMap(&pmsTmp1->content,pmsTmp->content);
+	if(pmsTmp->child!=NULL)
+	  pmsTmp1->child=dupMaps(&pmsTmp->child);
 	else
-	  tmp1->child=NULL;
+	  pmsTmp1->child=NULL;
       }
-      _cursor=*mo;
-    }
-    tmp=tmp->next;
+      pmsCursor=*ppmsOut;
+    }
+    pmsTmp=pmsTmp->next;
   }
 }
@@ -853,25 +855,25 @@
  * Access a specific map array element
  *
- * @param m the map to search for the key
- * @param key the key to search in the map
- * @param index of the MapArray 
+ * @param pmMap the map to search for the key
+ * @param pccKey the key to search in the map
+ * @param iIndex of the MapArray 
  * @return a pointer on the map found or NULL if not found
  */
-map* getMapArray(map* m,const char* key,int index){
-  char tmp[1024];
-  map* tmpMap;
-  if(index>0)
-    sprintf(tmp,"%s_%d",key,index);
+map* getMapArray(map* pmMap,const char* pccKey,int iIndex){
+  char acTmp[1024];
+  map* pmTmp;
+  if(iIndex>0)
+    sprintf(acTmp,"%s_%d",pccKey,iIndex);
   else
-    sprintf(tmp,"%s",key);
+    sprintf(acTmp,"%s",pccKey);
 #ifdef DEBUG
-  fprintf(stderr,"** KEY %s\n",tmp);
+  fprintf(stderr,"** KEY %s\n",acTmp);
 #endif
-  tmpMap=getMap(m,tmp);
+  pmTmp=getMap(pmMap,acTmp);
 #ifdef DEBUG
-  if(tmpMap!=NULL)
-    dumpMap(tmpMap);
+  if(pmTmp!=NULL)
+    dumpMap(pmTmp);
 #endif
-  return tmpMap;
+  return pmTmp;
 }
 
@@ -879,38 +881,38 @@
  * Add a key value in a MapArray for a specific index
  *
- * @param m the map to search for the key
- * @param key the key to search in the map
- * @param index the index of the MapArray 
- * @param value the value to set in the MapArray 
+ * @param pmMap the map to search for the key
+ * @param pccKey the key to search in the map
+ * @param iIndex the index of the MapArray 
+ * @param pccValue the value to set in the MapArray 
  * @return a pointer on the map found or NULL if not found
  */
-void setMapArray(map* m,const char* key,int index,const char* value){
-  char tmp[1024];
-  map* tmpSize;
-  if(index>0){
-    map* len=getMap(m,"length");
-    sprintf(tmp,"%s_%d",key,index);
-    if((len!=NULL && atoi(len->value)<index+1) || len==NULL){
-      char tmp0[5];
-      sprintf(tmp0,"%d",index+1);
-      addToMap(m,"length",tmp0);
+void setMapArray(map* pmMap,const char* pccKey,int iIndex,const char* pccValue){
+  char acTmp[1024];
+  map* pmSize;
+  if(iIndex>0){
+    map* pmLen=getMap(pmMap,"length");
+    sprintf(acTmp,"%s_%d",pccKey,iIndex);
+    if((pmLen!=NULL && atoi(pmLen->value)<iIndex+1) || pmLen==NULL){
+      char acTmp0[5];
+      sprintf(acTmp0,"%d",iIndex+1);
+      addToMap(pmMap,"length",acTmp0);
     }
   }
   else{
-    sprintf(tmp,"%s",key);
-    addToMap(m,"length","1");
-  }
-  tmpSize=getMapArray(m,"size",index);
-  if(tmpSize!=NULL && strncasecmp(key,"value",5)==0){
-    map* ptr=getMapOrFill(&m,tmp,(char *)"");
+    sprintf(acTmp,"%s",pccKey);
+    addToMap(pmMap,"length","1");
+  }
+  pmSize=getMapArray(pmMap,"size",iIndex);
+  if(pmSize!=NULL && strncasecmp(pccKey,"value",5)==0){
+    map* pmPtr=getMapOrFill(&pmMap,acTmp,(char *)"");
 #ifdef DEBUG
-    fprintf(stderr,"%s\n",tmpSize->value);
+    fprintf(stderr,"%s\n",pmSize->value);
 #endif
-    free(ptr->value);
-    ptr->value=(char*)malloc((atoi(tmpSize->value)+1)*sizeof(char));
-    memcpy(ptr->value,value,atoi(tmpSize->value)); 
+    free(pmPtr->value);
+    pmPtr->value=(char*)malloc((atoi(pmSize->value)+1)*sizeof(char));
+    memcpy(pmPtr->value,pccValue,atoi(pmSize->value)); 
   }
   else
-    addToMap(m,tmp,value);
+    addToMap(pmMap,acTmp,pccValue);
 }
 
@@ -918,13 +920,13 @@
  * Add a key and an integer value to an existing map array.
  *
- * @param m the map to add the KVP
- * @param n the key to add
- * @param index the index of the MapArray 
- * @param v the corresponding value to add
- */
-void addIntToMapArray(map* m,const char* n,int index,const int v){
-  char svalue[10];
-  sprintf(svalue,"%d",v);
-  setMapArray(m,n,index,svalue);
+ * @param pmMap the map to add the KVP
+ * @param pccName the key to add
+ * @param iIndex the index of the MapArray 
+ * @param icValue the corresponding value to add
+ */
+void addIntToMapArray(map* pmMap,const char* pccName,int iIndex,const int icValue){
+  char acValue[10];
+  sprintf(acValue,"%d",icValue);
+  setMapArray(pmMap,pccName,iIndex,acValue);
 }
 
@@ -932,20 +934,20 @@
  * Access the map "type"
  *
- * @param mt the map
+ * @param pmMap the map
  * @return a pointer on the map for mimeType/dataType/CRS if found, NULL in
  *  other case
  */
-map* getMapType(map* mt){
-  map* tmap=getMap(mt,(char *)"mimeType");
-  if(tmap==NULL){
-    tmap=getMap(mt,"dataType");
-    if(tmap==NULL){
-      tmap=getMap(mt,"CRS");
+map* getMapType(map* pmMap){
+  map* pmMime=getMap(pmMap,(char *)"mimeType");
+  if(pmMime==NULL){
+    pmMime=getMap(pmMap,"dataType");
+    if(pmMime==NULL){
+      pmMime=getMap(pmMap,"CRS");
     }
   }
 #ifdef DEBUG
-  dumpMap(tmap);
+  dumpMap(pmMime);
 #endif
-  return tmap;
+  return pmMime;
 }
 
@@ -954,15 +956,15 @@
  *
  * @see getMapType
- * @param mo the maps
- * @param mi the maps
- * @param typ the map "type"
+ * @param pmsOut the maps
+ * @param pmsIn the maps
+ * @param pcType the map "type"
  * @return 
  */
-int addMapsArrayToMaps(maps** mo,maps* mi,char* typ){
-  maps* tmp=mi;    
-  maps* _cursor=getMaps(*mo,tmp->name);
-  char tmpLen[10];
-  int len=1;
-  char *tmpV[14]={
+int addMapsArrayToMaps(maps** pmsOut,maps* pmsIn,char* pcType){
+  maps* pmsTmp=pmsIn;
+  maps* pmsCursor=getMaps(*pmsOut,pmsTmp->name);
+  char acLen[10];
+  int iLen=1;
+  char *acV[14]={
     (char*)"size",
     (char*)"value",
@@ -973,5 +975,5 @@
     (char*)"fmimeType",
     (char*)"xlink:href",
-    typ,
+    pcType,
     (char*)"schema",
     (char*)"encoding",
@@ -980,28 +982,28 @@
     (char*)"UpperCorner"
   };
-  int i=0;
-  map* tmpLength;
+  int iCounter=0;
+  map* pmLength;
   
-  if(_cursor==NULL)
+  if(pmsCursor==NULL)
     return -1;
 
-  tmpLength=getMap(_cursor->content,"length");
-  if(tmpLength!=NULL){
-    len=atoi(tmpLength->value);
-  }
-
-  sprintf(tmpLen,"%d",len+1);
-  addToMap(_cursor->content,"length",tmpLen);
-  for(i=0;i<14;i++){
-    map* tmpVI=getMap(tmp->content,tmpV[i]);
-    if(tmpVI!=NULL){
+  pmLength=getMap(pmsCursor->content,"length");
+  if(pmLength!=NULL){
+    iLen=atoi(pmLength->value);
+  }
+
+  sprintf(acLen,"%d",iLen+1);
+  addToMap(pmsCursor->content,"length",acLen);
+  for(iCounter=0;iCounter<14;iCounter++){
+    map* pmTmp=getMap(pmsTmp->content,acV[iCounter]);
+    if(pmTmp!=NULL){
 #ifdef DEBUG
-      fprintf(stderr,"%s = %s\n",tmpV[i],tmpVI->value);
+      fprintf(stderr,"%s = %s\n",pmTmp[iCounter],pmTmp->value);
 #endif
-      setMapArray(_cursor->content,tmpV[i],len,tmpVI->value);
+      setMapArray(pmsCursor->content,acV[iCounter],iLen,pmTmp->value);
     }
   }
     
-  addToMap(_cursor->content,"isArray","true");
+  addToMap(pmsCursor->content,"isArray","true");
   return 0;
 }
@@ -1010,30 +1012,30 @@
  * Set a key value pair to a map contained in a Maps
  *
- * @param m the maps
- * @param key the maps name
- * @param subkey the map name included in the maps corresponding to key
- * @param value the corresponding value to add in the map
- */
-void setMapInMaps(maps* m,const char* key,const char* subkey,const char *value){
-  maps* _tmpm=getMaps(m,key);
-  if(_tmpm!=NULL){
-    map* _ztmpm=getMap(_tmpm->content,subkey);
-    if(_ztmpm!=NULL){
-      if(_ztmpm->value!=NULL)
-	free(_ztmpm->value);
-      _ztmpm->value=zStrdup(value);
+ * @param pmsMaps the maps
+ * @param pccKey the maps name
+ * @param pccSubkey the map name included in the maps corresponding to key
+ * @param pccValue the corresponding value to add in the map
+ */
+void setMapInMaps(maps* pmsMaps,const char* pccKey,const char* pccSubkey,const char *pccValue){
+  maps* pmsTmp=getMaps(pmsMaps,pccKey);
+  if(pmsTmp!=NULL){
+    map* pmTmpSub=getMap(pmsTmp->content,pccSubkey);
+    if(pmTmpSub!=NULL){
+      if(pmTmpSub->value!=NULL)
+	free(pmTmpSub->value);
+      pmTmpSub->value=zStrdup(pccValue);
     }else{
-      maps *tmp=createMaps(key);
-      tmp->content=createMap(subkey,value);
-      addMapsToMaps(&_tmpm,tmp);
-      freeMaps(&tmp);
-      free(tmp);
+      maps *pmsToAdd=createMaps(pccKey);
+      pmsToAdd->content=createMap(pccSubkey,pccValue);
+      addMapsToMaps(&pmsTmp,pmsToAdd);
+      freeMaps(&pmsToAdd);
+      free(pmsToAdd);
     }
   }else{
-    maps *tmp=createMaps(key);
-    tmp->content=createMap(subkey,value);
-    addMapsToMaps(&m,tmp);
-    freeMaps(&tmp);
-    free(tmp);
+    maps *pmsToAdd=createMaps(pccKey);
+    pmsToAdd->content=createMap(pccSubkey,pccValue);
+    addMapsToMaps(&pmsMaps,pmsToAdd);
+    freeMaps(&pmsToAdd);
+    free(pmsToAdd);
   }
 }
@@ -1045,15 +1047,15 @@
  */
 elements* createEmptyElements(){
-  elements* res=(elements*)malloc(ELEMENTS_SIZE);
-  res->name=NULL;
-  res->content=NULL;
-  res->metadata=NULL;
-  res->additional_parameters=NULL;  
-  res->format=NULL;
-  res->defaults=NULL;
-  res->supported=NULL;
-  res->child=NULL;
-  res->next=NULL;
-  return res;
+  elements* peRes=(elements*)malloc(ELEMENTS_SIZE);
+  peRes->name=NULL;
+  peRes->content=NULL;
+  peRes->metadata=NULL;
+  peRes->additional_parameters=NULL;  
+  peRes->format=NULL;
+  peRes->defaults=NULL;
+  peRes->supported=NULL;
+  peRes->child=NULL;
+  peRes->next=NULL;
+  return peRes;
 }
 
@@ -1061,19 +1063,19 @@
  * Create a named elements
  *
- * @param name the elements name
+ * @param pcName the elements name
  * @return a pointer to the allocated elements
  */
-elements* createElements(const char* name){
-  elements* res=(elements*)malloc(ELEMENTS_SIZE);
-  res->name=zStrdup(name);
-  res->content=NULL;
-  res->metadata=NULL;
-  res->additional_parameters=NULL;
-  res->format=NULL;
-  res->defaults=NULL;
-  res->supported=NULL;
-  res->child=NULL;
-  res->next=NULL;
-  return res;
+elements* createElements(const char* pcName){
+  elements* peRes=(elements*)malloc(ELEMENTS_SIZE);
+  peRes->name=zStrdup(pcName);
+  peRes->content=NULL;
+  peRes->metadata=NULL;
+  peRes->additional_parameters=NULL;
+  peRes->format=NULL;
+  peRes->defaults=NULL;
+  peRes->supported=NULL;
+  peRes->child=NULL;
+  peRes->next=NULL;
+  return peRes;
 }
 
@@ -1081,17 +1083,18 @@
  * Set the name of an elements
  *
- * @param name the elements name
+ * @param peElem the elements to modify
+ * @param pcName the elements name
  * @return a pointer to the allocated elements
  */
-void setElementsName(elements** elem,char* name){
-  elements* res=*elem;
-  res->name=zStrdup(name);
-  res->content=NULL;
-  res->metadata=NULL;
-  res->format=NULL;
-  res->defaults=NULL;
-  res->supported=NULL;
-  res->child=NULL;
-  res->next=NULL;
+void setElementsName(elements** ppeElem,char* pcName){
+  elements* peRes=*ppeElem;
+  peRes->name=zStrdup(pcName);
+  peRes->content=NULL;
+  peRes->metadata=NULL;
+  peRes->format=NULL;
+  peRes->defaults=NULL;
+  peRes->supported=NULL;
+  peRes->child=NULL;
+  peRes->next=NULL;
 }
 
@@ -1099,39 +1102,39 @@
  * Dump an elements on stderr
  *
- * @param e the elements to dump
- */
-void dumpElements(elements* e){
-  elements* tmp=e;
-  while(tmp!=NULL){
-    iotype* tmpio=tmp->defaults;
+ * @param peElem the elements to dump
+ */
+void dumpElements(elements* peElem){
+  elements* peTmp=peElem;
+  while(peTmp!=NULL){
+    iotype* piotTmp=peTmp->defaults;
     int ioc=0;
-    fprintf(stderr,"ELEMENT [%s]\n",tmp->name);
-    fprintf(stderr," > CONTENT [%s]\n",tmp->name);
-    dumpMap(tmp->content);
-    fprintf(stderr," > METADATA [%s]\n",tmp->name);
-    dumpMap(tmp->metadata);
-    fprintf(stderr," > ADDITIONAL PARAMETERS [%s]\n",tmp->name);
-    dumpMap(tmp->additional_parameters);
-    fprintf(stderr," > FORMAT [%s]\n",tmp->format);
-    while(tmpio!=NULL){
-      fprintf(stderr," > DEFAULTS [%s] (%i)\n",tmp->name,ioc);
-      dumpMap(tmpio->content);
-      tmpio=tmpio->next;
+    fprintf(stderr,"ELEMENT [%s]\n",peTmp->name);
+    fprintf(stderr," > CONTENT [%s]\n",peTmp->name);
+    dumpMap(peTmp->content);
+    fprintf(stderr," > METADATA [%s]\n",peTmp->name);
+    dumpMap(peTmp->metadata);
+    fprintf(stderr," > ADDITIONAL PARAMETERS [%s]\n",peTmp->name);
+    dumpMap(peTmp->additional_parameters);
+    fprintf(stderr," > FORMAT [%s]\n",peTmp->format);
+    while(piotTmp!=NULL){
+      fprintf(stderr," > DEFAULTS [%s] (%i)\n",peTmp->name,ioc);
+      dumpMap(piotTmp->content);
+      piotTmp=piotTmp->next;
       ioc++;
     }
-    tmpio=tmp->supported;
+    piotTmp=peTmp->supported;
     ioc=0;
-    while(tmpio!=NULL){
-      fprintf(stderr," > SUPPORTED [%s] (%i)\n",tmp->name,ioc);
-      dumpMap(tmpio->content);
-      tmpio=tmpio->next;
+    while(piotTmp!=NULL){
+      fprintf(stderr," > SUPPORTED [%s] (%i)\n",peTmp->name,ioc);
+      dumpMap(piotTmp->content);
+      piotTmp=piotTmp->next;
       ioc++;
     }
-    if(tmp->child!=NULL){
+    if(peTmp->child!=NULL){
       fprintf(stderr," > CHILD \n");
-      dumpElements(tmp->child);
+      dumpElements(peTmp->child);
     }
     fprintf(stderr,"------------------\n");
-    tmp=tmp->next;
+    peTmp=peTmp->next;
   }
 }
@@ -1140,81 +1143,82 @@
  * Dump an elements on stderr using the YAML syntaxe
  *
- * @param e the elements to dump
- */
-void dumpElementsAsYAML(elements* e,int level){
-  elements* tmp=e;
+ * @param peElem the elements to dump
+ * @param iLevel the current level
+ */
+void dumpElementsAsYAML(elements* peElem,int iLevel){
+  elements* peTmp=peElem;
   int i;
-  while(tmp!=NULL){
-    map* mcurs=tmp->content;
+  while(peTmp!=NULL){
+    map* pmCurs=peTmp->content;
     int ioc=0;
-    iotype* tmpio;
-    for(i=0;i<2+(4*level);i++)
+    iotype* piotTmp;
+    for(i=0;i<2+(4*iLevel);i++)
       fprintf(stderr," ");
-    fprintf(stderr,"%s:\n",tmp->name);
-    while(mcurs!=NULL){
-      for(i=0;i<4+(4*level);i++)
+    fprintf(stderr,"%s:\n",peTmp->name);
+    while(pmCurs!=NULL){
+      for(i=0;i<4+(4*iLevel);i++)
 	fprintf(stderr," ");
-      _dumpMap(mcurs);
-      mcurs=mcurs->next;
-    }
-    mcurs=tmp->metadata;
-    if(mcurs!=NULL){
-      for(i=0;i<4+(4*level);i++)
+      _dumpMap(pmCurs);
+      pmCurs=pmCurs->next;
+    }
+    pmCurs=peTmp->metadata;
+    if(pmCurs!=NULL){
+      for(i=0;i<4+(4*iLevel);i++)
 	fprintf(stderr," ");
       fprintf(stderr,"MetaData:\n");
-      while(mcurs!=NULL){
-	for(i=0;i<6+(4*level);i++)
+      while(pmCurs!=NULL){
+	for(i=0;i<6+(4*iLevel);i++)
 	  fprintf(stderr," ");
-	_dumpMap(mcurs);
-	mcurs=mcurs->next;
+	_dumpMap(pmCurs);
+	pmCurs=pmCurs->next;
       }
     }
-    for(i=0;i<4+(4*level);i++)
+    for(i=0;i<4+(4*iLevel);i++)
       fprintf(stderr," ");
-    if(tmp->format!=NULL)
-      fprintf(stderr,"%s:\n",tmp->format);
+    if(peTmp->format!=NULL)
+      fprintf(stderr,"%s:\n",peTmp->format);
     else{
       fprintf(stderr,"Child:\n");
-      if(tmp->child!=NULL)
-	dumpElementsAsYAML(tmp->child,level+1);
-    }
-    tmpio=tmp->defaults;
-    while(tmpio!=NULL){
-      for(i=0;i<6+(4*level);i++)
+      if(peTmp->child!=NULL)
+	dumpElementsAsYAML(peTmp->child,iLevel+1);
+    }
+    piotTmp=peTmp->defaults;
+    while(piotTmp!=NULL){
+      for(i=0;i<6+(4*iLevel);i++)
 	fprintf(stderr," ");
       fprintf(stderr,"default:\n");
-      mcurs=tmpio->content;
-      while(mcurs!=NULL){
-	for(i=0;i<8+(4*level);i++)
+      pmCurs=piotTmp->content;
+      while(pmCurs!=NULL){
+	for(i=0;i<8+(4*iLevel);i++)
 	  fprintf(stderr," ");
-	if(strcasecmp(mcurs->name,"range")==0){
-	  fprintf(stderr,"range: \"%s\"\n",mcurs->value);
+	if(strcasecmp(pmCurs->name,"range")==0){
+	  fprintf(stderr,"range: \"%s\"\n",pmCurs->value);
 	}else
-	  _dumpMap(mcurs);
-	mcurs=mcurs->next;
+	  _dumpMap(pmCurs);
+	pmCurs=pmCurs->next;
       }
-      tmpio=tmpio->next;
+      piotTmp=piotTmp->next;
       ioc++;
     }
-    tmpio=tmp->supported;
+    piotTmp=peTmp->supported;
     ioc=0;
-    while(tmpio!=NULL){
-      for(i=0;i<6+(4*level);i++)
+    while(piotTmp!=NULL){
+      for(i=0;i<6+(4*iLevel);i++)
 	fprintf(stderr," ");
       fprintf(stderr,"supported:\n");
-      mcurs=tmpio->content;
-      while(mcurs!=NULL){
-	for(i=0;i<8+(4*level);i++)
+      pmCurs=piotTmp->content;
+      while(pmCurs!=NULL){
+	for(i=0;i<8+(4*iLevel);i++)
 	  fprintf(stderr," ");
-	if(strcasecmp(mcurs->name,"range")==0){
-	  fprintf(stderr,"range: \"%s\"\n",mcurs->value);
+	if(strcasecmp(pmCurs->name,"range")==0){
+	  fprintf(stderr,"range: \"%s\"\n",pmCurs->value);
 	}else
-	  _dumpMap(mcurs);
-	mcurs=mcurs->next;
+	  _dumpMap(pmCurs);
+	pmCurs=pmCurs->next;
       }
-      tmpio=tmpio->next;
+      piotTmp=piotTmp->next;
       ioc++;
     }
-    tmp=tmp->next;
+    peTmp=peTmp->next;
   }
 }
@@ -1223,11 +1227,11 @@
  * Duplicate an elements
  * 
- * @param e the elements to clone
+ * @param peElem the elements to clone
  * @return the allocated elements containing a copy of the elements e
  */
-elements* dupElements(elements* e){
-  elements* cursor=e;
-  elements* tmp=NULL;
-  if(cursor!=NULL && cursor->name!=NULL){
+elements* dupElements(elements* peElem){
+  elements* peCursor=peElem;
+  elements* peTmp=NULL;
+  if(peCursor!=NULL && peCursor->name!=NULL){
 #ifdef DEBUG
     fprintf(stderr,">> %s %i\n",__FILE__,__LINE__);
@@ -1235,54 +1239,54 @@
     fprintf(stderr,">> %s %i\n",__FILE__,__LINE__);
 #endif
-    tmp=(elements*)malloc(ELEMENTS_SIZE);
-    tmp->name=zStrdup(cursor->name);
-    tmp->content=NULL;
-    addMapToMap(&tmp->content,cursor->content);
-    tmp->metadata=NULL;
-    addMapToMap(&tmp->metadata,cursor->metadata);
-    tmp->additional_parameters=NULL;
-    addMapToMap(&tmp->additional_parameters,cursor->additional_parameters);
-    if(cursor->format!=NULL)
-      tmp->format=zStrdup(cursor->format);
+    peTmp=(elements*)malloc(ELEMENTS_SIZE);
+    peTmp->name=zStrdup(peCursor->name);
+    peTmp->content=NULL;
+    addMapToMap(&peTmp->content,peCursor->content);
+    peTmp->metadata=NULL;
+    addMapToMap(&peTmp->metadata,peCursor->metadata);
+    peTmp->additional_parameters=NULL;
+    addMapToMap(&peTmp->additional_parameters,peCursor->additional_parameters);
+    if(peCursor->format!=NULL)
+      peTmp->format=zStrdup(peCursor->format);
     else
-      tmp->format=NULL;
-    if(cursor->defaults!=NULL){
-      tmp->defaults=(iotype*)malloc(IOTYPE_SIZE);
-      tmp->defaults->content=NULL;
-      addMapToMap(&tmp->defaults->content,cursor->defaults->content);
-      tmp->defaults->next=NULL;
+      peTmp->format=NULL;
+    if(peCursor->defaults!=NULL){
+      peTmp->defaults=(iotype*)malloc(IOTYPE_SIZE);
+      peTmp->defaults->content=NULL;
+      addMapToMap(&peTmp->defaults->content,peCursor->defaults->content);
+      peTmp->defaults->next=NULL;
 #ifdef DEBUG
       fprintf(stderr,">> %s %i\n",__FILE__,__LINE__);
-      dumpMap(tmp->defaults->content);
+      dumpMap(peTmp->defaults->content);
 #endif
     }else
-      tmp->defaults=NULL;
-    if(cursor->supported!=NULL && cursor->supported->content!=NULL){
-      iotype *tmp2=cursor->supported->next;
-      tmp->supported=(iotype*)malloc(IOTYPE_SIZE);
-      tmp->supported->content=NULL;
-      addMapToMap(&tmp->supported->content,cursor->supported->content);
-      tmp->supported->next=NULL;
-            while(tmp2!=NULL){
-	addMapToIoType(&tmp->supported,tmp2->content);
+      peTmp->defaults=NULL;
+    if(peCursor->supported!=NULL && peCursor->supported->content!=NULL){
+      iotype *piotTmp=peCursor->supported->next;
+      peTmp->supported=(iotype*)malloc(IOTYPE_SIZE);
+      peTmp->supported->content=NULL;
+      addMapToMap(&peTmp->supported->content,peCursor->supported->content);
+      peTmp->supported->next=NULL;
+            while(piotTmp!=NULL){
+	addMapToIoType(&peTmp->supported,piotTmp->content);
 #ifdef DEBUG
 	fprintf(stderr,">> %s %i\n",__FILE__,__LINE__);
-	dumpMap(tmp->defaults->content);
+	dumpMap(peTmp->defaults->content);
 #endif
-	tmp2=tmp2->next;
+	piotTmp=piotTmp->next;
       }
     }
     else
-      tmp->supported=NULL;
-    if(cursor->child!=NULL)
-      tmp->child=dupElements(cursor->child);
+      peTmp->supported=NULL;
+    if(peCursor->child!=NULL)
+      peTmp->child=dupElements(peCursor->child);
     else
-      tmp->child=NULL;
-    if(cursor->next!=NULL)
-      tmp->next=dupElements(cursor->next);
+      peTmp->child=NULL;
+    if(peCursor->next!=NULL)
+      peTmp->next=dupElements(peCursor->next);
     else
-      tmp->next=NULL;
-  }
-  return tmp;
+      peTmp->next=NULL;
+  }
+  return peTmp;
 }
 
@@ -1291,13 +1295,13 @@
  *
  * @see dupElements
- * @param m the elements to add the e
- * @param e the elements to be added to m
- */
-void addToElements(elements** m,elements* e){
-  elements* tmp=e;
-  if(*m==NULL){
-    (*m)=dupElements(tmp);
+ * @param ppeElem the elements to add the e
+ * @param peELem the elements to be added to m
+ */
+void addToElements(elements** ppeElem,elements* peELem){
+  elements* peTmp=peELem;
+  if(*ppeElem==NULL){
+    (*ppeElem)=dupElements(peTmp);
   }else{
-    addToElements(&(*m)->next,tmp);
+    addToElements(&(*ppeElem)->next,peTmp);
   }
 }
@@ -1306,13 +1310,14 @@
  * Set the name of a service
  *
- * @param name the service name
- */
-void setServiceName(service** serv,char* name){
-  service* res=*serv;
-  res->name=zStrdup(name);
-  res->content=NULL;
-  res->metadata=NULL;
-  res->inputs=NULL;
-  res->outputs=NULL;
+ * @param ppsServ the service
+ * @param pcName the service name
+ */
+void setServiceName(service** ppsServ,char* pcName){
+  service* psRes=*ppsServ;
+  psRes->name=zStrdup(pcName);
+  psRes->content=NULL;
+  psRes->metadata=NULL;
+  psRes->inputs=NULL;
+  psRes->outputs=NULL;
 }
 
@@ -1320,27 +1325,27 @@
  * Dump a service on stderr
  *
- * @param s the service to dump
- */
-void dumpService(service* s){
-  if(s==NULL)
+ * @param psServ the service to dump
+ */
+void dumpService(service* psServ){
+  if(psServ==NULL)
     return;
-  fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",s->name);
-  if(s->content!=NULL){
+  fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",psServ->name);
+  if(psServ->content!=NULL){
     fprintf(stderr,"CONTENT MAP\n");
-    dumpMap(s->content);
-    if(s->metadata!=NULL)
+    dumpMap(psServ->content);
+    if(psServ->metadata!=NULL)
       fprintf(stderr,"CONTENT METADATA\n");
-    dumpMap(s->metadata);
-    if(s->additional_parameters!=NULL)
+    dumpMap(psServ->metadata);
+    if(psServ->additional_parameters!=NULL)
       fprintf(stderr,"CONTENT AdditionalParameters\n");
-    dumpMap(s->additional_parameters);
-  }
-  if(s->inputs!=NULL){
-    fprintf(stderr,"INPUT ELEMENTS [%s]\n------------------\n",s->name);
-    dumpElements(s->inputs);
-  }
-  if(s->outputs!=NULL){
-    fprintf(stderr,"OUTPUT ELEMENTS [%s]\n------------------\n",s->name);
-    dumpElements(s->outputs);
+    dumpMap(psServ->additional_parameters);
+  }
+  if(psServ->inputs!=NULL){
+    fprintf(stderr,"INPUT ELEMENTS [%s]\n------------------\n",psServ->name);
+    dumpElements(psServ->inputs);
+  }
+  if(psServ->outputs!=NULL){
+    fprintf(stderr,"OUTPUT ELEMENTS [%s]\n------------------\n",psServ->name);
+    dumpElements(psServ->outputs);
   }
   fprintf(stderr,"++++++++++++++++++\n");
@@ -1350,30 +1355,30 @@
  * Dump a service on stderr using the YAML syntaxe
  *
- * @param s the service to dump
- */
-void dumpServiceAsYAML(service* s){
+ * @param psServ the service to dump
+ */
+void dumpServiceAsYAML(service* psServ){
   int i;
-  fprintf(stderr,"# %s\n\n",s->name);
-  if(s->content!=NULL){
-    map* mcurs=s->content;
-    dumpMap(mcurs);
-    mcurs=s->metadata;
-    if(mcurs!=NULL){
+  fprintf(stderr,"# %s\n\n",psServ->name);
+  if(psServ->content!=NULL){
+    map* pmCurs=psServ->content;
+    dumpMap(pmCurs);
+    pmCurs=psServ->metadata;
+    if(pmCurs!=NULL){
       fprintf(stderr,"MetaData:\n");
-      while(mcurs!=NULL){
+      while(pmCurs!=NULL){
 	for(i=0;i<2;i++)
 	  fprintf(stderr," ");
-	_dumpMap(mcurs);
-	mcurs=mcurs->next;
+	_dumpMap(pmCurs);
+	pmCurs=pmCurs->next;
       }
     }
   }
-  if(s->inputs!=NULL){
+  if(psServ->inputs!=NULL){
     fprintf(stderr,"\ninputs:\n");
-    dumpElementsAsYAML(s->inputs,0);
-  }
-  if(s->outputs!=NULL){
+    dumpElementsAsYAML(psServ->inputs,0);
+  }
+  if(psServ->outputs!=NULL){
     fprintf(stderr,"\noutputs:\n");
-    dumpElementsAsYAML(s->outputs,0);
+    dumpElementsAsYAML(psServ->outputs,0);
   }
 }
@@ -1382,19 +1387,19 @@
  * Duplicate a service
  * 
- * @param s the service to clone
+ * @param psServ the service to clone
  * @return the allocated service containing a copy of the serfvice s
  */
-service* dupService(service* s){
-  service *res=(service*)malloc(SERVICE_SIZE);
-  res->name=zStrdup(s->name);
-  res->content=NULL;
-  addMapToMap(&res->content,s->content);
-  res->metadata=NULL;
-  addMapToMap(&res->metadata,s->metadata);
-  res->additional_parameters=NULL;
-  addMapToMap(&res->additional_parameters,s->additional_parameters);
-  res->inputs=dupElements(s->inputs);
-  res->outputs=dupElements(s->outputs);
-  return res;
+service* dupService(service* psServ){
+  service *psRes=(service*)malloc(SERVICE_SIZE);
+  psRes->name=zStrdup(psServ->name);
+  psRes->content=NULL;
+  addMapToMap(&psRes->content,psServ->content);
+  psRes->metadata=NULL;
+  addMapToMap(&psRes->metadata,psServ->metadata);
+  psRes->additional_parameters=NULL;
+  addMapToMap(&psRes->additional_parameters,psServ->additional_parameters);
+  psRes->inputs=dupElements(psServ->inputs);
+  psRes->outputs=dupElements(psServ->outputs);
+  return psRes;
 }
 
@@ -1402,17 +1407,17 @@
  * Print the registry on stderr.
  * 
- * @param r the registry
- */
-void dumpRegistry(registry* r){
-  registry* p=r;
-  while(p!=NULL){
-    services* s=p->content;
-    fprintf(stderr,"%s \n",p->name);
-    s=p->content;
-    while(s!=NULL){
-      dumpService(s->content);
-      s=s->next;
-    }
-    p=p->next;
+ * @param prReg the registry
+ */
+void dumpRegistry(registry* prReg){
+  registry* prCurs=prReg;
+  while(prCurs!=NULL){
+    services* psServ=prCurs->content;
+    fprintf(stderr,"%s \n",prCurs->name);
+    psServ=prCurs->content;
+    while(psServ!=NULL){
+      dumpService(psServ->content);
+      psServ=psServ->next;
+    }
+    prCurs=prCurs->next;
   }
 }
@@ -1421,10 +1426,10 @@
  * Add a service to the registry
  *
- * @param reg the resgitry to add the service
- * @param name the registry name to update
- * @param content the service to add
- */
-bool addServiceToRegistry(registry** reg,char* name,service* content){
-  registry *l=*reg;
+ * @param prReg the resgitry to add the service
+ * @param pcName the registry name to update
+ * @param psContent the service to add
+ */
+bool addServiceToRegistry(registry** prReg,char* pcName,service* psContent){
+  registry *l=*prReg;
   int isInitial=-1;
   if(l==NULL){
@@ -1435,5 +1440,5 @@
     int hasLevel=-1;
     while(isInitial<0 && l!=NULL){
-      if(l->name!=NULL && strcasecmp(name,l->name)==0){
+      if(l->name!=NULL && strcasecmp(pcName,l->name)==0){
 	hasLevel=1;
 	break;
@@ -1444,5 +1449,5 @@
       if(isInitial<0)
 	l=(registry*)malloc(REGISTRY_SIZE);
-      l->name=zStrdup(name);
+      l->name=zStrdup(pcName);
       l->content=NULL;
       l->next=NULL;
@@ -1450,24 +1455,24 @@
     if(l->content==NULL){
       l->content=(services*)malloc(SERVICES_SIZE);
-      l->content->content=dupService(content);
+      l->content->content=dupService(psContent);
       l->content->next=NULL;
     }
     else{
-      services* s=l->content;
-      while(s->next!=NULL)
-	s=s->next;
-      s->next=(services*)malloc(SERVICES_SIZE);
-      s->next->content=dupService(content);
-      s->next->next=NULL;
+      services* psServ=l->content;
+      while(psServ->next!=NULL)
+	psServ=psServ->next;
+      psServ->next=(services*)malloc(SERVICES_SIZE);
+      psServ->next->content=dupService(psContent);
+      psServ->next->next=NULL;
     }
     l->next=NULL;
     if(isInitial>0)
-      *reg=l;
+      *prReg=l;
     else{
-      registry *r=*reg;
-      while(r->next!=NULL)
-	r=r->next;
-      r->next=l;
-      r->next->next=NULL;
+      registry *prCurs=*prReg;
+      while(prCurs->next!=NULL)
+	prCurs=prCurs->next;
+      prCurs->next=l;
+      prCurs->next->next=NULL;
     }
     return true;
@@ -1480,21 +1485,21 @@
  * Free memory allocated for the registry
  *
- * @param r the registry
- */
-void freeRegistry(registry** r){
-  registry* lr=*r;
-  while(lr!=NULL){
-    services* s=lr->content;
-    free(lr->name);
-    while(s!=NULL){
-      service* s1=s->content;
-      s=s->next;
-      if(s1!=NULL){
-	freeService(&s1);
-	free(s1);
-	s1=NULL;
+ * @param prReg the registry
+ */
+void freeRegistry(registry** prReg){
+  registry* prLocalRef=*prReg;
+  while(prLocalRef!=NULL){
+    services* psServ=prLocalRef->content;
+    free(prLocalRef->name);
+    while(psServ!=NULL){
+      service* psServ1=psServ->content;
+      psServ=psServ->next;
+      if(psServ1!=NULL){
+	freeService(&psServ1);
+	free(psServ1);
+	psServ1=NULL;
       }
     }
-    lr=lr->next;
+    prLocalRef=prLocalRef->next;
   }    
 }
@@ -1503,22 +1508,22 @@
  * Access a service in the registry
  *
- * @param r the registry
- * @param level the regitry to search ("concept", "generic" or "implementation")
- * @param sname the service name
+ * @param prReg the registry
+ * @param pcLevel the regitry to search ("concept", "generic" or "implementation")
+ * @param pcName the service name
  * @return the service pointer if a corresponding service was found or NULL
  */
-service* getServiceFromRegistry(registry* r,char  *level,char* sname){
-  registry *lr=r;
-  while(lr!=NULL){
-    if(strcasecmp(lr->name,level)==0){
-      services* s=lr->content;
-      while(s!=NULL){
-	if(s->content!=NULL && strcasecmp(s->content->name,sname)==0)
-	  return s->content;
-	s=s->next;
+service* getServiceFromRegistry(registry* prReg,char  *pcLevel,char* pcName){
+  registry *prLocalRef=prReg;
+  while(prLocalRef!=NULL){
+    if(strcasecmp(prLocalRef->name,pcLevel)==0){
+      services* psServ=prLocalRef->content;
+      while(psServ!=NULL){
+	if(psServ->content!=NULL && strcasecmp(psServ->content->name,pcName)==0)
+	  return psServ->content;
+	psServ=psServ->next;
       }
       break;
     }
-    lr=lr->next;
+    prLocalRef=prLocalRef->next;
   }
   return NULL;
@@ -1528,18 +1533,18 @@
  * Apply inheritance to an out map from a reference in map
  *
- * @param out the map to update
- * @param in the reference map (containing inherited properties)
- */
-void inheritMap(map** out,map* in){
-  map* content=in;
-  if((*out)==NULL){
-    addMapToMap(out,in);
+ * @param ppmOut the map to update
+ * @param pmIn the reference map (containing inherited properties)
+ */
+void inheritMap(map** ppmOut,map* pmIn){
+  map* pmContent=pmIn;
+  if((*ppmOut)==NULL){
+    addMapToMap(ppmOut,pmIn);
     return;
   }
-  while(content!=NULL){
-    map* cmap=getMap(*out,content->name);
-    if(cmap==NULL)
-      addToMap(*out,content->name,content->value);
-    content=content->next;
+  while(pmContent!=NULL){
+    map* pmCurrent=getMap(*ppmOut,pmContent->name);
+    if(pmCurrent==NULL)
+      addToMap(*ppmOut,pmCurrent->name,pmCurrent->value);
+    pmCurrent=pmCurrent->next;
   }
 }
@@ -1548,20 +1553,20 @@
  * Apply inheritance to an out iotype from a reference in iotype
  * 
- * @param out the iotype to update
- * @param in the reference iotype (containing inherited properties)
- */
-void inheritIOType(iotype** out,iotype* in){
-  iotype* io=in;
-  iotype* oio=*out;
-  if(io!=NULL){
-    if(*out==NULL){
-      *out=(iotype*)malloc(IOTYPE_SIZE);
-      (*out)->content=NULL;
-      addMapToMap(&(*out)->content,io->content);
-      (*out)->next=NULL;
-      oio=*out;
-      inheritIOType(&oio->next,io->next);
+ * @param ppiotOut the iotype to update
+ * @param piotIn the reference iotype (containing inherited properties)
+ */
+void inheritIOType(iotype** ppiotOut,iotype* piotIn){
+  iotype* piotInCurosor=piotIn;
+  iotype* ppiotOutCursor=*ppiotOut;
+  if(piotInCurosor!=NULL){
+    if(*ppiotOut==NULL){
+      *ppiotOut=(iotype*)malloc(IOTYPE_SIZE);
+      (*ppiotOut)->content=NULL;
+      addMapToMap(&(*ppiotOut)->content,piotInCurosor->content);
+      (*ppiotOut)->next=NULL;
+      ppiotOutCursor=*ppiotOut;
+      inheritIOType(&ppiotOutCursor->next,piotInCurosor->next);
     }else{
-      inheritIOType(&oio->next,io->next);
+      inheritIOType(&ppiotOutCursor->next,piotInCurosor->next);
     }
   }
@@ -1571,30 +1576,30 @@
  * Apply inheritance to an out elements from a reference in elements
  * 
- * @param out the elements to update
- * @param in the reference elements (containing inherited properties)
- */
-void inheritElements(elements** out,elements* in){
-  elements* content=in;
-  while(content!=NULL && *out!=NULL){
-    elements* cmap=getElements(*out,content->name);
-    if(cmap==NULL)
-      addToElements(out,content);
+ * @param ppeOut the elements to update
+ * @param peIn the reference elements (containing inherited properties)
+ */
+void inheritElements(elements** ppeOut,elements* peIn){
+  elements* peContent=peIn;
+  while(peContent!=NULL && *ppeOut!=NULL){
+    elements* peCurrent=getElements(*ppeOut,peContent->name);
+    if(peCurrent==NULL)
+      addToElements(ppeOut,peContent);
     else{
-      inheritMap(&cmap->content,content->content);
-      inheritMap(&cmap->metadata,content->metadata);
-      if(cmap->format==NULL && content->format!=NULL)
-	cmap->format=zStrdup(content->format);
-      inheritIOType(&cmap->defaults,content->defaults);
-      if(cmap->supported==NULL)
-	inheritIOType(&cmap->supported,content->supported);
+      inheritMap(&peCurrent->content,peContent->content);
+      inheritMap(&peCurrent->metadata,peContent->metadata);
+      if(peCurrent->format==NULL && peContent->format!=NULL)
+	peCurrent->format=zStrdup(peContent->format);
+      inheritIOType(&peCurrent->defaults,peContent->defaults);
+      if(peCurrent->supported==NULL)
+	inheritIOType(&peCurrent->supported,peContent->supported);
       else{
-	iotype* p=content->supported;
-	while(p!=NULL){
-	  addMapToIoType(&cmap->supported,p->content);
-	  p=p->next;
+	iotype* piotTmp=peContent->supported;
+	while(piotTmp!=NULL){
+	  addMapToIoType(&peCurrent->supported,piotTmp->content);
+	  piotTmp=piotTmp->next;
 	}
       }
     }
-    content=content->next;
+    peContent=peContent->next;
   }
 }
@@ -1603,34 +1608,34 @@
  * Apply inheritance to a service based on a registry
  * 
- * @param r the registry storing profiles hierarchy
- * @param s the service to update depending on its inheritance
- */
-void inheritance(registry *r,service** s){
-  service* ls=*s;
+ * @param prReg the registry storing profiles hierarchy
+ * @param psServ the service to update depending on its inheritance
+ */
+void inheritance(registry *prReg,service** psServ){
+  service* psCursor=*psServ;
   map *profile,*level;
-  if(r==NULL)
+  if(prReg==NULL)
     return;
-  if(ls==NULL || ls->content==NULL)
+  if(psCursor==NULL || psCursor->content==NULL)
     return;
-  profile=getMap(ls->content,"extend");
-  level=getMap(ls->content,"level");
+  profile=getMap(psCursor->content,"extend");
+  level=getMap(psCursor->content,"level");
   if(profile!=NULL&&level!=NULL){
     service* s1;
     if(strncasecmp(level->value,"profile",7)==0)
-      s1=getServiceFromRegistry(r,(char*)"generic",profile->value);
+      s1=getServiceFromRegistry(prReg,(char*)"generic",profile->value);
     else
-      s1=getServiceFromRegistry(r,level->value,profile->value);
+      s1=getServiceFromRegistry(prReg,level->value,profile->value);
       
-    inheritMap(&ls->content,s1->content);
-    inheritMap(&ls->metadata,s1->metadata);
-    if(ls->inputs==NULL && s1->inputs!=NULL){
-      ls->inputs=dupElements(s1->inputs);
+    inheritMap(&psCursor->content,s1->content);
+    inheritMap(&psCursor->metadata,s1->metadata);
+    if(psCursor->inputs==NULL && s1->inputs!=NULL){
+      psCursor->inputs=dupElements(s1->inputs);
     }else{
-      inheritElements(&ls->inputs,s1->inputs);
-    }
-    if(ls->outputs==NULL && s1->outputs!=NULL){
-      ls->outputs=dupElements(s1->outputs);
+      inheritElements(&psCursor->inputs,s1->inputs);
+    }
+    if(psCursor->outputs==NULL && s1->outputs!=NULL){
+      psCursor->outputs=dupElements(s1->outputs);
     }else
-      inheritElements(&ls->outputs,s1->outputs);
+      inheritElements(&psCursor->outputs,s1->outputs);
   }
 }
@@ -1639,35 +1644,35 @@
  * Convert a maps to a char*** (only used for Fortran support)
  *
- * @param m the maps to convert
- * @param c the resulting array
- */
-void mapsToCharXXX(maps* m,char*** c){
-  maps* tm=m;
+ * @param pmsMap the maps to convert
+ * @param pppcValues the resulting array
+ */
+void mapsToCharXXX(maps* pmsMap,char*** pppcValues){
+  maps* pmsCursor=pmsMap;
   int i=0;
   int j=0;
-  char tmp[10][30][1024];
-  memset(tmp,0,1024*10*10);
-  while(tm!=NULL){
-    map* tc=tm->content;
+  char aaacTmp[10][30][1024];
+  memset(aaacTmp,0,1024*10*10);
+  while(pmsCursor!=NULL){
+    map* pmContent=pmsCursor->content;
     if(i>=10)
       break;
-    strcpy(tmp[i][j],"name");
+    strcpy(aaacTmp[i][j],"name");
     j++;
-    strcpy(tmp[i][j],tm->name);
+    strcpy(aaacTmp[i][j],pmsCursor->name);
     j++;
-    while(tc!=NULL){
+    while(pmContent!=NULL){
       if(j>=30)
 	break;
-      strcpy(tmp[i][j],tc->name);
+      strcpy(aaacTmp[i][j],pmContent->name);
       j++;
-      strcpy(tmp[i][j],tc->value);
+      strcpy(aaacTmp[i][j],pmContent->value);
       j++;
-      tc=tc->next;
-    }
-    tm=tm->next;
+      pmContent=pmContent->next;
+    }
+    pmsCursor=pmsCursor->next;
     j=0;
     i++;
   }
-  memcpy(c,tmp,10*10*1024);
+  memcpy(pppcValues,aaacTmp,10*10*1024);
 }
 
@@ -1675,29 +1680,29 @@
  * Convert a char*** to a maps (only used for Fortran support)
  *
- * @param c the array to convert
- * @param m the resulting maps
- */
-void charxxxToMaps(char*** c,maps**m){
-  maps* trorf=*m;
+ * @param pppcValues the array to convert
+ * @param ppmsMaps the resulting maps
+ */
+void charxxxToMaps(char*** pppcValues,maps** ppmsMaps){
+  maps* pmsCursor=*ppmsMaps;
   int i,j;
-  char tmp[10][30][1024];
-  memcpy(tmp,c,10*30*1024);
+  char aaaTmp[10][30][1024];
+  memcpy(aaaTmp,pppcValues,10*30*1024);
   for(i=0;i<10;i++){
-    if(strlen(tmp[i][1])==0)
+    if(strlen(aaaTmp[i][1])==0)
       break;
-    trorf->name=tmp[i][1];
-    trorf->content=NULL;
-    trorf->next=NULL;
+    pmsCursor->name=aaaTmp[i][1];
+    pmsCursor->content=NULL;
+    pmsCursor->next=NULL;
     for(j=2;j<29;j+=2){
-      if(strlen(tmp[i][j+1])==0)
+      if(strlen(aaaTmp[i][j+1])==0)
 	break;
-      if(trorf->content==NULL)
-	trorf->content=createMap(tmp[i][j],tmp[i][j+1]);
+      if(pmsCursor->content==NULL)
+	pmsCursor->content=createMap(aaaTmp[i][j],aaaTmp[i][j+1]);
       else
-	addToMap(trorf->content,tmp[i][j],tmp[i][j+1]);
-    }
-    trorf=trorf->next;
-  }
-  m=&trorf;
+	addToMap(pmsCursor->content,aaaTmp[i][j],aaaTmp[i][j+1]);
+    }
+    pmsCursor=pmsCursor->next;
+  }
+  ppmsMaps=&pmsCursor;
 }
 
@@ -1705,9 +1710,9 @@
  * Verify that a map has a value
  *
- * @param map pointer to map that should be checked
+ * @param pmMap pointer to map that should be checked
  * @return true if map has a value or false if value is missing/empty/NULL
  */
-bool nonempty(map* map) {
-	return (map != NULL && map->value != NULL && strlen(map->value) > 0 && strcmp(map->value, "NULL") != 0);
+bool nonempty(map* pmMap) {
+  return (pmMap != NULL && pmMap->value != NULL && strlen(pmMap->value) > 0 && strcmp(pmMap->value, "NULL") != 0);
 }
 
@@ -1716,16 +1721,16 @@
  * data structure, and obtain that value
  *
- * @param source pointer to maps structure
- * @param node name of maps node to search
- * @param key name of map node to find
- * @param kvp address to the map* if it exists, otherwise NULL
+ * @param pmsSource pointer to maps structure
+ * @param pccNode name of maps node to search
+ * @param pccKey name of map node to find
+ * @param ppmKvp address to the map* if it exists, otherwise NULL
  * @return true if map has a value or false if value is missing/NULL
  *
  * @note The map assigned to kvp is owned by the source maps
  */
-bool hasvalue(maps* source, const char* node, const char* key, map** kvp) {
-	*kvp = getMapFromMaps(source, node, key);
-	return (*kvp != NULL && (*kvp)->value != NULL &&
-		strlen((*kvp)->value) > 0 && strcmp((*kvp)->value, "NULL") != 0);
+bool hasvalue(maps* pmsSource, const char* pccNode, const char* pccKey, map** ppmKvp) {
+  *ppmKvp = getMapFromMaps(pmsSource, pccNode, pccKey);
+  return (*ppmKvp != NULL && (*ppmKvp)->value != NULL &&
+	  strlen((*ppmKvp)->value) > 0 && strcmp((*ppmKvp)->value, "NULL") != 0);
 }
 
@@ -1733,76 +1738,82 @@
  * Set error message in configuration maps
  *
- * @param conf reference to configuration maps
- * @param service name of service
- * @param exc WPSException code
- * @param message exception text (default: exception text in WPS specification)
- */
-void setErrorMessage(maps*& conf, const char* service, WPSException exc, const char* message) {
-
-	if (message == NULL) {
-		message = WPSExceptionText[exc];
-	}
-
-	size_t len = strlen(service) + strlen(": ") + strlen(message) + strlen(": ") + strlen(WPSExceptionCode[exc]) + 16;
-	char* msg = (char*)malloc(len * sizeof(char));
-
-	if (msg != NULL) {
-		snprintf(msg, len * sizeof(char), "\n%s: %s: %s\n", service, message, WPSExceptionCode[exc]);
-		setMapInMaps(conf, "lenv", "message", msg);
-		free(msg);
-	}
-}
-
-void logMessage(const char* source, const char* function, int line, const char* file, const char* message) { //, const char* source, const char* function, int line) {
-
-	size_t msglen = 512;
-	const char empty[] = "";
-
-	FILE* log;
-
-	// system time, process time [nanoseconds]   
-	unsigned long long sys_t, proc_t;
-
-	// processor time consumed by the program:
-	clock_t t = clock();
-
-	// system time:
-	std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
-
-	std::time_t now_t = std::chrono::system_clock::to_time_t(now);
-	std::tm* tm = localtime(&now_t);
-	char* str = asctime(tm);
-	str[strlen(str) - 1] = '\0'; // remove newline
-
-	sys_t = std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()).count();
-	//proc_t = (unsigned long long)(1.0e9*t/CLOCKS_PER_SEC);
-	proc_t = t;
-
-	if (message != NULL) {
-		msglen += strlen(message);
-	}
-	else {
-		message = empty;
-	}
-	//getLastErrorMessage(); // cgiScriptName  
-	char* text = (char*)malloc(sizeof(char)*msglen);
-
-	snprintf(text, msglen, "pid: %d %s line %d %s() %s systime: %lld ns ticks: %lld %s\n",
-		zGetpid(), source, line, function, str, sys_t, proc_t, message); // __FILE__ __LINE__ __func__ //
-
-	if (file != NULL && (log = fopen(file, "a+")) != NULL) {
-		fputs(text, log);
-		fclose(log);
-	}
-	else {
+ * @param pmsaConf reference to configuration maps
+ * @param pccService name of service
+ * @param weExc WPSException code
+ * @param pccMessage exception text (default: exception text in WPS specification)
+ */
+void setErrorMessage(maps*& pmsaConf, const char* pccService, WPSException weExc, const char* pccMessage) {
+  if (pccMessage == NULL) {
+    pccMessage = WPSExceptionText[weExc];
+  }
+  size_t len = strlen(pccService) + strlen(": ") + strlen(pccMessage) + strlen(": ") + strlen(WPSExceptionCode[weExc]) + 16;
+  char* pcMsg = (char*)malloc(len * sizeof(char));
+  if (pcMsg != NULL) {
+    snprintf(pcMsg, len * sizeof(char), "\n%s: %s: %s\n", pccService, pccMessage, WPSExceptionCode[weExc]);
+    setMapInMaps(pmsaConf, "lenv", "message", pcMsg);
+    free(pcMsg);
+  }
+}
+
+/**
+ * Print debug message
+ *
+ * @param pccSource the file invoking the function
+ * @param pccFunction the function calling for logMessage
+ * @param iLine the line number
+ * @param pccFile the file to log informations
+ * @param pccMessage the message to be print
+ */
+void logMessage(const char* pccSource, const char* pccFunction, int iLne, const char* pccFile, const char* pccMessage) { //, const char* source, const char* function, int line) {
+
+  size_t msglen = 512;
+  const char empty[] = "";
+
+  FILE* pfLog;
+
+  // system time, process time [nanoseconds]   
+  unsigned long long sys_t, proc_t;
+
+  // processor time consumed by the program:
+  clock_t t = clock();
+
+  // system time:
+  std::chrono::system_clock::time_point now = std::chrono::system_clock::now();
+
+  std::time_t now_t = std::chrono::system_clock::to_time_t(now);
+  std::tm* tm = localtime(&now_t);
+  char* pcStr = asctime(tm);
+  pcStr[strlen(pcStr) - 1] = '\0'; // remove newline
+
+  sys_t = std::chrono::duration_cast<std::chrono::nanoseconds>(now.time_since_epoch()).count();
+  //proc_t = (unsigned long long)(1.0e9*t/CLOCKS_PER_SEC);
+  proc_t = t;
+
+  if (pccMessage != NULL) {
+    msglen += strlen(pccMessage);
+  }
+  else {
+    pccMessage = empty;
+  }
+  //getLastErrorMessage(); // cgiScriptName  
+  char* pcText = (char*)malloc(sizeof(char)*msglen);
+
+  snprintf(pcText, msglen, "pid: %d %s line %d %s() %s systime: %lld ns ticks: %lld %s\n",
+	   zGetpid(), pccSource, iLne, pccFunction, pcStr, sys_t, proc_t, pccMessage); // __FILE__ __LINE__ __func__ //
+
+  if (pccFile != NULL && (pfLog = fopen(pccFile, "a+")) != NULL) {
+    fputs(pcText, pfLog);
+    fclose(pfLog);
+  }
+  else {
 #ifdef MSG_LOG_FILE
-		if ((log = fopen(MSG_LOG_FILE, "a+")) != NULL) {
-			fputs(text, log);
-			fclose(log);
-		}
+    if ((pfLog = fopen(MSG_LOG_FILE, "a+")) != NULL) {
+      fputs(pcText, pfLog);
+      fclose(pfLog);
+    }
 #endif
-	}
-
-	if (text != NULL) free(text);
+  }
+
+  if (pcText != NULL) free(pcText);
 }
 
@@ -1815,15 +1826,15 @@
 #ifdef WIN32
 #ifndef USE_MS
-char *strcasestr (char const *a, char const *b)
+char *strcasestr (char const *pccA, char const *pccB)
   {
-    char *x = zStrdup (a);
-    char *y = zStrdup (b);
+    char *pcX = zStrdup (pccA);
+    char *pcY = zStrdup (pccB);
  
-      x = _strlwr (x);
-      y = _strlwr (y);
-    char *pos = strstr (x, y);
-    char *ret = pos == NULL ? NULL : (char *) (a + (pos - x));
-      free (x);
-      free (y);
+      pcX = _strlwr (pcX);
+      pcY = _strlwr (pcY);
+    char *pos = strstr (pcX, pcY);
+    char *ret = pos == NULL ? NULL : (char *) (pccA + (pos - pcX));
+      free (pcX);
+      free (pcY);
       return ret;
   };
@@ -1843,15 +1854,15 @@
  * The memory should be deallocated by calling freeMap.
  */
-char* allocateMapValue(map* node, size_t num_bytes)
+char* allocateMapValue(map* pmNode, size_t sNumBytes)
 {
-	if (node == NULL) {
-		return NULL;
-	}
-
-	if (node->value != NULL) {
-		free(node->value);
-	}
-	node->value = (char*) malloc(num_bytes);
+  if (pmNode == NULL) {
+    return NULL;
+  }
+
+  if (pmNode->value != NULL) {
+    free(pmNode->value);
+  }
+  pmNode->value = (char*) malloc(sNumBytes);
 		
-	return node->value;
-}
+  return pmNode->value;
+}
Index: trunk/zoo-project/zoo-kernel/service_internal_python.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/service_internal_python.c	(revision 967)
@@ -468,5 +468,5 @@
   while(tmp!=NULL){
     PyObject* name=PyString_FromString(tmp->name);
-    if(strcasecmp(tmp->name,"value")==0 && strlen(tmp->value)>0) {
+    if(strcasecmp(tmp->name,"value")==0) {
       if(isArray!=NULL){
 	map* len=getMap(tmp,"length");
@@ -492,6 +492,9 @@
 	      lvalue=PyString_FromString(vMap->value);
 	    }
-	    else{    
-	      lvalue=PyString_FromStringAndSize(vMap->value,atoi(sMap->value));
+	    else{
+	      if(strlen(vMap->value)>0)
+		lvalue=PyString_FromStringAndSize(vMap->value,atoi(sMap->value));
+	      else
+		lvalue=Py_None;
 	    }
 	    if(sMap!=NULL){
@@ -553,5 +556,9 @@
       }
       else if(size!=NULL && useFile==NULL){
-	PyObject* value=PyString_FromStringAndSize(tmp->value,atoi(size->value));
+	PyObject* value;
+	if(strlen(tmp->value)>0)
+	  value=PyString_FromStringAndSize(tmp->value,atoi(size->value));
+	else
+	  value=Py_None;
 	if(PyDict_SetItem(res,name,value)<0){
 	  Py_DECREF(value);
@@ -572,5 +579,5 @@
     }
     else{
-      if(PyDict_GetItem(res,name)==NULL && strlen(tmp->value)>0){
+      if(PyDict_GetItem(res,name)==NULL){
 	PyObject* value=PyString_FromString(tmp->value);
 	if(PyDict_SetItem(res,name,value)<0){
Index: trunk/zoo-project/zoo-kernel/service_json.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_json.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/service_json.c	(revision 967)
@@ -603,27 +603,9 @@
     
     map* tmp=getMap(s,"code");
+    exceptionCode=produceStatusString(m,tmp);    
     if(tmp!=NULL){
-      if(strcmp(tmp->value,"OperationNotSupported")==0 ||
-	 strcmp(tmp->value,"NoApplicableCode")==0)
-	exceptionCode="500 Not Implemented";
-      else
-	if(strcmp(tmp->value,"MissingParameterValue")==0 ||
-	   strcmp(tmp->value,"InvalidUpdateSequence")==0 ||
-	   strcmp(tmp->value,"OptionNotSupported")==0 ||
-	   strcmp(tmp->value,"VersionNegotiationFailed")==0 ||
-	   strcmp(tmp->value,"InvalidParameterValue")==0)
-	  exceptionCode="400 Bad request";
-	else
-	  if(strcmp(tmp->value,"NotFound")==0 ||
-	     strcmp(tmp->value,"NoSuchProcess")==0 ||
-	     strcmp(tmp->value,"NoSuchJob")==0 ||
-	     strcmp(tmp->value,"ResultNotReady")==0)
-	    exceptionCode="404 Not Found";
-	  else
-	    exceptionCode="500 Internal Server Error";
       json_object_object_add(res,"code",json_object_new_string(tmp->value));
     }
     else{
-      exceptionCode="500 Internal Server Error";
       json_object_object_add(res,"code",json_object_new_string("NoApplicableCode"));
     }
@@ -716,37 +698,36 @@
     json_object* json_cinput=NULL;
     if(json_object_object_get_ex(req,"value",&json_cinput)!=FALSE){
+      output->content=createMap("value",json_object_get_string(json_cinput));
+    }
+    else{
       json_object* json_value=NULL;
-      if(json_object_object_get_ex(json_cinput,"inlineValue",&json_value)!=FALSE)
-	output->content=createMap("value",json_object_get_string(json_value));
-      else{
-	if(json_object_object_get_ex(json_cinput,"href",&json_value)!=FALSE){
-	  output->content=createMap("xlink:href",json_object_get_string(json_value));
-	  int len=0;
-	  int createdStr=0;
-	  char *tmpStr="url";
-	  char *tmpStr1="input";
-	  if(getMaps(conf,"http_requests")==NULL){
-	    maps* tmpMaps=createMaps("http_requests");
-	    tmpMaps->content=createMap("length","1");
-	    addMapsToMaps(&conf,tmpMaps);
-	    freeMaps(&tmpMaps);
-	    free(tmpMaps);
-	  }else{
-	    map* tmpMap=getMapFromMaps(conf,"http_requests","length");
-	    int len=atoi(tmpMap->value);
-	    createdStr=1;
-	    tmpStr=(char*) malloc((12)*sizeof(char));
-	    sprintf(tmpStr,"%d",len+1);
-	    setMapInMaps(conf,"http_requests","length",tmpStr);
-	    sprintf(tmpStr,"url_%d",len);
-	    tmpStr1=(char*) malloc((14)*sizeof(char));
-	    sprintf(tmpStr1,"input_%d",len);
-	  }
-	  setMapInMaps(conf,"http_requests",tmpStr,json_object_get_string(json_value));
-	  setMapInMaps(conf,"http_requests",tmpStr1,name);
-	  if(createdStr>0){
-	    free(tmpStr);
-	    free(tmpStr1);
-	  }
+      if(json_object_object_get_ex(req,"href",&json_value)!=FALSE){
+	output->content=createMap("xlink:href",json_object_get_string(json_value));
+	int len=0;
+	int createdStr=0;
+	char *tmpStr="url";
+	char *tmpStr1="input";
+	if(getMaps(conf,"http_requests")==NULL){
+	  maps* tmpMaps=createMaps("http_requests");
+	  tmpMaps->content=createMap("length","1");
+	  addMapsToMaps(&conf,tmpMaps);
+	  freeMaps(&tmpMaps);
+	  free(tmpMaps);
+	}else{
+	  map* tmpMap=getMapFromMaps(conf,"http_requests","length");
+	  int len=atoi(tmpMap->value);
+	  createdStr=1;
+	  tmpStr=(char*) malloc((12)*sizeof(char));
+	  sprintf(tmpStr,"%d",len+1);
+	  setMapInMaps(conf,"http_requests","length",tmpStr);
+	  sprintf(tmpStr,"url_%d",len);
+	  tmpStr1=(char*) malloc((14)*sizeof(char));
+	  sprintf(tmpStr1,"input_%d",len);
+	}
+	setMapInMaps(conf,"http_requests",tmpStr,json_object_get_string(json_value));
+	setMapInMaps(conf,"http_requests",tmpStr1,name);
+	if(createdStr>0){
+	  free(tmpStr);
+	  free(tmpStr1);
 	}
       }
@@ -807,5 +788,127 @@
 
   /**
-   * Parse inputs / outputs
+   * Parse a single input / output entity
+   *
+   * @param conf the maps containing the settings of the main.cfg file
+   * @param ioElements the elements extracted from the zcfg
+   * @param ioMaps the produced maps containing inputs (or outputs) 
+   * @param ioType the char* set to inputs or outputs
+   * @param key char* the input/output name
+   * @param val json_object pointing to the input/output
+   * @param cMaps the outputed maps containing input (or output) metedata 
+   */
+  void _parseJIOSingle(maps* conf,elements* cio, maps** ioMaps,const char* ioType,const char* key,json_object* val,maps* cMaps){
+    json_object* json_cinput;
+    if(json_object_object_get_ex(val,"dataType",&json_cinput)!=FALSE){
+      parseJLiteral(conf,val,cio,cMaps);
+    } else if(json_object_object_get_ex(val,"format",&json_cinput)!=FALSE){
+      parseJComplex(conf,val,cio,cMaps,key);
+    } else if(json_object_object_get_ex(val,"bbox",&json_cinput)!=FALSE){
+      parseJBoundingBox(conf,val,cio,cMaps);
+    }// else error!
+    else{
+      if(json_object_object_get_ex(val,"value",&json_cinput)!=FALSE){
+	map* error=createMap("code","BadRequest");
+	char tmpS[1024];
+	sprintf(tmpS,_("Missing input for %s"),cio->name);
+	addToMap(error,"message",tmpS);
+	setMapInMaps(conf,"lenv","status_code","400 Bad Request");
+	printExceptionReportResponseJ(conf,error);
+	return;
+      }else{
+	if(json_object_get_type(json_cinput)==json_type_string){
+	  parseJLiteral(conf,val,cio,cMaps);
+	}else if(json_object_get_type(json_cinput)==json_type_object){
+	  json_object* json_ccinput=NULL;
+	  if(json_object_object_get_ex(json_cinput,"bbox",&json_ccinput)!=FALSE){
+	    parseJComplex(conf,val,cio,cMaps,key);
+	  }
+	  else{
+	    parseJBoundingBox(conf,val,cio,cMaps);
+	  }
+	}else{
+	  if(strcmp(ioType,"input")==0){
+	    map* error=createMap("code","BadRequest");
+	    char tmpS1[1024];
+	    sprintf(tmpS1,_("Issue with input %s"),cio->name);
+	    addToMap(error,"message",tmpS1);
+	    setMapInMaps(conf,"lenv","status_code","400 Bad Request");
+	    printExceptionReportResponseJ(conf,error);
+	    return;
+	  }
+	}
+      }
+    }    
+  }
+  
+  /**
+   * Parse a single input / output entity that can be an array 
+   *
+   * @param conf the maps containing the settings of the main.cfg file
+   * @param ioElements the elements extracted from the zcfg
+   * @param ioMaps the produced maps containing inputs (or outputs) 
+   * @param ioType the char* set to inputs or outputs
+   * @param key char* the input/output name
+   * @param val json_object pointing to the input/output
+   */
+  void parseJIOSingle(maps* conf,elements* ioElements, maps** ioMaps,const char* ioType,const char* key,json_object* val){
+    maps *cMaps=NULL;
+    cMaps=createMaps(key);
+    elements* cio=getElements(ioElements,key);    
+    if(json_object_is_type(val,json_type_array)){
+      int i=0;
+      size_t len=json_object_array_length(val);
+      for(i=0;i<len;i++){
+	json_object* json_current_io=json_object_array_get_idx(val,i);
+	maps* pmsExtra=createMaps(key);
+	_parseJIOSingle(conf,cio,ioMaps,ioType,key,json_current_io,pmsExtra);
+	map* pmCtx=pmsExtra->content;
+	while(pmCtx!=NULL){
+	  if(cMaps->content==NULL)
+	    cMaps->content=createMap(pmCtx->name,pmCtx->value);
+	  else
+	    setMapArray(cMaps->content,pmCtx->name,i,pmCtx->value);
+	  pmCtx=pmCtx->next;
+	}
+	freeMaps(&pmsExtra);
+	free(pmsExtra);
+      }
+    }else{
+      _parseJIOSingle(conf,cio,ioMaps,ioType,key,val,cMaps);
+    }
+
+    
+    if(strcmp(ioType,"outputs")==0){
+      // Outputs
+      json_object* json_cinput;
+      if(json_object_object_get_ex(val,"transmissionMode",&json_cinput)!=FALSE){
+	if(cMaps->content==NULL)
+	  cMaps->content=createMap("transmissionMode",json_object_get_string(json_cinput));
+	else
+	  addToMap(cMaps->content,"transmissionMode",json_object_get_string(json_cinput));
+      }
+      if(json_object_object_get_ex(val,"format",&json_cinput)!=FALSE){
+	json_object_object_foreach(json_cinput, key1, val1) {
+	  if(cMaps->content==NULL)
+	    cMaps->content=createMap(key1,json_object_get_string(val1));
+	  else
+	    addToMap(cMaps->content,key1,json_object_get_string(val1));
+	}
+      }
+    }
+
+    addToMap(cMaps->content,"inRequest","true");
+    if (ioMaps == NULL)
+      *ioMaps = dupMaps(&cMaps);
+    else
+      addMapsToMaps (ioMaps, cMaps);
+
+    freeMaps(&cMaps);
+    free(cMaps);    
+  }
+  
+  /**
+   * Parse all the inputs / outputs entities
+   *
    * @param conf the maps containing the settings of the main.cfg file
    * @param req json_object pointing to the input/output
@@ -816,90 +919,24 @@
   void parseJIO(maps* conf, json_object* req, elements* ioElements, maps** ioMaps,const char* ioType){
     json_object* json_io=NULL;
-    if(json_object_object_get_ex(req,ioType,&json_io)!=FALSE){	    
+    if(json_object_object_get_ex(req,ioType,&json_io)!=FALSE){
       json_object* json_current_io=NULL;
-      size_t len=json_object_array_length(json_io);
-      for(int i=0;i<len;i++){
-	maps *cMaps=NULL;
-	json_current_io=json_object_array_get_idx(json_io,i);
-	json_object* cname=NULL;
-	if(json_object_object_get_ex(json_current_io,"id",&cname)!=FALSE){
-	  cMaps=createMaps(json_object_get_string(cname));
-	  elements* cio=getElements(ioElements,json_object_get_string(cname));
-	  json_object* json_input;
-	  json_object* json_cinput;
-	  if(json_object_object_get_ex(json_current_io,"input",&json_input)!=FALSE){
-	    if(json_object_object_get_ex(json_input,"dataType",&json_cinput)!=FALSE){
-	      parseJLiteral(conf,json_input,cio,cMaps);
-	    } else if(json_object_object_get_ex(json_input,"format",&json_cinput)!=FALSE){
-	      parseJComplex(conf,json_input,cio,cMaps,json_object_get_string(cname));
-	    } else if(json_object_object_get_ex(json_input,"bbox",&json_cinput)!=FALSE){
-	      parseJBoundingBox(conf,json_input,cio,cMaps);
-	    }// else error!
-	    else{
-	      if(json_object_object_get_ex(json_input,"value",&json_cinput)!=FALSE){
-		map* error=createMap("code","BadRequest");
-		char tmpS[1024];
-		sprintf(tmpS,_("Missing input for %s"),ioElements->name);
-		addToMap(error,"message",tmpS);
-		setMapInMaps(conf,"lenv","status_code","400 Bad Request");
-		printExceptionReportResponseJ(conf,error);
-		return;
-	      }else{
-		if(json_object_get_type(json_cinput)==json_type_string){
-		  parseJLiteral(conf,json_input,cio,cMaps);
-		}else if(json_object_get_type(json_cinput)==json_type_object){
-		  json_object* json_ccinput=NULL;
-		  if(json_object_object_get_ex(json_cinput,"bbox",&json_ccinput)!=FALSE){
-		    parseJComplex(conf,json_input,cio,cMaps,json_object_get_string(cname));
-		  }
-		  else{
-		    parseJBoundingBox(conf,json_input,cio,cMaps);
-		  }
-		}else{
-		  if(strcmp(ioType,"input")==0){
-		    map* error=createMap("code","BadRequest");
-		    char tmpS1[1024];
-		    sprintf(tmpS1,_("Issue with input %s"),ioElements->name);
-		    addToMap(error,"message",tmpS1);
-		    setMapInMaps(conf,"lenv","status_code","400 Bad Request");
-		    printExceptionReportResponseJ(conf,error);
-		    return;
-		  }
-		}
-	      }
-	    }
-	  }else{
-	    if(strcmp(ioType,"input")==0){
-	      map* error=createMap("code","BadRequest");
-	      char tmpS1[1024];
-	      sprintf(tmpS1,_("Missing input for %s"),ioElements->name);
-	      addToMap(error,"message",tmpS1);
-	      setMapInMaps(conf,"lenv","status_code","400 Bad Request");
-	      printExceptionReportResponseJ(conf,error);
-	      return;
-	    }else{
-	      // Outputs
-	      if(json_object_object_get_ex(json_current_io,"transmissionMode",&json_cinput)!=FALSE){
-		if(cMaps->content==NULL)
-		  cMaps->content=createMap("transmissionMode",json_object_get_string(json_cinput));
-		else
-		  addToMap(cMaps->content,"transmissionMode",json_object_get_string(json_cinput));
-	      }
-	      if(json_object_object_get_ex(json_current_io,"format",&json_cinput)!=FALSE){
-		json_object_object_foreach(json_cinput, key, val) {
-		  if(cMaps->content==NULL)
-		    cMaps->content=createMap(key,json_object_get_string(val));
-		  else
-		    addToMap(cMaps->content,key,json_object_get_string(val));
-		}
-	      }	      
-	    }
+      if(json_object_is_type(json_io,json_type_array)){
+	size_t len=json_object_array_length(json_io);
+	for(int i=0;i<len;i++){
+	  maps *cMaps=NULL;
+	  json_current_io=json_object_array_get_idx(json_io,i);
+	  json_object* cname=NULL;
+	  if(json_object_object_get_ex(json_current_io,"id",&cname)!=FALSE) {
+	    json_object* json_input=NULL;
+	    if(json_object_object_get_ex(json_current_io,"input",&json_input)!=FALSE) {	    
+	      parseJIOSingle(conf,ioElements,ioMaps,ioType,json_object_get_string(cname),json_input);
+	    }else
+	      parseJIOSingle(conf,ioElements,ioMaps,ioType,json_object_get_string(cname),json_current_io);
 	  }
 	}
-	addToMap(cMaps->content,"inRequest","true");
-	if (ioMaps == NULL)
-	  *ioMaps = dupMaps(&cMaps);
-	else
-	  addMapsToMaps (ioMaps, cMaps);
+      }else{
+	json_object_object_foreach(json_io, key, val) {
+	  parseJIOSingle(conf,ioElements,ioMaps,ioType,key,val);
+	}
       }
     }
@@ -924,10 +961,7 @@
     maps* in=*inputs;
     parseJIO(conf,req,s->inputs,inputs,"inputs");
+    parseJIO(conf,req,s->outputs,outputs,"outputs");
 
     if(parsed==0){
-      json_io=NULL;
-      if(json_object_object_get_ex(req,"outputs",&json_io)!=FALSE){
-	parseJIO(conf,req,s->outputs,outputs,"outputs");
-      }
       json_io=NULL;
       if(json_object_object_get_ex(req,"mode",&json_io)!=FALSE){
@@ -967,4 +1001,40 @@
   }
 
+  /**
+   * Print the jobs status info
+   * cf. 
+   *
+   * @param conf the maps containing the settings of the main.cfg file
+   * @return the JSON object pointer to the jobs list
+   */
+  json_object* printJobStatus(maps* pmsConf,char* pcJobId){
+    json_object* pjoRes=NULL;
+    runGetStatus(pmsConf,pcJobId,"GetStatus");
+    map* pmError=getMapFromMaps(pmsConf,"lenv","error");
+    if(pmError!=NULL && strncasecmp(pmError->value,"true",4)==0){
+      printExceptionReportResponseJ(pmsConf,getMapFromMaps(pmsConf,"lenv","code"));
+      return NULL;
+    }else{
+      map* pmStatus=getMapFromMaps(pmsConf,"lenv","status");
+      setMapInMaps(pmsConf,"lenv","gs_location","false");
+      setMapInMaps(pmsConf,"lenv","gs_usid",pcJobId);
+      if(pmStatus!=NULL && strncasecmp(pmStatus->value,"Failed",6)==0)
+	pjoRes=createStatus(pmsConf,SERVICE_FAILED);
+      else
+	if(pmStatus!=NULL  && strncasecmp(pmStatus->value,"Succeeded",9)==0)
+	  pjoRes=createStatus(pmsConf,SERVICE_SUCCEEDED);
+	else
+	  if(pmStatus!=NULL  && strncasecmp(pmStatus->value,"Running",7)==0){
+	    map* tmpMap=getMapFromMaps(pmsConf,"lenv","Message");
+	    if(tmpMap!=NULL)
+	      setMapInMaps(pmsConf,"lenv","gs_message",tmpMap->value);
+	    pjoRes=createStatus(pmsConf,SERVICE_STARTED);
+	  }
+	  else
+	    pjoRes=createStatus(pmsConf,SERVICE_FAILED);
+    }
+    return pjoRes;
+  }
+  
   /**
    * Print the jobs list
@@ -985,36 +1055,11 @@
 	char* extn = strstr(dp->d_name, ".json");
 	if(extn!=NULL){
-	  json_object* cjob=json_object_new_object();
 	  char* tmpStr=zStrdup(dp->d_name);
 	  tmpStr[strlen(dp->d_name)-5]=0;
+	  json_object* cjob=json_object_new_object();
 	  json_object_object_add(cjob,"id",json_object_new_string(tmpStr));
-	  char *tmps1=(char*)malloc((strlen(cpath)+strlen(dp->d_name)+2)*sizeof(char));
-	  sprintf (tmps1, "%s/%s", cpath, dp->d_name);
-	  FILE* cdat=fopen(tmps1,"rb");
-	  if(cdat!=NULL){
-	    zStatStruct f_status;
-	    int s=zStat(tmps1, &f_status);
-	    char* mystring=(char*)malloc((f_status.st_size+1)*sizeof(char));
-	    fread(mystring,1,f_status.st_size,cdat);
-	    mystring[f_status.st_size]=0;	    
-	    json_object *jobj = NULL;
-	    int slen = 0;
-	    enum json_tokener_error jerr;
-	    struct json_tokener* tok=json_tokener_new();
-	    do {
-	      slen = strlen(mystring);
-	      jobj = json_tokener_parse_ex(tok, mystring, slen);
-	    } while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue);
-	    if (jerr != json_tokener_success) {
-	      fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
-	      return NULL;
-	    }
-	    if (tok->char_offset < slen){
-	      return NULL;
-	    }
+	  json_object *jobj=printJobStatus(conf,tmpStr);
+	  if(jobj!=NULL)
 	    json_object_object_add(cjob,"infos",jobj);
-	    free(mystring);
-	    fclose(cdat);
-	  }
 	  free(tmpStr);
 	  json_object_array_add(res,cjob);
@@ -1036,5 +1081,4 @@
    */
   json_object* printJResult(maps* conf,service* s,maps* result,int res){
-    json_object* eres1=json_object_new_object();
     if(res==SERVICE_FAILED){
       char* pacTmp=produceErrorMessage(conf);
@@ -1051,202 +1095,143 @@
     if(getMapFromMaps(conf,"lenv","no-headers")==NULL)
       printHeaders(conf);
-    json_object* eres=json_object_new_array();
-    maps* resu=result;
-    int itn=0;
-    while(resu!=NULL){
-      json_object* res1=json_object_new_object();
-      json_object_object_add(res1,"id",json_object_new_string(resu->name));
-      map* tmpMap=getMap(resu->content,"mimeType");
-      json_object* res3=json_object_new_object();
-      if(tmpMap!=NULL)
-	json_object_object_add(res3,"mimeType",json_object_new_string(tmpMap->value));
-      if((tmpMap=getMap(resu->content,"value"))!=NULL ||
-	 (getMap(resu->content,"generated_file"))!=NULL){
-	json_object* res2=json_object_new_object();
-	map* tmpMap1=NULL;
-	if((tmpMap1=getMap(resu->content,"transmissionMode"))!=NULL) {
-	  if(strcmp(tmpMap1->value,"value")==0) {
-	    map* tmpMap2=getMap(resu->content,"mimeType");
-	    if(tmpMap2!=NULL && strstr(tmpMap2->value,"json")!=NULL){
-	      json_object *jobj = NULL;
-	      int slen = 0;
-	      enum json_tokener_error jerr;
-	      struct json_tokener* tok=json_tokener_new();
-	      do {
-		slen = strlen(tmpMap->value);
-		jobj = json_tokener_parse_ex(tok, tmpMap->value, slen);
-	      } while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue);
-	      if (jerr != json_tokener_success) {
-		fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
-		return eres1;
+    map* pmMode=getMapFromMaps(conf,"request","response");
+    if(pmMode!=NULL && strncasecmp(pmMode->value,"raw",3)==0){
+      maps* resu=result;
+      printRawdataOutput(conf,resu);
+      map* pmError=getMapFromMaps(conf,"lenv","error");
+      if(pmError!=NULL && strncasecmp(pmError->value,"true",4)==0){
+	printExceptionReportResponseJ(conf,pmError);
+      }
+      return NULL;
+    }else{
+      json_object* eres1=json_object_new_object();
+      map* pmIOAsArray=getMapFromMaps(conf,"openapi","io_as_array");
+      json_object* eres;
+      if(pmIOAsArray!=NULL && strncasecmp(pmIOAsArray->value,"true",4)==0)
+	eres=json_object_new_array();
+      else
+	eres=json_object_new_object();
+      maps* resu=result;
+      int itn=0;
+      while(resu!=NULL){
+	json_object* res1=json_object_new_object();
+	if(pmIOAsArray!=NULL && strncasecmp(pmIOAsArray->value,"true",4)==0)
+	  json_object_object_add(res1,"id",json_object_new_string(resu->name));
+	map* tmpMap=getMap(resu->content,"mimeType");
+	json_object* res3=json_object_new_object();
+	if(tmpMap!=NULL)
+	  json_object_object_add(res3,"mimeType",json_object_new_string(tmpMap->value));
+	else{
+	  json_object_object_add(res3,"mimeType",json_object_new_string("text/plain"));
+	  map* pmDataType=getMap(resu->content,"dataType");
+	  if(pmDataType!=NULL){
+	    json_object* pjoTmp3=json_object_new_object();
+	    json_object_object_add(pjoTmp3,"name",json_object_new_string(pmDataType->value));
+	    json_object_object_add(res1,"dataType",pjoTmp3);
+	  }
+	}
+	if((tmpMap=getMap(resu->content,"value"))!=NULL ||
+	   (getMap(resu->content,"generated_file"))!=NULL){
+	  //json_object* res2=json_object_new_object();
+	  map* tmpMap1=NULL;
+	  if((tmpMap1=getMap(resu->content,"transmissionMode"))!=NULL) {
+	    if(strcmp(tmpMap1->value,"value")==0) {
+	      map* tmpMap2=getMap(resu->content,"mimeType");
+	      if(tmpMap2!=NULL && strstr(tmpMap2->value,"json")!=NULL){
+		json_object *jobj = NULL;
+		int slen = 0;
+		enum json_tokener_error jerr;
+		struct json_tokener* tok=json_tokener_new();
+		do {
+		  slen = strlen(tmpMap->value);
+		  jobj = json_tokener_parse_ex(tok, tmpMap->value, slen);
+		} while ((jerr = json_tokener_get_error(tok)) == json_tokener_continue);
+		if (jerr != json_tokener_success) {
+		  fprintf(stderr, "Error: %s\n", json_tokener_error_desc(jerr));
+		  return eres1;
+		}
+		if (tok->char_offset < slen){
+		  return eres1;		
+		}
+		json_object_object_add(res3,"encoding",json_object_new_string("utf-8"));
+		json_object_object_add(res1,"value",jobj);
+	      }else{
+		map* tmp1=getMapFromMaps(conf,"main","tmpPath");
+		map *gfile=getMap(resu->content,"generated_file");
+		if(gfile!=NULL){
+		  gfile=getMap(resu->content,"expected_generated_file");
+		  if(gfile==NULL){
+		    gfile=getMap(resu->content,"generated_file");
+		  }
+		  FILE* pfData=fopen(gfile->value,"rb");
+		  if(pfData!=NULL){
+		    zStatStruct f_status;
+		    int s=zStat(gfile->value, &f_status);
+		    char* pcaTmp=(char*)malloc((f_status.st_size+1)*sizeof(char));
+		    fread(pcaTmp,1,f_status.st_size,pfData);
+		    pcaTmp[f_status.st_size]=0;	    
+		    fclose(pfData);
+		    json_object_object_add(res1,"value",json_object_new_string(base64(pcaTmp,f_status.st_size)));
+		    json_object_object_add(res3,"encoding",json_object_new_string("base64"));
+		    free(pcaTmp);
+		  }
+		}else{
+		  json_object_object_add(res3,"encoding",json_object_new_string("utf-8"));
+		  json_object_object_add(res1,"value",json_object_new_string(tmpMap->value));
+		}
 	      }
-	      if (tok->char_offset < slen){
-		return eres1;		
-	      }
-	      json_object_object_add(res3,"encoding",json_object_new_string("utf-8"));
-	      json_object_object_add(res2,"inlineValue",jobj);
-	    }else{
-	      map* tmp1=getMapFromMaps(conf,"main","tmpPath");
-	      map *gfile=getMap(resu->content,"generated_file");
-	      if(gfile!=NULL){
-		gfile=getMap(resu->content,"expected_generated_file");
-		if(gfile==NULL){
-		  gfile=getMap(resu->content,"generated_file");
-		}
-		FILE* pfData=fopen(gfile->value,"rb");
-		if(pfData!=NULL){
-		  zStatStruct f_status;
-		  int s=zStat(gfile->value, &f_status);
-		  char* pcaTmp=(char*)malloc((f_status.st_size+1)*sizeof(char));
-		  fread(pcaTmp,1,f_status.st_size,pfData);
-		  pcaTmp[f_status.st_size]=0;	    
-		  fclose(pfData);
-		  json_object_object_add(res2,"inlineValue",json_object_new_string(base64(pcaTmp,f_status.st_size)));
-		  json_object_object_add(res3,"encoding",json_object_new_string("base64"));
-		  free(pcaTmp);
-		}
-	      }else{
-		json_object_object_add(res3,"encoding",json_object_new_string("utf-8"));
-		json_object_object_add(res2,"inlineValue",json_object_new_string(tmpMap->value));
+	    }
+	    else{
+	      char *pcaFileUrl=produceFileUrl(s,conf,resu,NULL,itn);
+	      itn++;
+	      if(pcaFileUrl!=NULL){
+		json_object_object_add(res1,"href",
+				       json_object_new_string(pcaFileUrl));
+		free(pcaFileUrl);
 	      }
 	    }
 	  }
-	  else{
-	    // Create file for reference data if not existing
-	    map *gfile=getMap(resu->content,"generated_file");
-	    char *file_name=NULL;
-	    char *file_path=NULL;
-	    char *file_url=NULL;
-	    map *tmp1=getMapFromMaps(conf,"main","tmpPath");
-	    if(gfile!=NULL){
-	      gfile=getMap(resu->content,"expected_generated_file");
-	      if(gfile==NULL){
-		gfile=getMap(resu->content,"generated_file");
-	      }
-	      if(strstr(gfile->value,tmp1->value)!=NULL)
-		file_name=zStrdup(strstr(gfile->value,tmp1->value)+strlen(tmp1->value));
-	    }/*else*/
-	    {
-	      // Create file for reference data
-	      map *tmpUrl=getMapFromMaps(conf,"main","tmpUrl");
-	      map *usid=getMapFromMaps(conf,"lenv","usid");
-	      map *ext=getMap(resu->content,"extension");
-	      if(gfile==NULL){
-		char file_ext[32];	    
-		if( ext != NULL && ext->value != NULL) {
-		  strncpy(file_ext, ext->value, 32);
-		}
-		else {
-		  // Obtain default file extension (see mimetypes.h).	      
-		  // If the MIME type is not recognized, txt is used as the default extension
-		  map* mtype=getMap(resu->content,"mimeType");
-		  getFileExtension(mtype != NULL ? mtype->value : NULL, file_ext, 32);
-		}
-		if(file_name!=NULL)
-		  free(file_name);
-	      
-		file_name=(char*)malloc((strlen(s->name)+strlen(usid->value)+strlen(file_ext)+strlen(resu->name)+45)*sizeof(char));
-		sprintf(file_name,"ZOO_DATA_%s_%s_%s_%d.%s",s->name,resu->name,usid->value,itn,file_ext);
-
-		file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char));
-		sprintf(file_path,"%s/%s",tmp1->value,file_name);
-	      }else{
-		file_path=(char*)malloc((strlen(gfile->value)+1)*sizeof(char));
-		sprintf(file_path,"%s",gfile->value);
-	      }
-		
-	      
-	      itn++;
-	      
-	      file_url=(char*)malloc((strlen(tmpUrl->value)+
-				      strlen(file_name)+2)*sizeof(char));
-	      sprintf(file_url,"%s/%s",tmpUrl->value,file_name);
-
-	      if(gfile==NULL){
-		FILE *ofile=fopen(file_path,"wb");
-		if(ofile==NULL){
-		  char tmpMsg[1024];
-		  sprintf(tmpMsg,
-			  _("Unable to create the file \"%s\" for storing the %s final result."),
-			  file_name,resu->name);
-		  map* error=createMap("code","InternalError");
-		  addToMap(error,"message",tmpMsg);
-		  printExceptionReportResponseJ(conf,error);
-		  free(file_name);
-		  free(file_path);
-		  return NULL;
-		}
-
-		map* toto=getMap(resu->content,"value");
-		if(toto==NULL){
-		  char tmpMsg[1024];
-		  sprintf(tmpMsg,
-			  _("No value found for the requested output %s."),
-			  resu->name);
-		  map* error=createMap("code","InternalError");
-		  addToMap(error,"message",tmpMsg);
-		  printExceptionReportResponseJ(conf,error);
-		  fclose(ofile);
-		  free(file_name);
-		  free(file_path);
-		  return NULL;
-		}
-		map* size=getMap(resu->content,"size");
-		if(size!=NULL && toto!=NULL)
-		  fwrite(toto->value,1,(atoi(size->value))*sizeof(char),ofile);
-		else
-		  if(toto!=NULL && toto->value!=NULL)
-		    fwrite(toto->value,1,
-			   strlen(toto->value)*sizeof(char),ofile);
-		fclose(ofile);
-	      }
-	      json_object_object_add(res2,"href",
-				     json_object_new_string(file_url));
-	      free(file_url);
-	      free(file_name);
-	      free(file_path);
-	      
-	    }
-	    
-	  }
-	}
-	json_object_object_add(res1,"value",res2);	
-	json_object_object_add(res1,"format",res3);	
-	json_object_array_add(eres,res1);
-      }
-      resu=resu->next;
-    }
-    json_object_object_add(eres1,"outputs",eres);
-    const char* jsonStr =
-      json_object_to_json_string_ext(eres1,JSON_C_TO_STRING_PLAIN);
-    map *tmpPath = getMapFromMaps (conf, "main", "tmpPath");
-    map *cIdentifier = getMapFromMaps (conf, "lenv", "oIdentifier");
-    map *sessId = getMapFromMaps (conf, "lenv", "usid");
-    char *pacTmp=(char*)malloc((strlen(tmpPath->value)+strlen(cIdentifier->value)+strlen(sessId->value)+8)*sizeof(char));
-    sprintf(pacTmp,"%s/%s_%s.json",
-	    tmpPath->value,cIdentifier->value,sessId->value);
-    zStatStruct zsFStatus;
-    int iS=zStat(pacTmp, &zsFStatus);
-    if(iS==0 && zsFStatus.st_size>0){
-      map* tmpPath1 = getMapFromMaps (conf, "main", "tmpUrl");
-      char* pacTmpUrl=(char*)malloc((strlen(tmpPath1->value)+strlen(cIdentifier->value)+strlen(sessId->value)+8)*sizeof(char));;
-      sprintf(pacTmpUrl,"%s/%s_%s.json",tmpPath1->value,
-	      cIdentifier->value,sessId->value);
-      if(getMapFromMaps(conf,"lenv","gs_location")==NULL)
-	setMapInMaps(conf,"headers","Location",pacTmpUrl);
-      free(pacTmpUrl);
-    }
-    free(pacTmp);
-    if(res==3){
-      map* mode=getMapFromMaps(conf,"request","mode");
-      if(mode!=NULL && strncasecmp(mode->value,"async",5)==0)
-	setMapInMaps(conf,"headers","Status","201 Created");
-      else
-	setMapInMaps(conf,"headers","Status","200 Ok");
-    }
-    else{
-      setMapInMaps(conf,"headers","Status","500 Issue running your service");
-    }
-    return eres1;
+	  //json_object_object_add(res1,"value",res2);
+	  json_object_object_add(res1,"format",res3);
+	  if(pmIOAsArray!=NULL && strncasecmp(pmIOAsArray->value,"true",4)==0){
+	    json_object_array_add(eres,res1);
+	  }else
+	    json_object_object_add(eres,resu->name,res1);
+	}
+	resu=resu->next;
+      }
+      json_object_object_add(eres1,"outputs",eres);
+      const char* jsonStr =
+	json_object_to_json_string_ext(eres1,JSON_C_TO_STRING_PLAIN);
+      map *tmpPath = getMapFromMaps (conf, "main", "tmpPath");
+      map *cIdentifier = getMapFromMaps (conf, "lenv", "oIdentifier");
+      map *sessId = getMapFromMaps (conf, "lenv", "usid");
+      char *pacTmp=(char*)malloc((strlen(tmpPath->value)+strlen(cIdentifier->value)+strlen(sessId->value)+8)*sizeof(char));
+      sprintf(pacTmp,"%s/%s_%s.json",
+	      tmpPath->value,cIdentifier->value,sessId->value);
+      zStatStruct zsFStatus;
+      int iS=zStat(pacTmp, &zsFStatus);
+      if(iS==0 && zsFStatus.st_size>0){
+	map* tmpPath1 = getMapFromMaps (conf, "main", "tmpUrl");
+	char* pacTmpUrl=(char*)malloc((strlen(tmpPath1->value)+strlen(cIdentifier->value)+strlen(sessId->value)+8)*sizeof(char));;
+	sprintf(pacTmpUrl,"%s/%s_%s.json",tmpPath1->value,
+		cIdentifier->value,sessId->value);
+	if(getMapFromMaps(conf,"lenv","gs_location")==NULL)
+	  setMapInMaps(conf,"headers","Location",pacTmpUrl);
+	free(pacTmpUrl);
+      }
+      free(pacTmp);
+      if(res==3){
+	map* mode=getMapFromMaps(conf,"request","mode");
+	if(mode!=NULL && strncasecmp(mode->value,"async",5)==0)
+	  setMapInMaps(conf,"headers","Status","201 Created");
+	else
+	  setMapInMaps(conf,"headers","Status","200 Ok");
+      }
+      else{
+	setMapInMaps(conf,"headers","Status","500 Issue running your service");
+      }
+      return eres1;
+    }
   }
 
@@ -1338,6 +1323,6 @@
     }
     tmp1=(char*) realloc(tmp1,(strlen(tmpPath->value)+
-			 strlen(cIdentifier->value)+
-			 strlen(sessId->value)+21)*sizeof(char));
+			       strlen(cIdentifier->value)+
+			       strlen(sessId->value)+21)*sizeof(char));
     int needResult=0;
     char *message, *rstatus;
@@ -1652,18 +1637,18 @@
       json_object_object_add(cc,"$ref",json_object_new_string(pmSchema->value));
     if(useContent!=NULL && strncasecmp(useContent->value,"true",4)!=0){
-	json_object_object_add(res,code,cc);
+      json_object_object_add(res,code,cc);
     }else{
-	json_object *cc0=json_object_new_object();
-	if(pmSchema!=NULL)
-	  json_object_object_add(cc0,"schema",cc);
-	json_object *cc1=json_object_new_object();
-	if(pmType!=NULL)
-	  json_object_object_add(cc1,pmType->value,cc0);
-	else
-	  json_object_object_add(cc1,"application/json",cc0);
-	json_object *cc2=json_object_new_object();
-	json_object_object_add(cc2,"content",cc1);
-	json_object_object_add(cc2,"description",json_object_new_string(msg));
-	json_object_object_add(res,code,cc2);
+      json_object *cc0=json_object_new_object();
+      if(pmSchema!=NULL)
+	json_object_object_add(cc0,"schema",cc);
+      json_object *cc1=json_object_new_object();
+      if(pmType!=NULL)
+	json_object_object_add(cc1,pmType->value,cc0);
+      else
+	json_object_object_add(cc1,"application/json",cc0);
+      json_object *cc2=json_object_new_object();
+      json_object_object_add(cc2,"content",cc1);
+      json_object_object_add(cc2,"description",json_object_new_string(msg));
+      json_object_object_add(res,code,cc2);
     }
   }
Index: trunk/zoo-project/zoo-kernel/service_json.h
===================================================================
--- trunk/zoo-project/zoo-kernel/service_json.h	(revision 966)
+++ trunk/zoo-project/zoo-kernel/service_json.h	(revision 967)
@@ -52,4 +52,5 @@
   void parseJRequest(maps*,service* s,json_object*,map*,maps**,maps**);
   json_object*  printJResult(maps*,service*,maps*,int);
+  json_object* printJobStatus(maps*,char*);
   json_object* printJobList(maps*);
   int createStatusFile(maps*,int);
Index: trunk/zoo-project/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 966)
+++ trunk/zoo-project/zoo-kernel/zoo_service_loader.c	(revision 967)
@@ -419,5 +419,5 @@
   
   map* errormap = createMap("text", tmp01);
-  map* tmpMap=getMapFromMaps(m,"lenv","executionType");
+  map* tmpMap=getMapFromMaps(m,"main","executionType");
   char* errorCode=(char*)code;
   if(tmpMap!=NULL && strncasecmp(tmpMap->value,"json",4)==0)
@@ -1888,11 +1888,11 @@
   maps *request_input_real_format = NULL;
 
-  setMapInMaps(m,"lenv","executionType","xml");
+  setMapInMaps(m,"main","executionType","xml");
   if((strlen(cgiQueryString)>0 && cgiQueryString[0]=='/') /*&& strstr(cgiAccept,"json")!=NULL*/){
     //
-    // OGC API - Processing starts here
+    // OGC API - Processes starts here
     //
 #ifndef USE_JSON
-    errorException (m, _("OGC API - Processing is not supported by this ZOO-Kernel."), "InternalError", NULL);
+    errorException (m, _("OGC API - Processes is not supported by this ZOO-Kernel, please contact the service provider."), "InternalError", NULL);
     return 1;
 #else
@@ -1908,4 +1908,5 @@
     signal (SIGABRT, json_sig_handler);
 #endif
+    setMapInMaps(m,"main","executionType","json");
     r_inputs = getMapOrFill (&request_inputs, "metapath", "");
     char conf_file1[10240];
@@ -1920,7 +1921,5 @@
       }
     addMapsToMaps(&m,m1);
-    setMapInMaps(m,"lenv","executionType","json");
     map* pmTmp0=getMapFromMaps(m,"openapi","full_html_support");
-    dumpMap(pmTmp0);
     if(strstr(cgiQueryString,".html")==NULL && strstr(cgiAccept,"text/html")!=NULL && pmTmp0!=NULL && strncasecmp(pmTmp0->value,"true",4)==0){
       map* pmTmpUrl=getMapFromMaps(m,"openapi","rootUrl");
@@ -2305,28 +2304,5 @@
 		}else{
 		  char* jobId=zStrdup(strstr(cgiQueryString,"/jobs/")+6);
-		  runGetStatus(m,jobId,"GetStatus");
-		  map* pmError=getMapFromMaps(m,"lenv","error");
-		  if(pmError!=NULL && strncasecmp(pmError->value,"true",4)==0){
-		    printExceptionReportResponseJ(m,getMapFromMaps(m,"lenv","code"));
-		    return 1;
-		  }else{
-		    map* pmStatus=getMapFromMaps(m,"lenv","status");
-		    setMapInMaps(m,"lenv","gs_location","false");
-		    setMapInMaps(m,"lenv","gs_usid",jobId);
-		    if(pmStatus!=NULL && strncasecmp(pmStatus->value,"Failed",6)==0)
-		      res=createStatus(m,SERVICE_FAILED);
-		    else
-		      if(pmStatus!=NULL  && strncasecmp(pmStatus->value,"Succeeded",9)==0)
-			res=createStatus(m,SERVICE_SUCCEEDED);
-		      else
-			if(pmStatus!=NULL  && strncasecmp(pmStatus->value,"Running",7)==0){
-			  map* tmpMap=getMapFromMaps(m,"lenv","Message");
-			  if(tmpMap!=NULL)
-			    setMapInMaps(m,"lenv","gs_message",tmpMap->value);
-			  res=createStatus(m,SERVICE_STARTED);
-			}
-			else
-			  res=createStatus(m,SERVICE_FAILED);
-		  }
+		  res=printJobStatus(m,jobId);
 		  free(jobId);
 		}
@@ -2530,5 +2506,7 @@
 		    map* testMap=getMapFromMaps(m,"main","memory");
 		    loadHttpRequests(m,request_input_real_format);
-		    dumpMaps(request_input_real_format);
+
+		    if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,NULL)<0)
+		      return -1;
 		    loadServiceAndRun (&m, s1, request_inputs,
 				       &request_input_real_format,
@@ -2548,4 +2526,6 @@
 	      }else{
 		loadHttpRequests(m,request_input_real_format);
+		if(validateRequest(&m,s1,request_inputs, &request_input_real_format,&request_output_real_format,NULL)<0)
+		  return -1;
 		loadServiceAndRun (&m,s1,request_inputs,
 				   &request_input_real_format,
@@ -2560,5 +2540,6 @@
 	}
     }
-    if(res!=NULL){
+    map* pmHasPrinted=getMapFromMaps(m,"lenv","hasPrinted");
+    if(res!=NULL && (pmHasPrinted==NULL || strncasecmp(pmHasPrinted->value,"false",5)==0)){
       if(getMapFromMaps(m,"lenv","no-headers")==NULL){
 	printHeaders(m);
@@ -2573,8 +2554,8 @@
 #endif
   }else{
-
     //
     // WPS 1.0.0 and 2.0.0 starts here
     //
+    setMapInMaps(m,"main","executionType","xml");
     //Check for minimum inputs
     map* version=getMap(request_inputs,"version");
@@ -3435,7 +3416,11 @@
   signal (SIGABRT, donothing);
 #endif
+    fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
+    fflush(stderr);
 
   if (((int) zGetpid ()) != cpid || cgiSid != NULL)
     {
+    fprintf(stderr,"%s %d \n",__FILE__,__LINE__);
+    fflush(stderr);
       if (eres == SERVICE_SUCCEEDED)
 #ifdef USE_CALLBACK
@@ -3495,5 +3480,5 @@
       if(cgiSid!=NULL)
 	free(cgiSid);
-      map* tMap=getMapFromMaps(m,"lenv","executionType");
+      map* tMap=getMapFromMaps(m,"main","executionType");
       if(tMap!=NULL && strncasecmp(tMap->value,"xml",3)==0)
 	InternetCloseHandle (&hInternet);
@@ -3524,4 +3509,5 @@
   free (REQUEST);
   free (SERVICE_URL);
+
 #ifdef DEBUG
   fprintf (stderr, "Processed response \n");
