Index: branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c	(revision 821)
+++ branches/prototype-v0/zoo-project/zoo-kernel/service_internal_ms.c	(revision 822)
@@ -131,5 +131,15 @@
  */
 void setReferenceUrl(maps* m,maps* tmpI){
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
+  dumpMaps(tmpI);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   outputMapfile(m,tmpI);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
+  dumpMaps(tmpI);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   map *msUrl=getMapFromMaps(m,"main","mapserverAddress");
   if(msUrl==NULL){
@@ -150,5 +160,6 @@
     {"WMS","1.3.0","GetMap","layers=%s","wms_extent"},
     {"WFS","1.1.0","GetFeature","typename=%s","wcs_extent"},
-    {"WCS","1.1.0","GetCoverage","coverage=%s","wcs_extent"}
+    //{"WCS","1.1.0","GetCoverage","coverage=%s","wcs_extent"}
+    {"WCS","2.0.0","GetCoverage","coverageid=%s","wcs_extent"}
   };
   int proto=0;
@@ -988,5 +999,9 @@
  */
 void outputMapfile(maps* conf,maps* outputs){
-
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
+  dumpMaps(outputs);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   /**
    * First store the value on disk
@@ -998,4 +1013,6 @@
       ext="json";
 
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   map* tmpMap=getMapFromMaps(conf,"main","dataPath");
   map* sidMap=getMapFromMaps(conf,"lenv","usid");
@@ -1009,4 +1026,6 @@
   map* sizeMap=getMap(outputs->content,"size");
   map* vData=getMap(outputs->content,"value");
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   if(sizeMap!=NULL){
     zWrite(f,vData->value,atoi(sizeMap->value)*sizeof(char));
@@ -1015,7 +1034,13 @@
     zWrite(f,vData->value,(strlen(vData->value)+1)*sizeof(char));
   }
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   close(f);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   addToMap(outputs->content,"storage",pszDataSource);
   free(pszDataSource);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
   /*
@@ -1024,7 +1049,15 @@
   mapObj *myMap=msNewMapObj();
   free(myMap->name);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   myMap->name=zStrdup("ZOO-Project_WXS_Server");
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   msMapSetSize(myMap,2048,2048);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   msMapSetExtent(myMap,-1,-1,1,1);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   
   /*
@@ -1035,4 +1068,6 @@
   tmp1=getMapFromMaps(conf,"main","tmpUrl");
   myMap->web.imageurl=zStrdup(tmp1->value);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
   
   /*
@@ -1045,11 +1080,20 @@
   msAppendOutputFormat(myMap,msCloneOutputFormat(o1));
   msFreeOutputFormat(o1);
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
 #ifdef USE_KML
   outputFormatObj *o2=msCreateDefaultOutputFormat(NULL,"KML","kml");
-  o2->inmapfile=MS_TRUE;  
-  msAppendOutputFormat(myMap,msCloneOutputFormat(o2));
-  msFreeOutputFormat(o2);
-#endif
+  if(!o2){
+    perror("Unable to initialize KML driver");
+    fprintf(stderr,"Unable to initialize KML driver !\n");
+  }else{
+    o2->inmapfile=MS_TRUE;  
+    msAppendOutputFormat(myMap,msCloneOutputFormat(o2));
+    msFreeOutputFormat(o2);
+  }
+#endif
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
   outputFormatObj *o3=msCreateDefaultOutputFormat(NULL,"GDAL/GTiff","tiff");
@@ -1062,4 +1106,6 @@
     msFreeOutputFormat(o3);
   }
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
   outputFormatObj *o4=msCreateDefaultOutputFormat(NULL,"GDAL/AAIGRID","grd");
@@ -1072,4 +1118,6 @@
     msFreeOutputFormat(o4);
   }
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
 #ifdef USE_CAIRO
@@ -1085,4 +1133,6 @@
   }
 #endif
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
   /*
@@ -1091,4 +1141,6 @@
   msLoadProjectionStringEPSG(&myMap->projection,"EPSG:4326");
   myMap->transparent=1;
+  fprintf(stderr,"%s %D \n",__FILE__,__LINE__);
+  fflush(stderr);
 
   /**
