Index: /trunk/zoo-project/zoo-kernel/service.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service.h	(revision 617)
+++ /trunk/zoo-project/zoo-kernel/service.h	(revision 618)
@@ -104,4 +104,5 @@
 #include <string.h>
 #ifndef WIN32
+#include <ctype.h>
 #ifndef bool
 #define bool int
@@ -115,5 +116,5 @@
    * Local false definition
    */
-#define false -1
+#define false 0
 #endif
 #endif
@@ -1267,4 +1268,6 @@
    */
   static void dumpService(service* s){
+    if(s==NULL)
+      return;
     fprintf(stderr,"++++++++++++++++++\nSERVICE [%s]\n++++++++++++++++++\n",s->name);
     if(s->content!=NULL){
Index: /trunk/zoo-project/zoo-kernel/service_conf.l
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_conf.l	(revision 617)
+++ /trunk/zoo-project/zoo-kernel/service_conf.l	(revision 618)
@@ -22,5 +22,5 @@
 #endif
 
-char *lmsg;
+char *lmsg=NULL;
 int attentionImpossibleDeTrouverXMLDeclapres = 0 ;
 
@@ -41,5 +41,5 @@
 
 attname	[a-zA-Z0-9._\-]+
-attvalue1	[°²θé#\^\*\+,;@a-zA-Z0-9%_\-::.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+
+attvalue1	[#°²θé\^\*\+,;@a-zA-Z0-9%_\-:\:.:" "\"\'/\\\(\)\t\|\$\&>\[\]]+
 
 attvalue		\"[^"]*\"|\'[^']*\'\(\)
Index: /trunk/zoo-project/zoo-kernel/service_conf.y
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_conf.y	(revision 617)
+++ /trunk/zoo-project/zoo-kernel/service_conf.y	(revision 618)
@@ -20,5 +20,5 @@
 static bool wait_defaults=false;
 static bool wait_supporteds=false;
-static bool wait_outputs=-1;
+static bool wait_outputs=false;
 static bool wait_data=false;
 static service* my_service=NULL;
@@ -805,5 +805,5 @@
   dumpElements(current_element);
 #endif
-  if(wait_outputs>0 && current_element!=NULL && current_element->name!=NULL){
+  if(wait_outputs && current_element!=NULL && current_element->name!=NULL){
     if(my_service->outputs==NULL){  
 #ifdef DEBUG_SERVICE_CONF
@@ -834,9 +834,10 @@
     current_element=NULL;
   }
-  int contentOnly=-1;
+  int contentOnly=false;
   if(current_content!=NULL){
     if(my_service->content==NULL){
       addMapToMap(&my_service->content,current_content);
-      contentOnly=1;
+      contentOnly=true;
+      wait_maincontent=false;
     }
     freeMap(&current_content);
@@ -848,5 +849,5 @@
   dumpService(my_service);
 #endif
-  if(contentOnly<0 && ((wait_outputs<0 && current_data==2 && my_service->outputs==NULL) || my_service==NULL || my_service->name==NULL || my_service->content==NULL)){
+  if(wait_maincontent==true || (contentOnly==false && ((!wait_outputs && current_data==2 && my_service->outputs==NULL) || my_service==NULL || my_service->name==NULL || my_service->content==NULL))){
     setMapInMaps(conf,"lenv","message",srlval.chaine);
 #ifndef WIN32
Index: /trunk/zoo-project/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 617)
+++ /trunk/zoo-project/zoo-kernel/service_internal.c	(revision 618)
@@ -2788,19 +2788,19 @@
 	    map *ext=getMap(tmpI->content,"extension");
 	    char *file_path;
-		char file_ext[32];
+	    char file_ext[32];
 
 	    if( ext != NULL && ext->value != NULL) {
-			strncpy(file_ext, ext->value, 32);
-		}
-		else {
+	      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);
+	      getFileExtension(mtype != NULL ? mtype->value : NULL, file_ext, 32);
 	    }
 		
-		file_name=(char*)malloc((strlen(s->name)+strlen(file_ext)+strlen(tmpI->name)+1024)*sizeof(char));
+	    file_name=(char*)malloc((strlen(s->name)+strlen(file_ext)+strlen(tmpI->name)+1024)*sizeof(char));
 	    int cpid0=cpid+time(NULL);	    
-		sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,file_ext);
+	    sprintf(file_name,"%s_%s_%i.%s",s->name,tmpI->name,cpid0,file_ext);
 	    file_path=(char*)malloc((strlen(tmp1->value)+strlen(file_name)+2)*sizeof(char));
 	    sprintf(file_path,"%s/%s",tmp1->value,file_name);
Index: /trunk/zoo-project/zoo-kernel/service_internal_otb.c
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 617)
+++ /trunk/zoo-project/zoo-kernel/service_internal_otb.c	(revision 618)
@@ -158,4 +158,5 @@
 		char tmp[1024];
 		map* tmpVal=getMapFromMaps(outputs,paramKey.c_str(),"mimeType");
+		maps* tmpMaps=getMaps(outputs,paramKey.c_str());
 		if(test!=NULL && test->value!=NULL && strncasecmp(test->value,"true",4)==0){
 		  test=getMapFromMaps(inputs,paramKey.c_str(),"value");
@@ -190,6 +191,96 @@
 		    dynamic_cast<OutputImageParameter *> (param.GetPointer())->SetPixelType(outPixType);
 		  }else{
-		    if(test->value!=NULL)
-		      m_Application->SetParameterString(paramKey, test->value);
+		    map* tmpVal=getMapFromMaps(inputs,paramKey.c_str(),"mimeType");
+		    char file_ext[32];
+		    getFileExtension(tmpVal != NULL ? tmpVal->value : NULL, file_ext, 32);
+		    if(type == ParameterType_InputImageList){
+		      values.push_back(test->value);
+		      map* tmpLength=getMapFromMaps(inputs,paramKey.c_str(),"length");
+		      if(tmpLength!=NULL){
+			int len=atoi(tmpLength->value);
+			for(int k=1;k<len;k++){
+			  char *val=(char*)malloc((strlen(tmpPath->value)+strlen(s->name)+strlen(tmpSid->value)+strlen(file_ext)+13)*sizeof(char));
+			  sprintf(val,"%s/Input_%s_%s_%d.%s",tmpPath->value,s->name,tmpSid->value,k,file_ext);
+			  FILE* of=fopen(val,"wb");
+			  int length=0;
+			  map* tmpSize=getMap(test,"size");
+			  if(tmpSize!=NULL){
+			    length=atoi(tmpSize->value);
+			  }
+			  fwrite(test->value,sizeof(char),length,of);
+			  fclose(of);
+			  values.push_back(val);
+			  free(val);
+			}
+		      }
+		      dynamic_cast<InputImageListParameter *> (param.GetPointer())->SetListFromFileName(values);
+		    }
+		    else
+		      if(type == ParameterType_InputVectorData || type == ParameterType_InputImage
+			   || type == ParameterType_ComplexInputImage || type == ParameterType_InputVectorData
+			   || type == ParameterType_InputFilename){
+			map* tmpPath=getMapFromMaps(m,"main","tmpPath");
+			map* tmpSid=getMapFromMaps(m,"lenv","sid");
+			char tmp[1024];
+			char* ext="json";
+			if(tmpVal!=NULL){
+			  char *val=(char*)malloc((strlen(tmpPath->value)+strlen(s->name)+strlen(tmpSid->value)+strlen(file_ext)+10)*sizeof(char));
+			  sprintf(val,"%s/Input_%s_%s.%s",tmpPath->value,s->name,tmpSid->value,file_ext);
+			  FILE* of=fopen(val,"wb");
+			  int length=0;
+			  map* tmpSize=getMap(test,"size");
+			  if(tmpSize!=NULL){
+			    length=atoi(tmpSize->value);
+			  }
+			  fwrite(test->value,sizeof(char),length,of);
+			  fclose(of);
+
+			  if(strncasecmp(tmpVal->value,"application/zip",14)==0){
+
+			    char tmpName[1024];
+			    sprintf(tmpName,"/vsizip/%s",val);
+			    char **files=VSIReadDir(tmpName);
+			    int nFiles = CSLCount( files );
+			    char tmpSSName[1024];
+			    sprintf(tmpSSName,"%s/Input_%s_%s",tmpPath->value,s->name,tmpSid->value);
+			    mkdir(tmpSSName,0777);
+			    
+			    char tmpSName[1024];
+			    for(int kk=0;kk<nFiles;kk++){
+			      sprintf(tmpSName,"%s/%s",tmpName,files[kk]);
+			      VSILFILE* fmain=VSIFOpenL(tmpSName, "rb");
+			      if(fmain!=NULL){
+				VSIFSeekL(fmain,0,SEEK_END);
+				long count=VSIFTellL(fmain);
+				VSIRewindL(fmain);
+				
+				char *content=(char*) malloc((count+1)*sizeof(char));  
+				VSIFReadL(content,1,count*sizeof(char),fmain);
+				
+				char tmpSSSName[1024];
+				sprintf(tmpSSSName,"%s/%s",tmpSSName,files[kk]);
+				
+				FILE* fx=fopen(tmpSSSName, "wb");
+				fwrite(content,1,count,fx);
+				fclose(fx);
+				VSIFCloseL(fmain);
+				free(content);
+				std::string test1(tmpSSSName);
+				if(test1.find(".shp")!=std::string::npos){
+				  setMapInMaps(inputs,paramKey.c_str(),"cache_file",tmpSSSName);
+				  test=getMapFromMaps(inputs,paramKey.c_str(),"cache_file");
+				}
+			      }
+			    }
+			    m_Application->SetParameterString(paramKey, test->value);
+			  }else{
+			    m_Application->SetParameterString(paramKey, val);
+			  }
+			  free(val);
+			}
+		      }
+		      else
+			if(test->value!=NULL)
+			  m_Application->SetParameterString(paramKey, test->value);
 		  }
 
@@ -316,5 +407,5 @@
 		       || type == ParameterType_InputFilename){
 		      m_Application->SetParameterString(paramKey, test->value);
-		  }		  
+		  }
 	      }
 	    }
Index: /trunk/zoo-project/zoo-kernel/service_internal_otb.h
===================================================================
--- /trunk/zoo-project/zoo-kernel/service_internal_otb.h	(revision 617)
+++ /trunk/zoo-project/zoo-kernel/service_internal_otb.h	(revision 618)
@@ -34,4 +34,5 @@
 #include "otbZooWatcher.h"
 #include "service_internal.h"
+#include "mimetypes.h"
 #include "service.h"
 #include "cgic.h"
