Index: trunk/zoo-kernel/service_internal.c
===================================================================
--- trunk/zoo-kernel/service_internal.c	(revision 62)
+++ trunk/zoo-kernel/service_internal.c	(revision 63)
@@ -1160,8 +1160,7 @@
     maps* mcursor=outputs;
     elements* scursor=serv->outputs;
-    while(mcursor!=NULL && scursor!=NULL){
+    while(mcursor!=NULL){
       printIOType(doc,nc,ns,ns_ows,scursor,mcursor,"Output");
       mcursor=mcursor->next;
-      scursor=scursor->next;
     }
     xmlAddChild(n,nc);
@@ -1533,5 +1532,5 @@
 	    toto=createMap("extension","txt");
 	}
-	if(toto==NULL)
+	else
 	  toto=createMap("extension","txt");
 	hasExt=false;
@@ -1649,5 +1648,5 @@
 }
 
-char* addDefaultValues(maps** out,elements* in,maps* m,char* type){
+char* addDefaultValues(maps** out,elements* in,maps* m,int type){
   elements* tmpInputs=in;
   maps* out1=*out;
@@ -1655,19 +1654,43 @@
     maps *tmpMaps=getMaps(out1,tmpInputs->name);
     if(tmpMaps==NULL){
-      map* tmpMap1=getMap(tmpInputs->content,"minOccurs");
-      if(strncmp(type,"inputs",6)==0)
-	if(tmpMap1!=NULL && atoi(tmpMap1->value)>=1){
-	  return tmpInputs->name;
-	}
       maps* tmpMaps2=(maps*)malloc(MAPS_SIZE);
       tmpMaps2->name=strdup(tmpInputs->name);
       tmpMaps2->content=NULL;
       tmpMaps2->next=NULL;
+      
+      if(type==0){
+	map* tmpMapMinO=getMap(tmpInputs->content,"minOccurs");
+	if(tmpMapMinO!=NULL)
+	  if(atoi(tmpMapMinO->value)>=1){
+	    freeMaps(&tmpMaps2);
+	    free(tmpMaps2);
+	    return tmpInputs->name;
+	  }
+	  else{
+	    if(tmpMaps2->content==NULL)
+	      tmpMaps2->content=createMap("minOccurs",tmpMapMinO->value);
+	    else
+	      addToMap(tmpMaps2->content,"minOccurs",tmpMapMinO->value);
+	  }
+	map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs");
+	if(tmpMaxO!=NULL)
+	  if(tmpMaps2->content==NULL)
+	    tmpMaps2->content=createMap("maxOccurs",tmpMaxO->value);
+	  else
+	    addToMap(tmpMaps2->content,"maxOccurs",tmpMaxO->value);
+      }
+
       iotype* tmpIoType=tmpInputs->defaults;
-      while(tmpIoType!=NULL){
-	addMapToMap(&tmpMaps2->content,tmpIoType->content);
-	tmpIoType=tmpIoType->next;
-      }
-      if(strncmp(type,"outputs",7)==0){
+      if(tmpIoType!=NULL){
+	map* tmpm=tmpIoType->content;
+	while(tmpm!=NULL){
+	  if(tmpMaps2->content==NULL)
+	    tmpMaps2->content=createMap(tmpm->name,tmpm->value);
+	  else
+	    addToMap(tmpMaps2->content,tmpm->name,tmpm->value);
+	  tmpm=tmpm->next;
+	}
+      }
+      if(type==1){
 	map *tmpMap=getMap(tmpMaps2->content,"value");
 	if(tmpMap==NULL)
@@ -1676,7 +1699,11 @@
       if(out1==NULL){
 	*out=dupMaps(&tmpMaps2);
+	out1=*out;
       }
       else
 	addMapsToMaps(&out1,tmpMaps2);
+      freeMap(&tmpMaps2->content);
+      free(tmpMaps2->content);
+      tmpMaps2->content=NULL;
       freeMaps(&tmpMaps2);
       free(tmpMaps2);
@@ -1686,4 +1713,22 @@
       iotype* tmpIoType=getIoTypeFromElement(tmpInputs,tmpInputs->name,
 					     tmpMaps->content);
+
+      if(type==0) {
+	map* tmpMap1=getMap(tmpInputs->content,"minOccurs");
+	if(tmpMap1!=NULL){
+	  if(tmpMaps->content==NULL)
+	    tmpMaps->content=createMap("minOccurs",tmpMap1->value);
+	  else
+	    addToMap(tmpMaps->content,"minOccurs",tmpMap1->value);
+	}
+	map* tmpMaxO=getMap(tmpInputs->content,"maxOccurs");
+	if(tmpMaxO!=NULL){
+	  if(tmpMaps->content==NULL)
+	    tmpMaps->content=createMap("maxOccurs",tmpMap1->value);
+	  else
+	    addToMap(tmpMaps->content,"maxOccurs",tmpMap1->value);
+	}
+      }
+
       if(tmpIoType!=NULL){
 	map* tmpContent=tmpIoType->content;
@@ -1695,8 +1740,8 @@
 	    fprintf(stderr,"addDefaultValues %s => %s\n",tmpContent->name,tmpContent->value);
 #endif
-	      if(tmpMaps->content==NULL)
-		tmpMaps->content=createMap(tmpContent->name,tmpContent->value);
-	      else
-		addToMap(tmpMaps->content,tmpContent->name,tmpContent->value);
+	    if(tmpMaps->content==NULL)
+	      tmpMaps->content=createMap(tmpContent->name,tmpContent->value);
+	    else
+	      addToMap(tmpMaps->content,tmpContent->name,tmpContent->value);
 	  }
 	  tmpContent=tmpContent->next;
Index: trunk/zoo-kernel/service_internal.h
===================================================================
--- trunk/zoo-kernel/service_internal.h	(revision 62)
+++ trunk/zoo-kernel/service_internal.h	(revision 63)
@@ -104,5 +104,5 @@
   char *base64(const unsigned char*,int);
 
-  char* addDefaultValues(maps**,elements*,maps*,char*);
+  char* addDefaultValues(maps**,elements*,maps*,int);
 
   /*defined in zoo_loader.c*/ 
Index: trunk/zoo-kernel/service_internal_python.c
===================================================================
--- trunk/zoo-kernel/service_internal_python.c	(revision 62)
+++ trunk/zoo-kernel/service_internal_python.c	(revision 63)
@@ -34,8 +34,12 @@
   tmp=getMapFromMaps(*main_conf,"env","PYTHONPATH");
   char *python_path;
+#ifdef DEBUG
   fprintf(stderr,"PYTHON SUPPORT \n");
+#endif
   fflush(stderr);
   if(tmp!=NULL){
+#ifdef DEBUG
     fprintf(stderr,"PYTHON SUPPORT (%i)\n",strlen(tmp->value));
+#endif
     python_path=(char*)malloc((strlen(tmp->value))*sizeof(char));
     sprintf(python_path,"%s",tmp->value);
Index: trunk/zoo-kernel/zoo_service_loader.c
===================================================================
--- trunk/zoo-kernel/zoo_service_loader.c	(revision 62)
+++ trunk/zoo-kernel/zoo_service_loader.c	(revision 63)
@@ -27,5 +27,4 @@
 extern "C" int yylex();
 extern "C" int crlex();
-
 
 extern "C" {
@@ -472,5 +471,5 @@
     SERVICE_URL=strdup(tmpm->value);
   else
-    SERVICE_URL=DEFAULT_SERVICE_URL;
+    SERVICE_URL=strdup(DEFAULT_SERVICE_URL);
 
   service* s[100];
@@ -1614,5 +1613,5 @@
    * DataInputs and ResponseDocument / RawDataOutput
    */  
-  char *dfv=addDefaultValues(&request_input_real_format,s1->inputs,m,"inputs");
+  char *dfv=addDefaultValues(&request_input_real_format,s1->inputs,m,0);
   if(strcmp(dfv,"")!=0){
     char tmps[1024];
@@ -1621,4 +1620,6 @@
     addToMap(tmpe,"code","MissingParameterValue");
     printExceptionReportResponse(m,tmpe);
+    freeService(&s1);
+    free(s1);
     freeMap(&tmpe);
     free(tmpe);
@@ -1626,4 +1627,5 @@
     free(m);
     free(REQUEST);
+    free(SERVICE_URL);
     freeMaps(&request_input_real_format);
     free(request_input_real_format);
@@ -1634,5 +1636,5 @@
     return 1;
   }
-  addDefaultValues(&request_output_real_format,s1->outputs,m,"outputs");
+  addDefaultValues(&request_output_real_format,s1->outputs,m,1);
 
 #ifdef DEBUG
