Index: branches/prototype-v0/zoo-project/zoo-kernel/response_print.c
===================================================================
--- branches/prototype-v0/zoo-project/zoo-kernel/response_print.c	(revision 890)
+++ branches/prototype-v0/zoo-project/zoo-kernel/response_print.c	(revision 896)
@@ -1776,5 +1776,5 @@
  * @param outputs the outputs generated by the service
  */
-void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){
+void printProcessResponse(maps* m,map* request, int pid,service* serv,const char* service,int status,maps* inputs,maps* outputs){	
   xmlNsPtr ns,ns_ows,ns_xlink;
   xmlNodePtr nr,n,nc,nc1=NULL,nc3;
@@ -1797,5 +1797,5 @@
   char stored_path[1024];
   memset(stored_path,0,1024);
-    
+  
   if(vid==0){
     char tmp[256];
@@ -1982,5 +1982,5 @@
     }
   }
-
+  
   /**
    * Display the process output only when requested !
@@ -1993,12 +1993,12 @@
     maps* mcursor=outputs;
     elements* scursor=serv->outputs;
-    map* testResponse=getMap(request,"RawDataOutput");
+    map* testResponse=getMap(request,"RawDataOutput");	
     if(testResponse==NULL)
       testResponse=getMap(request,"ResponseDocument");
-    while(mcursor!=NULL){
+    while(mcursor!=NULL){		
       map* tmp0=getMap(mcursor->content,"inRequest");
-      scursor=getElements(serv->outputs,mcursor->name);
-      if(scursor!=NULL){
-	if(testResponse==NULL || tmp0==NULL){
+      scursor=getElements(serv->outputs,mcursor->name);	  
+      if(scursor!=NULL){		  
+	if(testResponse==NULL || tmp0==NULL){		
 	  if(vid==0)
 	    printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
@@ -2007,10 +2007,10 @@
 	}
 	else
-	  if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0){
+	  if(tmp0!=NULL && strncmp(tmp0->value,"true",4)==0){		  
 	    if(vid==0)
 	      printIOType(doc,nc,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
 	    else
 	      printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
-	  }
+	  }	
       }else
 	/**
@@ -2023,9 +2023,8 @@
 	  printIOType(doc,n,ns,ns_ows,ns_xlink,scursor,mcursor,"Output",vid);
       mcursor=mcursor->next;
-    }
+    }	
     if(vid==0)
       xmlAddChild(n,nc);
-  }
-
+  }  
   if(vid==0 && 
      hasStoredExecuteResponse==true 
@@ -2176,6 +2175,5 @@
  * @param type the type
  */
-void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type,int vid){
-
+void printIOType(xmlDocPtr doc,xmlNodePtr nc,xmlNsPtr ns_wps,xmlNsPtr ns_ows,xmlNsPtr ns_xlink,elements* e,maps* m,const char* type,int vid){	
   xmlNodePtr nc1,nc2,nc3;
   nc1=xmlNewNode(ns_wps, BAD_CAST type);
@@ -2184,6 +2182,5 @@
     tmp=e->content;
   else
-    tmp=m->content;
-
+    tmp=m->content;  
   if(vid==0){
     nc2=xmlNewNode(ns_ows, BAD_CAST "Identifier");
@@ -2225,7 +2222,7 @@
     xmlNewProp(nc1,BAD_CAST "id",BAD_CAST (e!=NULL?e->name:m->name));
   }
-
+  
   // IO type nested outputs
-  if(m->child!=NULL){
+  if(m->child!=NULL){	  
     maps* curs=m->child;
     elements* ecurs=getElements(e,(e!=NULL?e->name:m->name));
@@ -2241,11 +2238,11 @@
     }
   }
-  else{
+  else{	  
     map *tmpMap=getMap(m->content,"Reference");
-    if(tmpMap==NULL){
+    if(tmpMap==NULL){		
       nc2=xmlNewNode(ns_wps, BAD_CAST "Data");
-      if(e!=NULL && e->format!=NULL){
-	if(strncasecmp(e->format,"LiteralOutput",strlen(e->format))==0)
-	  nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
+      if(e!=NULL && e->format!=NULL){		  
+		  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)
@@ -2254,8 +2251,8 @@
 	    nc3=xmlNewNode(ns_wps, BAD_CAST "BoundingBoxData");
 	  else
-	    nc3=xmlNewNode(ns_wps, BAD_CAST e->format);
-      }
-      else {
-	map* tmpV=getMapFromMaps(m,"format","value");
+	    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);
@@ -2263,6 +2260,6 @@
 	  nc3=xmlNewNode(ns_wps, BAD_CAST "LiteralData");
       } 
-      tmp=m->content;
-      
+      tmp=m->content;	  
+
       while(tmp!=NULL){
 	if(strcasecmp(tmp->name,"mimeType")==0 ||
@@ -2270,6 +2267,5 @@
 	   strcasecmp(tmp->name,"schema")==0 ||
 	   strcasecmp(tmp->name,"datatype")==0 ||
-	   strcasecmp(tmp->name,"uom")==0) {
-	  
+	   strcasecmp(tmp->name,"uom")==0) {	
 	  if(vid==0)
 	    xmlNewProp(nc3,BAD_CAST tmp->name,BAD_CAST tmp->value);
@@ -2282,7 +2278,8 @@
 	  }
 	}
+
 	if(vid==0)
 	  xmlAddChild(nc2,nc3);
-	tmp=tmp->next;
+	tmp=tmp->next;	
       }
       if(e!=NULL && e->format!=NULL && strcasecmp(e->format,"BoundingBoxData")==0) {
@@ -2295,10 +2292,11 @@
 	}
       }
-      else {
-	if(e!=NULL)
-	  tmp=getMap(e->defaults->content,"mimeType");
+      else {		  
+		  //if (e != NULL) {
+		  if (e != NULL && e->defaults != NULL) { // knut: add extra NULL pointer check in case user omits <Default> block in config file			  
+			  tmp = getMap(e->defaults->content, "mimeType");
+		  }
 	else
-	  tmp=NULL;
-	
+	  tmp=NULL;	
 	map* tmp1=getMap(m->content,"encoding");
 	map* tmp2=getMap(m->content,"mimeType");
@@ -2640,5 +2638,5 @@
   dumpMaps(request_outputs);
   fprintf(stderr,"printProcessResponse\n");
-#endif
+#endif  
   map* toto=getMap(request_inputs1,"RawDataOutput");
   int asRaw=0;
@@ -2727,5 +2725,5 @@
   }
 
-  if(res!=SERVICE_SUCCEEDED){
+  if(res!=SERVICE_SUCCEEDED){	  
     printProcessResponse(m,request_inputs1,cpid,
                          s, s->name,res,  // replace serviceProvider with serviceName in stored response file name
@@ -2734,6 +2732,5 @@
     return;
   }
-    
-	
+      
   map *tmp1=getMapFromMaps(m,"main","tmpPath");
   if(asRaw==0){
@@ -2757,5 +2754,5 @@
 #endif
       map *gfile=getMap(tmpI->content,"generated_file");
-      char *file_name=NULL;
+      char *file_name=NULL;	  
       if(gfile!=NULL){
 	gfile=getMap(tmpI->content,"expected_generated_file");
@@ -2765,5 +2762,5 @@
 	readGeneratedFile(m,tmpI->content,gfile->value);
 	file_name=zStrdup((gfile->value)+strlen(tmp1->value));
-      }
+      }	  
       toto=getMap(tmpI->content,"asReference");
 #ifdef USE_MS
@@ -2776,5 +2773,5 @@
 	if(toto!=NULL && strcasecmp(toto->value,"true")==0)
 #endif
-	  {
+	  {		
 	    elements* in=getElements(s->outputs,tmpI->name);
 	    if(in==NULL && s->outputs->child!=NULL){
@@ -2791,6 +2788,5 @@
 	      addToMap(tmpI->content,"encoding","UTF-8");
 	      addToMap(tmpI->content,"schema","http://schemas.opengis.net/ows/1.1.0/owsCommon.xsd");
-	    }
-
+	    }		
 	    char *file_path=NULL;
 	    if(gfile==NULL) {
@@ -2880,5 +2876,5 @@
 	  }
 	}
-#endif
+#endif	
       if(file_name!=NULL){
 	free(file_name);
@@ -2896,5 +2892,5 @@
     fprintf(stderr,"SERVICE : %s\n",s->name);
     dumpMaps(m);
-#endif
+#endif	
     if(error<0)
       printProcessResponse(m,request_inputs1,cpid,
