Index: branches/branch-1.2/zoo-kernel/service.h
===================================================================
--- branches/branch-1.2/zoo-kernel/service.h	(revision 111)
+++ branches/branch-1.2/zoo-kernel/service.h	(revision 217)
@@ -28,4 +28,10 @@
 #pragma once
 
+#ifdef WIN32
+#define strncasecmp strnicmp
+#define strcasecmp stricmp
+#define snprintf sprintf_s
+#endif 
+
 #ifdef __cplusplus
 extern "C" {
@@ -55,4 +61,27 @@
 #define SHMSZ     27
 
+
+  /**
+   * \struct map
+   * \brief KVP linked list
+   *
+   * Deal with WPS KVP (name,value).
+   * A map is defined as:
+   *  - name : a key,
+   *  - value: a value,
+   *  - next : a pointer to the next map if any.
+   */
+  typedef struct map{
+    char* name;
+    char* value;
+    struct map* next;
+  } map;
+
+#ifdef WIN32
+#define NULLMAP ((map*) 0)
+#else
+#define NULLMAP NULL
+#endif
+
   /**
    * \struct maps
@@ -60,4 +89,8 @@
    *
    * Small object to store WPS KVP set.
+   * Maps is defined as:
+   *  - a name, 
+   *  - a content map,
+   *  - a pointer to the next maps if any.
    */
   typedef struct maps{
@@ -68,21 +101,6 @@
 
   /**
-   * \struct map
-   * \brief KVP linked list
-   *
-   * Deal with WPS KVP (name,value).
+   * \brief Dump a map on stderr
    */
-  typedef struct map{
-    char* name;       /* The key */
-    char* value;      /* The value */
-    struct map* next; /* Next couple */
-  } map;
-
-#ifdef WIN32
-#define NULLMAP ((map*) 0)
-#else
-#define NULLMAP NULL
-#endif
-
   static void _dumpMap(map* t){
     if(t!=NULL){
@@ -181,5 +199,16 @@
   }
 
-  static map* getMapFromMaps(maps* m,char* key,char* subkey){
+  static map* getLastMap(map* m){
+    map* tmp=m;
+    while(tmp!=NULL){
+      if(tmp->next==NULL){
+	return tmp;
+      }
+      tmp=tmp->next;
+    }
+    return NULL;
+  }
+
+  static map* getMapFromMaps(maps* m,const char* key,const char* subkey){
     maps* _tmpm=getMaps(m,key);
     if(_tmpm!=NULL){
@@ -189,4 +218,52 @@
     else return NULL;
   }
+
+  static char* getMapsAsKVP(maps* m,int length,int type){
+    char *dataInputsKVP=(char*) malloc(length*sizeof(char));
+    maps* curs=m;
+    int i=0;
+    while(curs!=NULL){
+      if(i==0)
+	if(type==0)
+	  sprintf(dataInputsKVP,"%s=",curs->name);
+	else
+	  sprintf(dataInputsKVP,"%s",curs->name);
+      else{
+	char *temp=strdup(dataInputsKVP);
+	if(type==0)
+	  sprintf(dataInputsKVP,"%s;%s=",temp,curs->name);
+	else
+	  sprintf(dataInputsKVP,"%s;%s",temp,curs->name);
+	free(temp);
+      }
+      map* icurs=curs->content;
+      if(type==0){
+	map* tmp=getMap(curs->content,"value");
+	char *temp=strdup(dataInputsKVP);
+	if(getMap(m->content,"xlink:href")!=NULL)
+	  sprintf(dataInputsKVP,"%sReference",temp);
+	else
+	  sprintf(dataInputsKVP,"%s%s",temp,icurs->value);
+	free(temp);
+      }
+      int j=0;
+      while(icurs!=NULL){
+	if(strcasecmp(icurs->name,"value")!=0 &&
+	   strcasecmp(icurs->name,"Reference")!=0 &&
+	   strcasecmp(icurs->name,"minOccurs")!=0 &&
+	   strcasecmp(icurs->name,"maxOccurs")!=0 &&
+	   strcasecmp(icurs->name,"inRequest")!=0){
+	  char *itemp=strdup(dataInputsKVP);
+	  sprintf(dataInputsKVP,"%s@%s=%s",itemp,icurs->name,icurs->value);
+	  free(itemp);
+	}
+	icurs=icurs->next;
+      }
+      curs=curs->next;
+      i++;
+    }
+    return dataInputsKVP;
+  }
+
 
   static void freeMap(map** mo){
@@ -224,4 +301,13 @@
   }
 
+  /**
+   * \brief Not named linked list
+   *
+   * Used to store informations about formats, such as mimeType, encoding ... 
+   *
+   * An iotype is defined as :
+   *  - a content map,
+   *  - a pointer to the next iotype if any.
+   */
   typedef struct iotype{
     struct map* content;
@@ -229,4 +315,18 @@
   } iotype;
 
+  /**
+   * \brief Metadata information about input or output.
+   *
+   * The elements are used to store metadata informations defined in the ZCFG.
+   *
+   * An elements is defined as :
+   *  - a name,
+   *  - a content map,
+   *  - a metadata map,
+   *  - a format (possible values are LiteralData, ComplexData or 
+   * BoundingBoxData),
+   *  - a default iotype,
+   *  - a pointer to the next elements id any.
+   */
   typedef struct elements{
     char* name;
@@ -252,5 +352,5 @@
   } services;
 
-  static bool hasElement(elements* e,char* key){
+  static bool hasElement(elements* e,const char* key){
     elements* tmp=e;
     while(tmp!=NULL){
@@ -476,10 +576,11 @@
 
 
-  static void setMapInMaps(maps* m,char* key,char* subkey,char *value){
+  static 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){
-	free(_ztmpm->value);
+	if(_ztmpm->value!=NULL)
+	  free(_ztmpm->value);
 	_ztmpm->value=strdup(value);
       }else{
