Index: trunk/zoo-kernel/service_internal.c
===================================================================
--- trunk/zoo-kernel/service_internal.c	(revision 65)
+++ trunk/zoo-kernel/service_internal.c	(revision 66)
@@ -1606,7 +1606,15 @@
     if(res!=SERVICE_FAILED){
       /**
-       * We get the first output only !!
+       * We get the requested output or fallback to the first one if the 
+       * requested one is not present in the resulting outputs maps.
        */
-      toto=getMap(request_outputs->content,"value");
+      maps* tmpI=NULL;
+      map* tmpIV=getMap(request_inputs1,"RawDataOutput");
+      if(tmpIV!=NULL){
+	tmpI=getMaps(request_outputs,tmpIV->value);
+      }
+      if(tmpI==NULL)
+	tmpI=request_outputs;
+      toto=getMap(tmpI->content,"value");
       if(toto==NULL){
 	map * errormap = createMap("text",_("Unable to fetch any result"));
@@ -1617,5 +1625,5 @@
       }
       char mime[1024];
-      map* mi=getMap(request_outputs->content,"mimeType");
+      map* mi=getMap(tmpI->content,"mimeType");
 #ifdef DEBUG
       fprintf(stderr,"SERVICE OUTPUTS\n");
@@ -1623,5 +1631,5 @@
       fprintf(stderr,"SERVICE OUTPUTS\n");
 #endif
-      map* en=getMap(request_outputs->content,"encoding");
+      map* en=getMap(tmpI->content,"encoding");
       if(mi!=NULL && en!=NULL)
 	sprintf(mime,
@@ -1637,5 +1645,5 @@
       printf("%s",mime);
       if(mi!=NULL && strncmp(mi->value,"image",5)==0){
-	map* rs=getMapFromMaps(request_outputs,request_outputs->name,"size");
+	map* rs=getMapFromMaps(tmpI,tmpI->name,"size");
 	fwrite(toto->value,atoi(rs->value),1,stdout);
       }
