Index: /trunk/zoo-kernel/service_internal.c
===================================================================
--- /trunk/zoo-kernel/service_internal.c	(revision 71)
+++ /trunk/zoo-kernel/service_internal.c	(revision 72)
@@ -2,5 +2,5 @@
  * Author : Gérald FENOY
  *
- * Copyright (c) 2009-2010 GeoLabs SARL
+ * Copyright (c) 2009-2011 GeoLabs SARL
  *
  * Permission is hereby granted, free of charge, to any person obtaining a copy
@@ -1048,6 +1048,8 @@
   char tmp[256];
   char url[1024];
+  char stored_path[1024];
   memset(tmp,0,256);
-  memset(url,0,256);
+  memset(url,0,1024);
+  memset(stored_path,0,1024);
   maps* tmp_maps=getMaps(m,"main");
   if(tmp_maps!=NULL){
@@ -1099,9 +1101,16 @@
     if(tmpm1!=NULL)
       sprintf(tmp,"%s/",tmpm1->value);
-  }
+    tmpm1=getMapFromMaps(m,"main","TmpPath");
+    sprintf(stored_path,"%s/%s_%i.xml",tmpm1->value,service,pid);
+  }
+
+  
 
   xmlNewProp(n,BAD_CAST "serviceInstance",BAD_CAST tmp);
-  if(status!=SERVICE_SUCCEEDED && status!=SERVICE_FAILED){
+  map* test=getMap(request,"storeExecuteResponse");
+  bool hasStoredExecuteResponse=false;
+  if(test!=NULL && strcasecmp(test->value,"true")==0){
     xmlNewProp(n,BAD_CAST "statusLocation",BAD_CAST url);
+    hasStoredExecuteResponse=true;
   }
 
@@ -1236,4 +1245,14 @@
 #endif
   xmlDocSetRootElement(doc, n);
+  if(hasStoredExecuteResponse){
+    /* We need to write the ExecuteResponse Document somewhere */
+    FILE* output=fopen(stored_path,"w");
+    xmlChar *xmlbuff;
+    int buffersize;
+    xmlDocDumpFormatMemoryEnc(doc, &xmlbuff, &buffersize, "UTF-8", 1);
+    fwrite(xmlbuff,1,strlen(xmlbuff)*sizeof(char),output);
+    xmlFree(xmlbuff);
+    fclose(output);
+  }
   printDocument(m,doc,pid);
 
Index: /trunk/zoo-kernel/zoo_service_loader.c
===================================================================
--- /trunk/zoo-kernel/zoo_service_loader.c	(revision 71)
+++ /trunk/zoo-kernel/zoo_service_loader.c	(revision 72)
@@ -1700,4 +1700,29 @@
    */
   r_inputs=NULL;
+  map* store=getMap(request_inputs,"storeExecuteResponse");
+  map* status=getMap(request_inputs,"status");
+  /**
+   * 05-007r7 WPS 1.0.0 page 57 :
+   * 'If status="true" and storeExecuteResponse is "false" then the service 
+   * shall raise an exception.'
+   */
+  if(status!=NULL && strcmp(status->value,"true")==0 && 
+     store!=NULL && strcmp(store->value,"false")==0){
+    errorException(m, _("Status cannot be set to true with storeExecuteResponse to false. Please, modify your request parameters."), "InvalidParameterValue");
+    freeService(&s1);
+    free(s1);
+    freeMaps(&m);
+    free(m);
+    
+    freeMaps(&request_input_real_format);
+    free(request_input_real_format);
+    
+    freeMaps(&request_output_real_format);
+    free(request_output_real_format);
+    
+    free(REQUEST);
+    free(SERVICE_URL);
+    return 1;
+  }
   r_inputs=getMap(request_inputs,"storeExecuteResponse");
   int eres=SERVICE_STARTED;
@@ -1719,8 +1744,8 @@
 #endif
 
-  if(r_inputs!=NULL)
-    if(strcasecmp(r_inputs->value,"false")==0)
-      r_inputs=NULL;
-  if(r_inputs==NULLMAP){
+  if(status!=NULL)
+    if(strcasecmp(status->value,"false")==0)
+      status=NULL;
+  if(status==NULLMAP){
     loadServiceAndRun(&m,s1,request_inputs,&request_input_real_format,&request_output_real_format,&eres);
   }
