Index: trunk/zoo-project/zoo-kernel/service_internal_ms.c
===================================================================
--- trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 401)
+++ trunk/zoo-project/zoo-kernel/service_internal_ms.c	(revision 402)
@@ -105,5 +105,4 @@
 
 void setReferenceUrl(maps* m,maps* tmpI){
-  //dumpMaps(tmpI);
   outputMapfile(m,tmpI);
   map *msUrl=getMapFromMaps(m,"main","mapserverAddress");
@@ -148,4 +147,12 @@
   map* extent=getMap(tmpI->content,options[proto][4]);
   map* crs=getMap(tmpI->content,"crs");
+  int hasCRS=1;
+  if(crs==NULL){
+    crs=getMapFromMaps(m,"main","crs");
+    if(crs==NULL){
+      crs=createMap("crs","epsg:4326");
+      hasCRS=0;
+    }
+  }
   char layers[128];
   sprintf(layers,options[proto][3],tmpI->name);
@@ -186,4 +193,8 @@
 	    crs->value
 	    );
+  }
+  if(hasCRS==0){
+    freeMap(&crs);
+    free(crs);
   }
   addToMap(tmpI->content,"Reference",webService_url);
@@ -300,10 +311,8 @@
   
   if(output!=NULL){
-
     map* test=getMap(output->content,"real_extent");
     if(test!=NULL){
       pointObj min, max;
       projectionObj tempSrs;
-
       min.x = m->extent.minx;
       min.y = m->extent.miny;
@@ -311,6 +320,4 @@
       max.y = m->extent.maxy;
       char tmpSrsStr[1024];
-
-
       msInitProjection(&tempSrs);
       msLoadProjectionStringEPSG(&tempSrs,"EPSG:4326");
@@ -327,18 +334,16 @@
       sprintf(tmpSrsStr,"%.3f,%.3f,%.3f,%.3f",min.x,min.y,max.x,max.y);
       addToMap(output->content,"wcs_extent",tmpExtent);
-      //dumpMap(output->content);
-
     }else{
       sprintf(tmpExtent,"%f,%f,%f,%f",minX, minY, maxX, maxY);
       map* isGeo=getMap(output->content,"crs_isGeographic");
-      fprintf(stderr,"isGeo = %s\n",isGeo->value);
-      if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0)
-        sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
+      if(isGeo!=NULL){
+	fprintf(stderr,"isGeo = %s\n",isGeo->value);
+	if(isGeo!=NULL && strcasecmp("true",isGeo->value)==0)
+	  sprintf(tmpExtent,"%f,%f,%f,%f", minY,minX, maxY, maxX);
+      }
       addToMap(output->content,"wms_extent",tmpExtent); 
       sprintf(tmpExtent,"%.3f,%.3f,%.3f,%.3f",minX,minY,maxX,maxY);
       addToMap(output->content,"wcs_extent",tmpExtent);
-      
-    }
-
+    }
   }
 
