Index: /trunk/zoo-kernel/service_conf.y
===================================================================
--- /trunk/zoo-kernel/service_conf.y	(revision 64)
+++ /trunk/zoo-kernel/service_conf.y	(revision 65)
@@ -203,5 +203,5 @@
 	dumpElements(my_service->inputs);
 	dumpService(my_service);
-#endif
+#endif	
 	if(my_service->inputs==NULL){
 	  my_service->inputs=dupElements(current_element);
@@ -238,5 +238,5 @@
       wait_outputs=true;
       current_data=2;
-      previous_data=1;
+      previous_data=2;
     }
     else
@@ -587,9 +587,10 @@
     else
       if(current_data==2){ 
-	if(wait_inputs==true){
+	wait_outputs=true;
+	if(wait_inputs){
 	  if(current_element!=NULL && current_element->name!=NULL){
-	    if(my_service->inputs==NULL){
-	      my_service->inputs=dupElements(current_element);
-	      my_service->inputs->next=NULL;
+	    if(my_service->outputs==NULL){
+	      my_service->outputs=dupElements(current_element);
+	      my_service->outputs->next=NULL;
 	    }
 	    else{
@@ -597,5 +598,5 @@
 	      fprintf(stderr,"LAST NAME IN %s (current - %s)\n",$1,current_element->name);
 #endif
-	      addToElements(&my_service->inputs,current_element);
+	      addToElements(&my_service->outputs,current_element);
 	    }
 #ifdef DEBUG_SERVICE_CONF
@@ -624,5 +625,5 @@
 #endif
 	    char *cen=strdup($1);
-	    current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char*));
+	    current_element->name=(char*)malloc((strlen(cen)-1)*sizeof(char));
 	    cen[strlen(cen)-1]=0;
 	    cen+=1;
@@ -637,9 +638,21 @@
 	    current_element->next=NULL;
 	  }
-	  wait_inputs=false;
+
 	  current_content=NULL;
 	}
 	else
-	  if(current_element->name==NULL){
+	  if(current_element!=NULL && current_element->name!=NULL){
+	    if(my_service->outputs==NULL)
+	      my_service->outputs=dupElements(current_element);
+	    else
+	      addToElements(&my_service->outputs,current_element);
+	    fprintf(stderr,"ADD TO OUTPUTS Elements\n");
+	    dupElements(current_element);
+
+	    freeElements(&current_element);
+	    free(current_element);
+	    current_element=NULL;
+	  }
+	  else{
 #ifdef DEBUG_SERVICE_CONF
 	    fprintf(stderr,"NAME OUT %s\n",$1);
@@ -663,5 +676,7 @@
 	    current_element->next=NULL;
 	  }
+	wait_inputs=false;
 	wait_outputs=true;
+	//wait_outputs=true;
       }
   }
@@ -724,5 +739,5 @@
   int resultatYYParse = srparse() ;
   
-  if(wait_outputs==true && 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
Index: /trunk/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-kernel/service_internal.c	(revision 64)
+++ /trunk/zoo-kernel/service_internal.c	(revision 65)
@@ -1126,9 +1126,9 @@
     int i;
     maps* mcursor=inputs;
-    elements* scursor=serv->inputs;
+    elements* scursor=NULL;
     while(mcursor!=NULL /*&& scursor!=NULL*/){
+      scursor=getElements(serv->inputs,mcursor->name);
       printIOType(doc,nc,ns,ns_ows,scursor,mcursor,"Input");
       mcursor=mcursor->next;
-      //scursor=scursor->next;
     }
     xmlAddChild(n,nc);
@@ -1140,9 +1140,9 @@
     nc = xmlNewNode(ns, BAD_CAST "OutputDefinitions");
     mcursor=outputs;
-    scursor=serv->outputs;
-    while(mcursor!=NULL /*&& scursor!=NULL*/){
+    scursor=NULL;
+    while(mcursor!=NULL){
+      scursor=getElements(serv->outputs,mcursor->name);
       printOutputDefinitions1(doc,nc,ns,ns_ows,scursor,mcursor,"Output");
       mcursor=mcursor->next;
-      //scursor=scursor->next;
     }
     xmlAddChild(n,nc);
@@ -1160,4 +1160,5 @@
     elements* scursor=serv->outputs;
     while(mcursor!=NULL){
+      scursor=getElements(serv->outputs,mcursor->name);
       printIOType(doc,nc,ns,ns_ows,scursor,mcursor,"Output");
       mcursor=mcursor->next;
@@ -1264,5 +1265,9 @@
   xmlNodePtr nc1,nc2,nc3;
   nc1=xmlNewNode(ns_wps, BAD_CAST type);
-  map *tmp=e->content;
+  map *tmp=NULL;
+  if(e!=NULL)
+    tmp=e->content;
+  else
+    tmp=m->content;
 #ifdef DEBUG
   dumpMap(tmp);
@@ -1270,17 +1275,30 @@
 #endif
   nc2=xmlNewNode(ns_ows, BAD_CAST "Identifier");
-  nc3=xmlNewText(BAD_CAST e->name);
+  if(e!=NULL)
+    nc3=xmlNewText(BAD_CAST e->name);
+  else
+    nc3=xmlNewText(BAD_CAST m->name);
   xmlAddChild(nc2,nc3);
   xmlAddChild(nc1,nc2);
   xmlAddChild(nc,nc1);
   // Extract Title required to be first element in the ZCFG file !
-  nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name);
-  nc3=xmlNewText(BAD_CAST _ss(tmp->value));
-  xmlAddChild(nc2,nc3);  
-  xmlAddChild(nc1,nc2);
-  // Extract Abstract required to be second element in the ZCFG file !
-  // For GRASS it can be empty ...
-  if(tmp->next!=NULL){
-    tmp=tmp->next;
+  bool isTitle=true;
+  if(e!=NULL)
+    tmp=getMap(e->content,"Title");
+  else
+    tmp=getMap(m->content,"Title");
+  
+  if(tmp!=NULL){
+    nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name);
+    nc3=xmlNewText(BAD_CAST _ss(tmp->value));
+    xmlAddChild(nc2,nc3);  
+    xmlAddChild(nc1,nc2);
+  }
+
+  if(e!=NULL)
+    tmp=getMap(e->content,"Abstract");
+  else
+    tmp=getMap(m->content,"Abstract");
+  if(tmp!=NULL){
     nc2=xmlNewNode(ns_ows, BAD_CAST tmp->name);
     nc3=xmlNewText(BAD_CAST _ss(tmp->value));
@@ -1288,5 +1306,4 @@
     xmlAddChild(nc1,nc2);
     xmlAddChild(nc,nc1);
-    tmp=tmp->next;
   }
 
@@ -1300,11 +1317,20 @@
   if(tmpMap==NULL){
     nc2=xmlNewNode(ns_wps, BAD_CAST "Data");
-    if(strncasecmp(e->format,"LITERALOUTPUT",strlen(e->format))==0)
-      nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
-    else
-      if(strncasecmp(e->format,"COMPLEXOUTPUT",strlen(e->format))==0)
-	nc3=xmlNewNode(ns_wps, BAD_CAST "ComplexData");
+    if(e!=NULL){
+      if(strncasecmp(e->format,"LITERALOUTPUT",strlen(e->format))==0)
+	nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
       else
-	nc3=xmlNewNode(ns_wps, BAD_CAST e->format);
+	if(strncasecmp(e->format,"COMPLEXOUTPUT",strlen(e->format))==0)
+	  nc3=xmlNewNode(ns_wps, BAD_CAST "ComplexData");
+	else
+	  nc3=xmlNewNode(ns_wps, BAD_CAST e->format);
+    }
+    else{
+      map* tmpV=getMapFromMaps(m,"format","value");
+      if(tmpV!=NULL)
+	nc3=xmlNewNode(ns_wps, BAD_CAST tmpV->value);
+      else
+	nc3=xmlNewNode(ns_wps, BAD_CAST "LitteralData");
+    }
     tmp=m->content;
     while(tmp!=NULL){
@@ -1314,10 +1340,17 @@
 	 strncasecmp(tmp->name,"status",strlen(tmp->name))!=0 &&
 	 strncasecmp(tmp->name,"storeExecuteResponse",strlen(tmp->name))!=0 &&
-	 strncasecmp(tmp->name,"extension",strlen(tmp->name))!=0)
+	 strncasecmp(tmp->name,"extension",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"format",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"Title",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"Abstract",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"size",strlen(tmp->name))!=0)
 	xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value);
       tmp=tmp->next;
       xmlAddChild(nc2,nc3);
     }
-    tmp=getMap(e->defaults->content,"mimeType");
+    if(e!=NULL)
+      tmp=getMap(e->defaults->content,"mimeType");
+    else
+      tmp=NULL;
     map* tmp1=getMap(m->content,"encoding");
     map* tmp2=getMap(m->content,"mimeType");
@@ -1357,10 +1390,13 @@
     while(tmp!=NULL){
       if(strncasecmp(tmp->name,"value",strlen(tmp->name))!=0 &&
-	 strncasecmp(tmp->name,"reference",strlen(tmp->name))!=0 &&
 	 strncasecmp(tmp->name,"extension",strlen(tmp->name))!=0 &&
-	 strncasecmp(tmp->name,"abstract",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"asReference",strlen(tmp->name))!=0 &&
 	 strncasecmp(tmp->name,"status",strlen(tmp->name))!=0 &&
 	 strncasecmp(tmp->name,"storeExecuteResponse",strlen(tmp->name))!=0 &&
-	 strncasecmp(tmp->name,"asReference",strlen(tmp->name))!=0)
+	 strncasecmp(tmp->name,"extension",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"format",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"Title",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"Abstract",strlen(tmp->name))!=0 &&
+	 strncasecmp(tmp->name,"size",strlen(tmp->name))!=0)
 	xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value);
       tmp=tmp->next;
