Index: branches/branch-1.2/zoo-services/arithmetics/cgi-env/Multiply.zcfg
===================================================================
--- branches/branch-1.2/zoo-services/arithmetics/cgi-env/Multiply.zcfg	(revision 111)
+++ branches/branch-1.2/zoo-services/arithmetics/cgi-env/Multiply.zcfg	(revision 217)
@@ -5,5 +5,5 @@
  storeSupported = true
  statusSupported = true
- serviceProvider = demo_service.zo
+ serviceProvider = test_service.zo
  serviceType = C
  <MetaData>
Index: branches/branch-1.2/zoo-services/arithmetics/makefile.vc
===================================================================
--- branches/branch-1.2/zoo-services/arithmetics/makefile.vc	(revision 111)
+++ branches/branch-1.2/zoo-services/arithmetics/makefile.vc	(revision 217)
@@ -1,11 +1,11 @@
 GEODIR=c:/OSGeo4W/
 TOOLS=c:/Users/djay/GeoLabs/tools/
-CFLAGS=-I$(GEODIR)/include -I$(TOOLS)/include -I../../../zoo-kernel/ -I./ -DLINUX_FREE_ISSUE -DDEBUG
+CFLAGS=-I$(GEODIR)/include -I$(TOOLS)/include -I../../zoo-kernel/ -I./ -DLINUX_FREE_ISSUE -DDEBUG -DWIN32
 CPP=cl /TP 
 
-cgi-env/service.zo: service.c
-	$(CPP) $(CFLAGS) /c service.c
-	link /dll /out:cgi-env/ogr_service.zso ../../../zoo-kernel/service_internal.obj ./service.obj -L$(TOOLS)/lib/libssl32.dll.a $(GEODIR)/lib/libxml2.lib $(GEODIR)/lib/gdal_i.lib $(TOOLS)/lib/libeay32.dll.a $(TOOLS)/lib/libcrypto.a $(TOOLS)/lib/libssl32.dll.a 
+cgi-env/test_service.zo: test_service.c
+	$(CPP) $(CFLAGS) /c test_service.c
+	link /dll /out:cgi-env/test_service.zo ../../zoo-kernel/service_internal.obj ./test_service.obj -L$(TOOLS)/lib/libssl32.dll.a $(GEODIR)/lib/libxml2.lib $(GEODIR)/lib/gdal_i.lib $(TOOLS)/lib/libeay32.dll.a $(TOOLS)/lib/libcrypto.a $(TOOLS)/lib/libssl32.dll.a $(TOOLS)/lib/libintl.lib
 
 clean:
-	rm -f cgi-env/ogr_service.zso
+	erase cgi-env\demo_service.*
Index: branches/branch-1.2/zoo-services/arithmetics/test_service.c
===================================================================
--- branches/branch-1.2/zoo-services/arithmetics/test_service.c	(revision 111)
+++ branches/branch-1.2/zoo-services/arithmetics/test_service.c	(revision 217)
@@ -3,4 +3,7 @@
 extern "C" {
 
+#ifdef WIN32
+__declspec(dllexport)
+#endif
   int Multiply(maps*& conf,maps*& inputs,maps*& outputs){
   	fprintf(stderr,"\nService internal print\n");
Index: branches/branch-1.2/zoo-services/cgal/Makefile
===================================================================
--- branches/branch-1.2/zoo-services/cgal/Makefile	(revision 111)
+++ branches/branch-1.2/zoo-services/cgal/Makefile	(revision 217)
@@ -1,9 +1,9 @@
-CFLAGS=-I../../zoo-kernel-svn/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
+CFLAGS=-I../../zoo-kernel/ -I./ `xml2-config --cflags` `python-config --cflags` -DLINUX_FREE_ISSUE #-DDEBUG
 CC=gcc
 
-cgi-env/service.zo: service.c
-	g++ ${CFLAGS} -shared -fpic -o cgi-env/service.zo ./service.c -lgdal
+cgi-env/cgal_service.zo: service.c
+	g++ ${CFLAGS} -shared -fpic -o cgi-env/cgal_service.zo ./service.c -lgdal -lCGAL
 
 clean:
-	rm -f *.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling
+	rm -f cgi-env/*.zo *.o *.tab.c *.tab.h *.sr.c* service_loader lex.* *.lreg *.sibling
 	rm -rf service_loader.dSYM
Index: branches/branch-1.2/zoo-services/cgal/cgi-env/Voronoi.zcfg
===================================================================
--- branches/branch-1.2/zoo-services/cgal/cgi-env/Voronoi.zcfg	(revision 217)
+++ branches/branch-1.2/zoo-services/cgal/cgi-env/Voronoi.zcfg	(revision 217)
@@ -0,0 +1,59 @@
+[Voronoi]
+ Title = Voronoi Diagram. 
+ Abstract = Computes the edges of Voronoi diagram of a set of data points.
+ Profile = urn:ogc:wps:1.0.0:voronoi
+ processVersion = 2
+ storeSupported = true
+ statusSupported = true
+ serviceProvider = cgal_service.zo
+ serviceType = C
+ <MetaData>
+   title = Demo
+ </MetaData>
+ <DataInputs>
+  [InputPoints]
+   Title = Data points
+   Abstract = The set of data points.
+   minOccurs = 1
+   maxOccurs = 1
+   <MetaData>
+    title = Mon test  
+   </MetaData>   
+   <ComplexData>
+    <Default>
+     mimeType = text/xml
+     encoding = UTF-8
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Default>
+    <Supported>
+     mimeType = text/xml
+     encoding = base64
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Supported>
+   </ComplexData>
+ </DataInputs>
+ <DataOutputs>
+  [Result]
+   Title = Voronoi Diagram.
+   Abstract = JSON String / GML Entity of the Voronoi Diagram.
+   <MetaData>
+    title = Mon test  
+   </MetaData>   
+   <ComplexOutput>
+    <Default>
+     mimeType = application/json
+     encoding = UTF-8
+    </Default>
+    <Supported>
+     mimeType = text/xml
+     encoding = base64
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+    </Supported>
+    <Supported>
+     mimeType = text/xml
+     encoding = UTF-8
+     schema = http://schemas.opengis.net/gml/3.1.0/base/feature.xsd
+     asReference = true	
+    </Supported>
+   </ComplexOutput>
+ </DataOutputs>  
Index: branches/branch-1.2/zoo-services/cgal/service.c
===================================================================
--- branches/branch-1.2/zoo-services/cgal/service.c	(revision 111)
+++ branches/branch-1.2/zoo-services/cgal/service.c	(revision 217)
@@ -46,73 +46,8 @@
   void printExceptionReportResponse(maps*,map*);
 
-  char *base64(const unsigned char *input, int length){
-    BIO *bmem, *b64;
-    BUF_MEM *bptr;
-
-    b64 = BIO_new(BIO_f_base64());
-    bmem = BIO_new(BIO_s_mem());
-    b64 = BIO_push(b64, bmem);
-    BIO_write(b64, input, length);
-    BIO_flush(b64);
-    BIO_get_mem_ptr(b64, &bptr);
-
-    char *buff = (char *)malloc(bptr->length+1);
-    memcpy(buff, bptr->data, bptr->length);
-    buff[bptr->length] = 0;
-
-    BIO_free_all(b64);
-
-    return buff;
-  }
-
-  OGRGeometryH createGeometryFromGML(maps* conf,char* inputStr){
-    xmlInitParser();
-    xmlDocPtr doc = xmlParseMemory(inputStr,strlen(inputStr));
-    xmlChar *xmlbuff;
-    int buffersize;
-    xmlXPathContextPtr xpathCtx;
-    xmlXPathObjectPtr xpathObj;
-    char * xpathExpr="/*/*/*/*/*[local-name()='Polygon' or local-name()='MultiPolygon']";
-    xpathCtx = xmlXPathNewContext(doc);
-    xpathObj = xmlXPathEvalExpression(BAD_CAST xpathExpr,xpathCtx);
-    if(!xpathObj->nodesetval){
-      map* tmp=createMap("text","Unable to parse Input Polygon");
-      addToMap(tmp,"code","InvalidParameterValue");
-      printExceptionReportResponse(conf,tmp);
-      exit(0);
-    }
-    int size = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0;
-    /**
-     * Create a temporary XML document
-     */
-    xmlDocPtr ndoc = xmlNewDoc(BAD_CAST "1.0");
-    /**
-     * Only one polygon should be provided so we use it as the root node.
-     */
-    for(int k=size-1;k>=0;k--){ 
-      xmlDocSetRootElement(ndoc, xpathObj->nodesetval->nodeTab[k]);
-    }
-    xmlDocDumpFormatMemory(ndoc, &xmlbuff, &buffersize, 1);
-    char *tmp=strdup(strstr((char*)xmlbuff,"?>")+2);
-    xmlXPathFreeObject(xpathObj);
-    xmlXPathFreeContext(xpathCtx); 
-    xmlFree(xmlbuff);
-    xmlFreeDoc(doc);
-    xmlCleanupParser();
-    fprintf(stderr,"\nService internal print\n Loading the geometry from GML string ...");
-    OGRGeometryH res=OGR_G_CreateFromGML(tmp);
-    if(res==NULL){
-      map* tmp=createMap("text","Unable to call OGR_G_CreatFromGML");
-      addToMap(tmp,"code","NoApplicableCode");
-      printExceptionReportResponse(conf,tmp);
-      exit(0);
-    }
-    else
-      return OGR_G_CreateFromGML(tmp);
-  }
-
-  
-  int Delaunay(maps*& conf,maps*& inputs,maps*& outputs){
+  int Voronoi(maps*& conf,maps*& inputs,maps*& outputs){
+#ifdef DEBUG
     fprintf(stderr,"\nService internal print\nStarting\n");
+#endif
     maps* cursor=inputs;
     OGRGeometryH geometry,res;
@@ -121,5 +56,5 @@
     map* tmpm=NULL;
     tmpm=getMapFromMaps(inputs,"InputPoints","value");
-
+    
     xmlInitParser();
     xmlDocPtr doc =
@@ -135,8 +70,10 @@
     xpathObj = xmlXPathEvalExpression(BAD_CAST "/*/*[local-name()='featureMember']/*/*/*[local-name()='Point']/*[local-name()='coordinates']",xpathCtx);
     xmlXPathFreeContext(xpathCtx); 
-    xmlNodeSet* toto=xpathObj->nodesetval;
-
-    if(toto==NULL)
-      fprintf(stderr,"IMPOSSIBLE DE CONTINUER !!!!\n");
+    xmlNodeSet* nSet=xpathObj->nodesetval;
+
+    if(nSet==NULL){
+      setMapInMaps(conf,"lenv","message","Unable to continue !!!");
+      return SERVICE_FAILED;
+    }
     char filepath[2048];
     map* tmpMap=getMapFromMaps(conf,"main","tmpPath");
@@ -145,7 +82,9 @@
     }
     FILE *fo=fopen(filepath,"w");
-    fprintf(stderr,"File Creation (%s) OK\nPrinting %d Points.\n",filepath,toto->nodeNr);
-    for(int k=0;k<toto->nodeNr;k++){
-      xmlNodePtr cur=toto->nodeTab[k];
+#ifdef DEBUG
+    fprintf(stderr,"File Creation (%s) OK\nPrinting %d Points.\n",filepath,nSet->nodeNr);
+#endif
+    for(int k=0;k<nSet->nodeNr;k++){
+      xmlNodePtr cur=nSet->nodeTab[k];
       char *val=
 	(char*)xmlNodeListGetString(doc,cur->xmlChildrenNode,1);
@@ -159,13 +98,13 @@
     }
     fclose(fo);
+#ifdef DEBUG
     fprintf(stderr,"File Close (%s) OK\n",filepath);
+#endif
 
     std::ifstream in(filepath);
-
-    std::istream_iterator<Point1> begin(in);
-    std::istream_iterator<Point1> end;
-
-    DelaunayTriangulation dt1;
-    dt1.insert(begin, end);
+    std::istream_iterator<Point> begin(in);
+    std::istream_iterator<Point> end;
+    Triangulation T;
+    T.insert(begin, end);
 
     OGRRegisterAll();
@@ -180,9 +119,8 @@
 
     tmpMap=getMapFromMaps(outputs,"Result","mimeType");
-    char *oDriver=(char*)malloc(7*sizeof(char));
+    const char *oDriver;
     oDriver="GeoJSON";
     if(tmpMap!=NULL){
       if(strcmp(tmpMap->value,"text/xml")==0){
-	fprintf(stderr,"USEING GML \n");
 	oDriver="GML";
       }
@@ -212,7 +150,8 @@
 	    sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
 	  }
-	
-	fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
-	exit( 1 );
+
+	setMapInMaps(conf,"lenv","message",emessage);
+	return SERVICE_FAILED;
+
       }
 
@@ -221,299 +160,6 @@
       sprintf( emessage,  "%s driver does not support data source creation.\n",
 	       "json" );
-      fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
-      exit( 1 );
-    }
-
-    /* -------------------------------------------------------------------- */
-    /*      Create the output data source.                                  */
-    /* -------------------------------------------------------------------- */
-    map* tpath=getMapFromMaps(conf,"main","tmpPath");
-    char *pszDestDataSource=(char*)malloc(strlen(tpath->value)+20);
-    char **papszDSCO=NULL;
-    sprintf(pszDestDataSource,"%s/result_%d.json",tpath->value,getpid());
-    fprintf(stderr,"\n *%s* \n",pszDestDataSource);
-    poODS = poDriver->CreateDataSource( pszDestDataSource, papszDSCO );
-    if( poODS == NULL ){
-      char emessage[1024];      
-      sprintf( emessage,  "%s driver failed to create %s\n", 
-	       "json", pszDestDataSource );
-      fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
-      exit( 1 );
-    }
-
-    /* -------------------------------------------------------------------- */
-    /*      Create the layer.                                               */
-    /* -------------------------------------------------------------------- */
-    if( !poODS->TestCapability( ODsCCreateLayer ) )
-      {
-	char emessage[1024];
-	sprintf( emessage, 
-		 "Layer %s not found, and CreateLayer not supported by driver.", 
-		 "Result" );
-	fprintf(stderr,"{\"type\": \"error\",\"message\": \"%s\"}",emessage);
-	return FALSE;
-      }
-    
-    CPLErrorReset();
-    
-    OGRLayer *poDstLayer = poODS->CreateLayer( "Result", NULL,wkbLineString,NULL);
-    if( poDstLayer == NULL ){
-      fprintf( stderr,"Layer creation failed.\n" );
-      exit( 1 );
-    }
-
-    Vertex_circulator vc = dt1.incident_vertices(dt1.infinite_vertex()),
-      done(vc);
-    if (vc != 0) {
-      do {std::cout << vc->point() << std::endl;}while(++vc != done);
-    }
-
-    DelaunayTriangulation::Edge_iterator eit=dt1.edges_begin();
-    int i=0;
-    for ( ; eit !=dt1.edges_end(); ++eit) {
-      fprintf(stderr,"Edge %d\n",i);
-      i++;
-      /*CGAL::Object o = dt1.dual(eit);
-      if (const K::Segment_2 *tmp=CGAL::object_cast<K::Segment_2>(&o)) {
-	const K::Point_2 p1=tmp->source();
-	const K::Point_2 p2=tmp->target();
-	//#ifdef DEBUG
-	fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y());
-	//#endif
-	}*/
-      /*if (const K::Segment_3 *tmp=CGAL::object_cast<K::Segment_3>(eit)) {
-	const K::Point_3 p1=tmp->source();
-	const K::Point_3 p2=tmp->target();
-#ifdef DEBUG
-	fprintf(stderr,"P1 %d %d | P2 %d %d\n",p1.x(),p1.y(),p2.x(),p2.y());
-#endif
-	OGRFeatureH hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
-	OGRGeometryH currLine=OGR_G_CreateGeometry(wkbLineString);
-	OGR_G_AddPoint_2D(currLine,p1.x(),p1.y());
-	OGR_G_AddPoint_2D(currLine,p2.x(),p2.y());
-	OGR_F_SetGeometry( hFeature, currLine ); 
-	OGR_G_DestroyGeometry(currLine);
-	if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
-	  fprintf( stderr,"Failed to create feature in file.\n" );
-	  exit( 1 );
-	  }
-	  OGR_F_Destroy( hFeature );*/
-    }
-  
-    int idg=0;
-    for (DelaunayTriangulation::Face_iterator fit = dt1.faces_begin(); fit!=
-	   dt1.faces_end(); ++fit) {
-      int idx = 0;
-      int i0, i1, i2;
-
-      OGRFeatureH hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
-      OGRGeometryH currLine=OGR_G_CreateGeometry(wkbLineString);
-      
-      for(i0=0;i0<3;i0++){
-	if(!dt1.is_infinite((*fit).vertex(i0)))
-	  OGR_G_AddPoint_2D(currLine,(*fit).vertex(i0)->point().x(),
-			    (*fit).vertex(i0)->point().y());
-	if(i0==2 && !dt1.is_infinite((*fit).vertex(0)))
-	  OGR_G_AddPoint_2D(currLine,(*fit).vertex(0)->point().x(),
-			    (*fit).vertex(0)->point().y());
-      }
-      OGR_F_SetGeometry( hFeature, currLine );
-      OGR_G_DestroyGeometry(currLine);
-      if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
-	fprintf( stderr,"Failed to create feature in file.\n" );
-	exit( 1 );
-      }
-      OGR_F_Destroy( hFeature );
-
-      /*OGRFeatureH hFeature=NULL;
-      OGRGeometryH currLine=NULL;
-      if(idg==0) {
-	hFeature = OGR_F_Create( OGR_L_GetLayerDefn( poDstLayer ) );
-	currLine=OGR_G_CreateGeometry(wkbLineString);      
-	}*/
-
-      for (DelaunayTriangulation::Vertex_iterator vit = dt1.vertices_begin(); vit!=
-	     dt1.vertices_end(); ++vit) {
-	idx++;
-	/*if(idg==0)
-	  OGR_G_AddPoint_2D(currLine,(*vit).point().x(),
-	  (*vit).point().y());*/
-
-
-	if ((*vit).point() == (*fit).vertex(0)->point()){
-	  i0 = idx; 
-	  /*OGR_G_AddPoint_2D(currLine,(*fit).vertex(i0)->point().x(),
-	    (*fit).vertex(i0)->point().y());**/
-	}
-	if ((*vit).point() == (*fit).vertex(1)->point()){  
-	  i1 = idx; 
-	  /*OGR_G_AddPoint_2D(currLine,(*fit).vertex(i1)->point().x(),
-	    (*fit).vertex(i1)->point().y());*/
-	}
-	if ((*vit).point() == (*fit).vertex(2)->point()){  
-	  i2 = idx; 
-	  /*OGR_G_AddPoint_2D(currLine,(*fit).vertex(i2)->point().x(),
-	    (*fit).vertex(i2)->point().y());*/
-	}
-      }
-      /*if(idg==0){
-	OGR_F_SetGeometry( hFeature, currLine );
-	OGR_G_DestroyGeometry(currLine);
-	if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
-	  fprintf( stderr,"Failed to create feature in file.\n" );
-	  exit( 1 );
-	}
-	OGR_F_Destroy( hFeature );
-	idg++;
-	}*/
-
-      std::cerr << "f " << i0 << " " << dt1.triangle(fit) << std::endl;
-      
-    } 
-    OGR_DS_Destroy( poODS );
-    OGRCleanupAll();
-
- 
-    char tmp1[1024];
-    outputs=(maps*)malloc(sizeof(maps*));
-    outputs->name="Result";
-
-    FILE * fichier=fopen(pszDestDataSource,"r"); 
-    struct stat file_status;
-    stat(pszDestDataSource, &file_status);
-    fprintf(stderr,"%s (%d)",pszDestDataSource,file_status.st_size);
-    char *res1=(char *)malloc(file_status.st_size*sizeof(char));
-    if(fichier==NULL)
-      fprintf(stderr,"Failed to open file %s for reading purpose.\n",pszDestDataSource);
-    fread(res1,1,(file_status.st_size)*sizeof(char),fichier);
-    res1[strlen(res1)]=0;
-    fclose(fichier);
-    //unlink(pszDestDataSource);
-    //fprintf(stderr,"Read (%s).\n",res1);
-    
-    outputs->content=createMap("value",res1);
-    
-    if(strcmp(oDriver,"GML")==0)
-      addMapToMap(&outputs->content,createMap("mimeType","text/xml"));
-    else
-      addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
-
-    addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
-    outputs->next=NULL;
-    fprintf(stderr,"\nService internal print\n===\n");
-    xmlCleanupParser();
-
-    return SERVICE_SUCCEEDED;
-  }
-  
-
-  int Voronoi(maps*& conf,maps*& inputs,maps*& outputs){
-    fprintf(stderr,"\nService internal print\nStarting\n");
-    maps* cursor=inputs;
-    OGRGeometryH geometry,res;
-    int bufferDistance;
-    xmlInitParser();
-    map* tmpm=NULL;
-    tmpm=getMapFromMaps(inputs,"InputPoints","value");
-    
-    xmlInitParser();
-    xmlDocPtr doc =
-      xmlParseMemory(tmpm->value,strlen(tmpm->value));
-    xmlNodePtr cur = xmlDocGetRootElement(doc);
-    /**
-     * Parse every Input in DataInputs node.
-     */
-    maps* tempMaps=NULL;
-    xmlXPathContextPtr xpathCtx;
-    xmlXPathObjectPtr xpathObj;
-    xpathCtx = xmlXPathNewContext(doc);
-    xpathObj = xmlXPathEvalExpression(BAD_CAST "/*/*[local-name()='featureMember']/*/*/*[local-name()='Point']/*[local-name()='coordinates']",xpathCtx);
-    xmlXPathFreeContext(xpathCtx); 
-    xmlNodeSet* toto=xpathObj->nodesetval;
-
-    if(toto==NULL)
-      fprintf(stderr,"IMPOSSIBLE DE CONTINUER !!!!\n");
-    char filepath[2048];
-    map* tmpMap=getMapFromMaps(conf,"main","tmpPath");
-    if(tmpMap!=NULL){
-      sprintf(filepath,"%s/varonoi_%d.tmp",tmpMap->value,getpid());
-    }
-    FILE *fo=fopen(filepath,"w");
-    fprintf(stderr,"File Creation (%s) OK\nPrinting %d Points.\n",filepath,toto->nodeNr);
-    for(int k=0;k<toto->nodeNr;k++){
-      xmlNodePtr cur=toto->nodeTab[k];
-      char *val=
-	(char*)xmlNodeListGetString(doc,cur->xmlChildrenNode,1);
-      char *tmp=strstr(val,",");
-      char tmp1[1024];
-      strncpy(tmp1,val,strlen(val)-strlen(tmp));
-      tmp1[strlen(val)-strlen(tmp)]=0;
-      char buff[1024];
-      sprintf(buff,"%s %s\n",tmp1,tmp+1);
-      fwrite(buff,1,strlen(buff)*sizeof(char),fo);
-    }
-    fclose(fo);
-    fprintf(stderr,"File Close (%s) OK\n",filepath);
-
-    std::ifstream in(filepath);
-    std::istream_iterator<Point> begin(in);
-    std::istream_iterator<Point> end;
-    Triangulation T;
-    T.insert(begin, end);
-
-    OGRRegisterAll();
-    /* -------------------------------------------------------------------- */
-    /*      Try opening the output datasource as an existing, writable      */
-    /* -------------------------------------------------------------------- */
-    OGRDataSource       *poODS;
-    
-    OGRSFDriverRegistrar *poR = OGRSFDriverRegistrar::GetRegistrar();
-    OGRSFDriver          *poDriver = NULL;
-    int                  iDriver;
-
-    tmpMap=getMapFromMaps(outputs,"Result","mimeType");
-    char *oDriver=(char*)malloc(7*sizeof(char));
-    oDriver="GeoJSON";
-    if(tmpMap!=NULL){
-      if(strcmp(tmpMap->value,"text/xml")==0){
-	fprintf(stderr,"USEING GML \n");
-	oDriver="GML";
-      }
-    }
-    
-    for( iDriver = 0;
-	 iDriver < poR->GetDriverCount() && poDriver == NULL;
-	 iDriver++ )
-      {
-#ifdef DEBUG
-	fprintf(stderr,"D:%s\n",poR->GetDriver(iDriver)->GetName());
-#endif
-	if( EQUAL(poR->GetDriver(iDriver)->GetName(),oDriver) )
-	  {
-	    poDriver = poR->GetDriver(iDriver);
-	  }
-      }
-
-    if( poDriver == NULL )
-      {
-	char emessage[8192];
-	sprintf( emessage, "Unable to find driver `%s'.\n", oDriver );
-	sprintf( emessage,  "%sThe following drivers are available:\n",emessage );
-        
-	for( iDriver = 0; iDriver < poR->GetDriverCount(); iDriver++ )
-	  {
-	    sprintf( emessage,  "%s  -> `%s'\n", emessage, poR->GetDriver(iDriver)->GetName() );
-	  }
-	
-	fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
-	exit( 1 );
-      }
-
-    if( !poDriver->TestCapability( ODrCCreateDataSource ) ){
-      char emessage[1024];
-      sprintf( emessage,  "%s driver does not support data source creation.\n",
-	       "json" );
-      fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
-      exit( 1 );
+      setMapInMaps(conf,"lenv","message",emessage);
+      return SERVICE_FAILED;
     }
 
@@ -530,6 +176,6 @@
       sprintf( emessage,  "%s driver failed to create %s\n", 
 	       "json", pszDestDataSource );
-      fprintf(stderr,"{\"type\": \"error\", \"%s\"}",emessage);   
-      exit( 1 );
+      setMapInMaps(conf,"lenv","message",emessage);
+      return SERVICE_FAILED;
     }
 
@@ -543,6 +189,6 @@
 		 "Layer %s not found, and CreateLayer not supported by driver.", 
 		 "Result" );
-	fprintf(stderr,"{\"type\": \"error\",\"message\": \"%s\"}",emessage);
-	return FALSE;
+	setMapInMaps(conf,"lenv","message",emessage);
+	return SERVICE_FAILED;
       }
     
@@ -551,6 +197,6 @@
     OGRLayer *poDstLayer = poODS->CreateLayer( "Result", NULL,wkbLineString,NULL);
     if( poDstLayer == NULL ){
-      fprintf( stderr,"Layer creation failed.\n" );
-      exit( 1 );
+      setMapInMaps(conf,"lenv","message","Layer creation failed.\n");
+      return SERVICE_FAILED;
     }
 
@@ -574,6 +220,6 @@
 	OGR_G_DestroyGeometry(currLine);
 	if( OGR_L_CreateFeature( poDstLayer, hFeature ) != OGRERR_NONE ){
-	  fprintf( stderr,"Failed to create feature in file.\n" );
-	  exit( 1 );
+	  setMapInMaps(conf,"lenv","message","Failed to create feature in file.\n");
+	  return SERVICE_FAILED;
 	}
 	OGR_F_Destroy( hFeature );
@@ -592,30 +238,32 @@
     
     char tmp1[1024];
-    outputs=(maps*)malloc(sizeof(maps*));
-    outputs->name="Result";
 
     FILE * fichier=fopen(pszDestDataSource,"r"); 
     struct stat file_status;
     stat(pszDestDataSource, &file_status);
-    //fprintf(stderr,"%s (%d)",pszDestDataSource,file_status.st_size);
     char *res1=(char *)malloc(file_status.st_size*sizeof(char));
-    if(fichier==NULL)
-      fprintf(stderr,"Failed to open file %s for reading purpose.\n",pszDestDataSource);
+    if(fichier==NULL){
+      char tmp[1024];
+      sprintf(tmp,"Failed to open file %s for reading purpose.\n",
+	      pszDestDataSource);
+      setMapInMaps(conf,"lenv","message",tmp);
+      return SERVICE_FAILED;
+    }
     fread(res1,1,(file_status.st_size)*sizeof(char),fichier);
     res1[strlen(res1)]=0;
     fclose(fichier);
     unlink(pszDestDataSource);
-    //fprintf(stderr,"Read (%s).\n",res1);
-    
-    outputs->content=createMap("value",res1);
+    
+    setMapInMaps(outputs,"Result","value",res1);
     
     if(strcmp(oDriver,"GML")==0)
-      addMapToMap(&outputs->content,createMap("mimeType","text/xml"));
+      setMapInMaps(outputs,"Result","mimeType","text/xml");
     else
-      addMapToMap(&outputs->content,createMap("mimeType","text/plain"));
-
-    addMapToMap(&outputs->content,createMap("encoding","UTF-8"));
-    outputs->next=NULL;
+      setMapInMaps(outputs,"Result","mimeType","text/plain");
+
+    setMapInMaps(outputs,"Result","encoding","UTF-8");
+#ifdef DEBUG
     fprintf(stderr,"\nService internal print\n===\n");
+#endif
     xmlCleanupParser();
     return SERVICE_SUCCEEDED;
Index: branches/branch-1.2/zoo-services/ogr/base-vect-ops/makefile.vc
===================================================================
--- branches/branch-1.2/zoo-services/ogr/base-vect-ops/makefile.vc	(revision 111)
+++ branches/branch-1.2/zoo-services/ogr/base-vect-ops/makefile.vc	(revision 217)
@@ -1,11 +1,12 @@
-GEODIR=c:/OSGeo4W/
-TOOLS=c:/Users/djay/GeoLabs/tools/
-CFLAGS=-I$(GEODIR)/include -I$(TOOLS)/include -I../../../zoo-kernel/ -I./ -DLINUX_FREE_ISSUE -DDEBUG
+ZOODIR=../../../zoo-kernel
+THIRDSDIR=../../../thirds
+!INCLUDE $(ZOODIR)/nmake.opt
+CFLAGS=-I$(GEODIR)/include -I$(TPATH)/include -I$(ZOODIR) -I./ -DLINUX_FREE_ISSUE -DWIN32 #-DDEBUG
 CPP=cl /TP 
 
-cgi-env/service.zo: service.c
+cgi-env/ogr_service.zo: service.c
 	$(CPP) $(CFLAGS) /c service.c
-	link /dll /out:cgi-env/ogr_service.zso ../../../zoo-kernel/service_internal.obj ./service.obj -L$(TOOLS)/lib/libssl32.dll.a $(GEODIR)/lib/libxml2.lib $(GEODIR)/lib/gdal_i.lib $(TOOLS)/lib/libeay32.dll.a $(TOOLS)/lib/libcrypto.a $(TOOLS)/lib/libssl32.dll.a 
+	link /dll /out:cgi-env/ogr_service.zo ../../../zoo-kernel/service_internal.obj ./service.obj -L$(TOOLS)/lib/libssl32.dll.a $(GEODIR)/lib/libxml2.lib $(GEODIR)/lib/gdal_i.lib $(GEODIR)/lib/geos_c_i.lib $(TPATH)/lib/libeay32.dll.a $(TPATH)/lib/libcrypto.a $(TPATH)/lib/libssl32.dll.a $(LIBINTL_CPATH)/lib/libintl.lib 
 
 clean:
-	rm -f cgi-env/ogr_service.zso
+	erase cgi-env\ogr_service.*
Index: branches/branch-1.2/zoo-services/ogr/base-vect-ops/service.c
===================================================================
--- branches/branch-1.2/zoo-services/ogr/base-vect-ops/service.c	(revision 111)
+++ branches/branch-1.2/zoo-services/ogr/base-vect-ops/service.c	(revision 217)
@@ -43,5 +43,5 @@
 
   void printExceptionReportResponse(maps*,map*);
-  char *base64(const unsigned char *input, int length);
+  char *base64(const char *input, int length);
 
   OGRGeometryH createGeometryFromGML(maps* conf,char* inputStr){
@@ -56,8 +56,7 @@
     xpathObj = xmlXPathEvalExpression(BAD_CAST xpathExpr,xpathCtx);
     if(!xpathObj->nodesetval){
-      map* tmp=createMap("text","Unable to parse Input Polygon");
-      addToMap(tmp,"code","InvalidParameterValue");
-      printExceptionReportResponse(conf,tmp);
-      exit(0);
+      setMapInMaps(conf,"lenv","message",_ss("Unable to parse Input Polygon"));
+      setMapInMaps(conf,"lenv","code","InvalidParameterValue");
+      return NULL;
     }
     int size = (xpathObj->nodesetval) ? xpathObj->nodesetval->nodeNr : 0;
@@ -80,5 +79,7 @@
     xmlFreeDoc(doc);
     xmlFreeDoc(ndoc);
+#ifndef WIN32
     xmlCleanupParser();
+#endif
 #ifdef DEBUG
     fprintf(stderr,"\nService internal print\n Loading the geometry from GML string ...");
@@ -94,4 +95,7 @@
   }
 
+#ifdef WIN32
+  __declspec(dllexport)
+#endif
   int Simplify(maps*& conf,maps*& inputs,maps*& outputs){
     maps* cursor=inputs;
@@ -104,5 +108,7 @@
     else
       tolerance=atof(tmp0->value);
+#ifdef DEBUG
     fprintf(stderr,"Tolerance for Simplify %f",tolerance);
+#endif
     map* tmp=getMapFromMaps(inputs,"InputPolygon","value");
     if(!tmp){
@@ -126,8 +132,10 @@
       return SERVICE_FAILED;
     }
+#ifdef DEBUG
     fprintf(stderr,"Create GEOSGeometry object");
+#endif
     GEOSGeometry* ggeometry=((OGRGeometry *) geometry)->exportToGEOS();
     GEOSGeometry* gres=GEOSTopologyPreserveSimplify(ggeometry,tolerance);
-    res=OGRGeometryFactory::createFromGEOS(gres);
+    res=(OGRGeometryH)OGRGeometryFactory::createFromGEOS(gres);
     tmp1=getMapFromMaps(outputs,"Result","mimeType");
     if(tmp1!=NULL){
@@ -136,22 +144,28 @@
 	char *tmpS=OGR_G_ExportToJson(res);
 	setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
 	setMapInMaps(outputs,"Result","mimeType","text/plain");
 	setMapInMaps(outputs,"Result","encoding","UTF-8");
 	free(tmpS);
+#endif
       }
       else{
 	char *tmpS=OGR_G_ExportToGML(res);
 	setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
 	setMapInMaps(outputs,"Result","mimeType","text/xml");
 	setMapInMaps(outputs,"Result","encoding","UTF-8");
 	setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
 	free(tmpS);
+#endif
       }
     }else{
-      char *tmpS=OGR_G_ExportToJson(tmp->value);
+      char *tmpS=OGR_G_ExportToJson(res);
       setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
       setMapInMaps(outputs,"Result","mimeType","text/plain");
       setMapInMaps(outputs,"Result","encoding","UTF-8");
       free(tmpS);
+#endif
     }
     outputs->next=NULL;
@@ -178,11 +192,15 @@
       return SERVICE_FAILED;
     }
+#ifdef DEBUG
     fprintf(stderr,"Service internal print \n");
     dumpMaps(inputs);
     fprintf(stderr,"/Service internal print \n");
+#endif
     map* tmp1=getMapFromMaps(inputs,"InputPolygon","mimeType");
+#ifdef DEBUG
     fprintf(stderr,"Service internal print \n");
     dumpMap(tmp1);
     fprintf(stderr,"/Service internal print \n");
+#endif
     if(tmp1!=NULL){
       if(strncmp(tmp1->value,"text/js",7)==0 ||
@@ -199,11 +217,15 @@
     }
     res=(*myFunc)(geometry);
+#ifdef DEBUG
     fprintf(stderr,"Service internal print \n");
     dumpMaps(outputs);
     fprintf(stderr,"/Service internal print \n");
+#endif
     map *tmp_2=getMapFromMaps(outputs,"Result","mimeType");
+#ifdef DEBUG
     fprintf(stderr,"Service internal print \n");
     dumpMap(tmp_2);
     fprintf(stderr,"/Service internal print \n");
+#endif
     if(tmp_2!=NULL){
       if(strncmp(tmp_2->value,"text/js",7)==0 ||
@@ -211,24 +233,30 @@
 	char *tmpS=OGR_G_ExportToJson(res);
 	setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
 	setMapInMaps(outputs,"Result","mimeType","text/plain");
 	setMapInMaps(outputs,"Result","encoding","UTF-8");
 	free(tmpS);
+#endif
       }
       else{
 	char *tmpS=OGR_G_ExportToGML(res);
 	setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
 	setMapInMaps(outputs,"Result","mimeType","text/xml");
 	setMapInMaps(outputs,"Result","encoding","UTF-8");
 	setMapInMaps(outputs,"Result","schema",schema);
 	free(tmpS);
+#endif
       }
     }else{
       char *tmpS=OGR_G_ExportToJson(res);
       setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
       setMapInMaps(outputs,"Result","mimeType","text/plain");
       setMapInMaps(outputs,"Result","encoding","UTF-8");
       free(tmpS);
-    }
-    outputs->next=NULL;
+#endif
+    }
+    //outputs->next=NULL;
 #ifdef DEBUG
     dumpMaps(outputs);
@@ -239,7 +267,9 @@
     //CPLFree(res);
     //CPLFree(geometry);
+#ifdef DEBUG
     fprintf(stderr,"Service internal print \n");
     dumpMaps(outputs);
     fprintf(stderr,"/Service internal print \n");
+#endif
     return SERVICE_SUCCEEDED;
   }
@@ -276,21 +306,29 @@
      bufferDistance=atof(tmp->value);
    res=OGR_G_Buffer(geometry,bufferDistance,30);
+   dumpMap(tmp);
    tmp1=getMapFromMaps(outputs,"Result","mimeType");
+   dumpMap(tmp);
    if(strncmp(tmp1->value,"application/json",16)==0){
      char *tmpS=OGR_G_ExportToJson(res);
      setMapInMaps(outputs,"Result","value",tmpS);
+     dumpMap(tmp);
+#ifndef WIN32
      setMapInMaps(outputs,"Result","mimeType","text/plain");
      setMapInMaps(outputs,"Result","encoding","UTF-8");
      free(tmpS);
+#endif
    }
    else{
      char *tmpS=OGR_G_ExportToGML(res);
      setMapInMaps(outputs,"Result","value",tmpS);
+     dumpMap(tmp);
+#ifndef WIN32
      free(tmpS);
      setMapInMaps(outputs,"Result","mimeType","text/xml");
      setMapInMaps(outputs,"Result","encoding","UTF-8");
      setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
+#endif
    }
-   outputs->next=NULL;
+   //outputs->next=NULL;
    OGR_G_DestroyGeometry(geometry);
    OGR_G_DestroyGeometry(res);
@@ -335,8 +373,8 @@
     fprintf(stderr,"\nService internal print1\n");
     fflush(stderr);
-#endif
     fprintf(stderr,"\nService internal print1\n");
     dumpMaps(inputs);
     fprintf(stderr,"\nService internal print1\n");
+#endif
 
     maps* cursor=inputs;
@@ -357,24 +395,32 @@
     if(geometry1==NULL){
       setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry for InputEntity1."));
+#ifdef DEBUG
       fprintf(stderr,"SERVICE FAILED !\n");
-      return SERVICE_FAILED;
-    }
+#endif
+      return SERVICE_FAILED;
+    }
+#ifdef DEBUG
     fprintf(stderr,"\nService internal print1 InputEntity1\n");
+#endif
     {
       map* tmp=getMapFromMaps(inputs,"InputEntity2","value");
       map* tmp1=getMapFromMaps(inputs,"InputEntity2","mimeType");
-      //#ifdef DEBUG
+#ifdef DEBUG
       fprintf(stderr,"MY MAP \n[%s] - %i\n",tmp1->value,strncmp(tmp1->value,"application/json",16));
       //dumpMap(tmp);
       fprintf(stderr,"MY MAP\n");
-      ///#endif
       fprintf(stderr,"\nService internal print1 InputEntity2\n");
+#endif
       if(tmp1!=NULL){
         if(strncmp(tmp1->value,"application/json",16)==0){
+#ifdef DEBUG
 	  fprintf(stderr,"\nService internal print1 InputEntity2 as JSON\n");
+#endif
       	  geometry2=OGR_G_CreateGeometryFromJson(tmp->value);
 	}
 	else{
+#ifdef DEBUG
 	  fprintf(stderr,"\nService internal print1 InputEntity2 as GML\n");
+#endif
 	  geometry2=createGeometryFromGML(conf,tmp->value);
 	}
@@ -382,16 +428,25 @@
       else
       	geometry2=createGeometryFromGML(conf,tmp->value);
+#ifdef DEBUG
       fprintf(stderr,"\nService internal print1 InputEntity2 PreFinal\n");
-    }
+#endif
+    }
+#ifdef DEBUG
     fprintf(stderr,"\nService internal print1 InputEntity2 Final\n");
+#endif
     if(geometry2==NULL){
       setMapInMaps(conf,"lenv","message",_ss("Unable to parse input geometry for InputEntity2."));
+#ifdef DEBUG
       fprintf(stderr,"SERVICE FAILED !\n");
-      return SERVICE_FAILED;
-    }
+#endif
+      return SERVICE_FAILED;
+    }
+#ifdef DEBUG
     fprintf(stderr,"\nService internal print1\n");
+#endif
     res=(*myFunc)(geometry1,geometry2);
+#ifdef DEBUG
     fprintf(stderr,"\nService internal print1\n");
-    
+#endif    
     /* nuova parte */
     map* tmp2=getMapFromMaps(outputs,"Result","mimeType");
@@ -399,15 +454,19 @@
       char *tmpS=OGR_G_ExportToJson(res);
       setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
       setMapInMaps(outputs,"Result","mimeType","text/plain");
       setMapInMaps(outputs,"Result","encoding","UTF-8");
       free(tmpS);
+#endif
     }
     else{
       char *tmpS=OGR_G_ExportToGML(res);
       setMapInMaps(outputs,"Result","value",tmpS);
+#ifndef WIN32
       setMapInMaps(outputs,"Result","mimeType","text/xml");
       setMapInMaps(outputs,"Result","encoding","UTF-8");
       setMapInMaps(outputs,"Result","schema","http://fooa/gml/3.1.0/polygon.xsd");
       free(tmpS);
+#endif
     }
     
Index: branches/branch-1.2/zoo-services/utils/status/makefile.vc
===================================================================
--- branches/branch-1.2/zoo-services/utils/status/makefile.vc	(revision 217)
+++ branches/branch-1.2/zoo-services/utils/status/makefile.vc	(revision 217)
@@ -0,0 +1,12 @@
+ZOODIR=../../../zoo-kernel
+THIRDSDIR=../../../thirds
+!INCLUDE $(ZOODIR)/nmake.opt
+CFLAGS=-DWIN32 -I$(THIRDSDIR)/dirent-win32 -I$(GEODIR)/include -I$(TPATH)/include -I$(ZOODIR)/ -I./ -DLINUX_FREE_ISSUE -DDEBUG
+CPP=cl /TP 
+
+cgi-env/wps_status.zo: service.c
+	$(CPP) $(CFLAGS) /c service.c
+	link /dll /out:cgi-env/wps_status.zo $(ZOODIR)/service_internal.obj $(ZOODIR)/dirent.obj ./service.obj -L$(TPATH)/lib/libssl32.dll.a $(TPATH)/lib/libxslt.lib $(TPATH)/lib/libxml2.lib $(TPATH)/lib/libeay32.dll.a $(TPATH)/lib/libcrypto.a $(TOOLS)/lib/libssl32.dll.a $(LIBINTL_CPATH)/lib/libintl.lib
+
+clean:
+	del /f cgi-env\wps*
Index: branches/branch-1.2/zoo-services/utils/status/service.c
===================================================================
--- branches/branch-1.2/zoo-services/utils/status/service.c	(revision 111)
+++ branches/branch-1.2/zoo-services/utils/status/service.c	(revision 217)
@@ -24,4 +24,7 @@
 
 #include "service.h"
+#ifdef WIN32
+#include <windows.h>
+#endif
 
 extern "C" {
@@ -135,5 +138,9 @@
       setMapInMaps(conf,"lenv","status",tmp);
       updateStatus(conf);
+#ifndef WIN32
       sleep(1);
+#else
+      Sleep(1000);
+#endif
       i+=5;
     }
