diff --git a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java
index 2358038648bc2c9b2b2b85b3c6a30de3705f620c..0c45ded4fa6843ebee8ec332e6673b84a3dac83c 100644
--- a/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java
+++ b/src/fr/inrialpes/exmo/align/service/AServProtocolManager.java
@@ -284,13 +284,24 @@ public class AServProtocolManager {
 	// find and access o, o'
 	URI uri1 = null;
 	URI uri2 = null;
+	Set<Alignment> alignments = new HashSet<Alignment>();
 	try {
-	    uri1 = new URI((String)params.getParameter("onto1"));
-	    uri2 = new URI((String)params.getParameter("onto2"));
+	    if( params.getParameter("onto1") == null ) {
+		uri2 = new URI((String)params.getParameter("onto2"));
+		alignments = alignmentCache.getAlignments( uri2 );
+	    }
+	    else if( params.getParameter("onto2") == null ) {
+		uri1 = new URI((String)params.getParameter("onto1"));
+		alignments = alignmentCache.getAlignments( uri1 );
+	    }
+	    else {
+		uri1 = new URI((String)params.getParameter("onto1"));
+	    	uri2 = new URI((String)params.getParameter("onto2"));
+		alignments = alignmentCache.getAlignments( uri1, uri2 );
+	    }
 	} catch (Exception e) {
 	    return new ErrorMsg(newId(),mess,myId,mess.getSender(),"MalformedURI problem",(Parameters)null);
 	}; //done below
-	Set alignments = alignmentCache.getAlignments( uri1, uri2 );
 	String msg = "";
 	for( Iterator it = alignments.iterator(); it.hasNext(); ){
 	    msg += ((Alignment)it.next()).getExtension( Annotations.ALIGNNS, Annotations.ID );
@@ -874,11 +885,13 @@ public class AServProtocolManager {
 		java.lang.reflect.Constructor alignmentConstructor = alignmentClass.getConstructor(cparams);
 		AlignmentProcess aresult = (AlignmentProcess)alignmentConstructor.newInstance(mparams);
 		try {
+			 
 		    aresult.init( uri1, uri2 );
+			 
 		    long time = System.currentTimeMillis();
 		    
 		    aresult.align( init, params ); // add opts
-			 
+			  
 		    long newTime = System.currentTimeMillis();
 			 
 		    aresult.setExtension( Annotations.ALIGNNS, Annotations.TIME, Long.toString(newTime - time) );
diff --git a/src/fr/inrialpes/exmo/align/service/AlignmentId.java b/src/fr/inrialpes/exmo/align/service/AlignmentId.java
index 3ec116ccdf6ade6b1d309174b58a0803e9bdf3cc..2b18a03224b8bcef79ae6f7bda72a0a99224c15e 100644
--- a/src/fr/inrialpes/exmo/align/service/AlignmentId.java
+++ b/src/fr/inrialpes/exmo/align/service/AlignmentId.java
@@ -41,7 +41,9 @@ public class AlignmentId extends Success {
     public String HTMLString(){
 	return "Alignment ID: <a href=\"../html/retrieve?method=fr.inrialpes.exmo.align.impl.renderer.HTMLRendererVisitor&id="+getContent()+"\">"+getPretty(getContent())+"</a>&nbsp;";
     }
-
+    public String HTMLRESTString(){
+	return "Alignment ID: <a href=\"../rest/retrieve?method=fr.inrialpes.exmo.align.impl.renderer.HTMLRendererVisitor&id="+getContent()+"\">"+getPretty(getContent())+"</a>&nbsp;";
+    }
     public String RESTString(){
 	return "<alid>"+content+"</alid>";	
     }
diff --git a/src/fr/inrialpes/exmo/align/service/AlignmentIds.java b/src/fr/inrialpes/exmo/align/service/AlignmentIds.java
index a9fdf72a6fbb6a2e6151a266b5ae08acee655dc3..e0485e0d9d850c0fbd4714548d98ad82d74cd21e 100644
--- a/src/fr/inrialpes/exmo/align/service/AlignmentIds.java
+++ b/src/fr/inrialpes/exmo/align/service/AlignmentIds.java
@@ -39,6 +39,20 @@ public class AlignmentIds extends Success {
 	}
 	return result += "</ul>";
     }
+
+    public String HTMLRESTString(){
+	String result = "Alignment Ids: <ul>";
+	String id[] = content.split(" ");
+	for ( int i = id.length-1; i >= 0; i-- ){
+	    result += "<li><a href=\"../rest/retrieve?method=fr.inrialpes.exmo.align.impl.renderer.HTMLRendererVisitor&id="+id[i]+"\">"+id[i]+"</a>";
+	    result += "<table><tr>";
+result += "<td><form action=\"getID\"><input type=\"hidden\" name=\"id\" value=\""+id[i]+"\"/><input type=\"submit\" name=\"action\" value=\"GetID\"  disabled=\"disabled\"/></form></td>";
+result += "<td><form action=\"metadata\"><input type=\"hidden\" name=\"id\" value=\""+id[i]+"\"/><input type=\"submit\" name=\"action\" value=\"Metadata\"/></form></td>";
+	    result += "</li>";
+	}
+	return result += "</ul>";
+    }
+
     public String RESTString(){
 	String msg = "<alignmentList>";
 	String id[] = content.split(" ");
diff --git a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java
index e9b0f1e6e9aa438c0901943e7171c573265f8e9e..9481c9ff3b841c3b9fa8750eb3d9a0c69ef9796f 100644
--- a/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java
+++ b/src/fr/inrialpes/exmo/align/service/HTMLAServProfile.java
@@ -342,7 +342,6 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
 	}
 
 	if ( oper.equals( "aserv" ) ){
-	    params.setParameter( "restful", "false" );
 	    if ( wsmanager != null ) {
 		return new Response( HTTP_OK, MIME_HTML, wsmanager.protocolAnswer( uri, uri.substring(start), header, params ) );
 	    } else {
@@ -355,16 +354,21 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
 	    return htmlAnswer( uri, uri.substring(start), header, params );
 	} else if ( oper.equals( "rest" ) ){
 
-	    //System.err.println("Lang=" + header.getProperty("lang") );
+	    //System.err.println("Renderer=" + header.getProperty("renderer") );
 	    //System.err.println("onto1=" +  params.getParameter("onto1") );
 	    //System.err.println("onto2=" +  params.getParameter("onto2") );
-	    String lang = header.getProperty("lang");
+ 
 	    params.setParameter( "restful", "true" );
+	    if ( header.getProperty("renderer") == null || ((String)header.getProperty("renderer")).equals("HTML") ) 
+		 params.setParameter( "renderer", "HTML" );
+	    else 
+		 params.setParameter( "renderer", "XML" );
+
 	    if ( wsmanager != null ) {
-		if( lang == null || lang.equals("XML") )
-		    return new Response( HTTP_OK, MIME_HTML, wsmanager.protocolAnswer( uri, uri.substring(start), header, params ) );
+		if( ((String)params.getParameter("renderer")).equals("HTML") )
+		    return htmlAnswer( uri, uri.substring(start), header, params );	    
 		else {
-		    return htmlAnswer( uri, "align", header, params );	    
+		    return new Response( HTTP_OK, MIME_HTML, wsmanager.protocolAnswer( uri, uri.substring(start), header, params ) );
 		}
 	    } else {
 		// This is not correct: I shoud return an error
@@ -565,7 +569,17 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
 		}
 	    }
 	} else if ( perf.equals("prmmatch") ) {
-	    msg ="<h1>Match ontologies</h1><form action=\"match\">Ontology 1: <input type=\"text\" name=\"onto1\" size=\"80\"/> (uri)<br />Ontology 2: <input type=\"text\" name=\"onto2\" size=\"80\"/> (uri)<br /><small>These are the URL of places where to find these ontologies. They must be reachable by the server (i.e., file:// URI are acceptable if they are on the server)</small><br /><!--input type=\"submit\" name=\"action\" value=\"Find\"/><br /-->Methods: <select name=\"method\">";
+	    String RESTOnto1 = "";
+	    String RESTOnto2 = "";
+	    String readonlyOnto = "";
+	    //Ontologies from Cupboard may be already provided here.
+	    if((String)params.getParameter("restful") != null && ((String)params.getParameter("renderer")).equals("HTML") ){
+		   RESTOnto1 = (String)params.getParameter("onto1");
+		   RESTOnto2 = (String)params.getParameter("onto2");
+		   //if(RESTOnto1 != null && !RESTOnto1.equals("") && RESTOnto2 != null && !RESTOnto2.equals("")) 
+		   readonlyOnto = "readonly=\"readonly\"";
+	    }
+	    msg ="<h1>Match ontologies</h1><form action=\"match\">Ontology 1: <input type=\"text\" name=\"onto1\" size=\"80\" value="+RESTOnto1+ " " + readonlyOnto+"> (uri)<br />Ontology 2: <input type=\"text\" name=\"onto2\" size=\"80\" value="+RESTOnto2+ " " + readonlyOnto+ "> (uri)<br /><small>These are the URL of places where to find these ontologies. They must be reachable by the server (i.e., file:// URI are acceptable if they are on the server)</small><br /><!--input type=\"submit\" name=\"action\" value=\"Find\"/><br /-->Methods: <select name=\"method\">";
 	    for( Iterator it = manager.listmethods().iterator(); it.hasNext(); ) {
 		String id = (String)it.next();
 		msg += "<option value=\""+id+"\">"+id+"</option>";
@@ -635,6 +649,10 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
 	    }
 	    msg += "</select><br /><input type=\"submit\" value=\"Get metadata\"/></form>";
 	} else if ( perf.equals("metadata") ) {
+	    if( params.getParameter("renderer") == null || ((String)params.getParameter("renderer")).equals("HTML") )
+	    	params.setParameter("method", "fr.inrialpes.exmo.align.impl.renderer.HTMLMetadataRendererVisitor");
+	    else
+		params.setParameter("method", "fr.inrialpes.exmo.align.impl.renderer.XMLMetadataRendererVisitor");
 	    Message answer = manager.render( new Message(newId(),(Message)null,myId,serverId,"", params) );
 	    //System.err.println("Content: "+answer.getContent());
 	    if ( answer instanceof ErrorMsg ) {
@@ -790,8 +808,20 @@ public class HTMLAServProfile implements AlignmentServiceProfile {
 
     private String displayAnswer( Message answer, Parameters param ) {
 	String result = null;
-	if ( param.getParameter("restful") != null ) {
-	    result = answer.RESTString();
+	if( (String)param.getParameter("restful") != null ) {
+	    if( ((String)param.getParameter("renderer")).equals("HTML") ) {
+	    	result = answer.HTMLRESTString();
+	    	//Return for Cupboard
+	    	if ( answer instanceof AlignmentId && ( answer.getParameters() == null || answer.getParameters().getParameter("async") == null ) ){
+		     result += "<table><tr>";
+result += "<td><form action=\"getID\"><input type=\"hidden\" name=\"id\" value=\""+answer.getContent()+"\"/><input type=\"submit\" name=\"action\" value=\"GetID\"  disabled=\"disabled\"/></form></td>";
+result += "<td><form action=\"metadata\"><input type=\"hidden\" name=\"id\" value=\""+answer.getContent()+"\"/><input type=\"submit\" name=\"action\" value=\"Metadata\"/></form></td>";
+	             result += "</tr></table>";
+	    	} else if( answer instanceof AlignmentIds && ( answer.getParameters() == null || answer.getParameters().getParameter("async") == null )) {
+			   result = answer.HTMLRESTString();
+		  }
+	    } else 
+		result = answer.RESTString();
 	} else {
 	    result = answer.HTMLString();
 	    // Improved return
diff --git a/src/fr/inrialpes/exmo/align/service/Message.java b/src/fr/inrialpes/exmo/align/service/Message.java
index df1be4fe99132b84b416903d2639a41d67c885a0..1fc3e38923cf7b462c51d22f5fc7c68c803a71bf 100644
--- a/src/fr/inrialpes/exmo/align/service/Message.java
+++ b/src/fr/inrialpes/exmo/align/service/Message.java
@@ -52,6 +52,10 @@ public class Message {
 	return "<ErrorMsg/>";
     }
 
+    public String HTMLRESTString(){
+	return "<ErrorMsg/>";
+    }
+
     public String SOAPString(){
 	return "<id>"+surrogate+"</id>"+"<sender>"+sender+"</sender>" + "<receiver>"+receiver+"</receiver>" + "<in-reply-to>" + inReplyTo+ "</in-reply-to>" + "<content>" + content + "</content>";	
     }
diff --git a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java
index 4205a4c8751759a92399a33b3f941ad81759ae33..5e49b8e0bf9d438bee5408f9b60714fca673415c 100644
--- a/src/fr/inrialpes/exmo/align/service/WSAServProfile.java
+++ b/src/fr/inrialpes/exmo/align/service/WSAServProfile.java
@@ -199,16 +199,16 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	String method = null;
 	String message = null;
 	String restful = (String)param.getParameter("restful");
-	if ( restful.equals("true") ) 
-		method= perf;
-	else {
+	if ( restful == null ) {
 		method= header.getProperty("SOAPAction");
 		message = ((String)param.getParameter("content")).trim();
+	} else {
+		method= perf;
 	}
 
 	// Create the DOM tree for the SOAP message
 	Document domMessage = null;
-	if( restful.equals("false") )
+	if( restful == null )
 	try {
 		 
 	    domMessage = BUILDER.parse( new ByteArrayInputStream( message.getBytes()) );
@@ -260,7 +260,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	    Message answer = null;
 	    msg += "    <storeResponse>\n";
 	    Parameters params = param;
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
  	    }
 	    if ( params.getParameter( "id" ) == null ) {
@@ -278,7 +278,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	} else if ( method.equals("invertRequest") || method.equals("invert") ) { // URI -> URI
 	    Message answer = null;
 	    Parameters params = param;
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
  	    }
 	    msg += "    <invertResponse>\n";
@@ -299,7 +299,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	    Message answer = null;
 	    msg += "    <cutResponse>\n";
 	    Parameters params = param;
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
  	    }
 	    if ( params.getParameter( "id" ) == null ) {
@@ -326,7 +326,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	    Message answer = null;
 	    msg += "    <matchResponse>\n";
 	    Parameters params = param;
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
 	    	if ( params.getParameter( "url1" ) == null ) {
 		     answer = new NonConformParameters(0,(Message)null,myId,"",message,(Parameters)null);
@@ -355,7 +355,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	    Message answer = null;
 	    msg += "    <alignResponse>\n";
 	    Parameters params = param;
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
 	    	if ( params.getParameter( "url1" ) == null ) {
 		    answer = new NonConformParameters(0,(Message)null,myId,"",message,(Parameters)null);
@@ -408,7 +408,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	    msg += "    <findResponse>\n";
 	    Parameters params = param;		
 
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
 		if ( params.getParameter( "url1" ) == null ) {
 		     answer = new NonConformParameters(0,(Message)null,myId,"",message,(Parameters)null);
@@ -441,7 +441,7 @@ public class WSAServProfile implements AlignmentServiceProfile {
 	    msg += "    <retrieveResponse>\n";		
             Parameters params = param;		
 
-	    if( restful.equals("false") ) {
+	    if( restful == null ) {
 		params = getParameters( domMessage );
 		if ( params.getParameter( "alid" ) == null ) {
 		     answer = new NonConformParameters(0,(Message)null,myId,"",message,(Parameters)null);
@@ -512,8 +512,8 @@ public class WSAServProfile implements AlignmentServiceProfile {
 
 	SOAPMsg += msg + "</SOAP-ENV:Body>\n</SOAP-ENV:Envelope>\n";
 	RESTMsg += msg;
-	if( restful.equals("true") ) return RESTMsg;
-	else return SOAPMsg;
+	if( restful == null ) return SOAPMsg;
+	else return RESTMsg;
     }
 
     public static String wsdlAnswer() { return wsdlSpec; }
diff --git a/src/fr/inrialpes/exmo/align/service/WSAlignment.java b/src/fr/inrialpes/exmo/align/service/WSAlignment.java
index f66f829813292435f8eaab7bdf4a65144ff5359e..181e9d061a1949dacc4075562273712f3d9ff41a 100644
--- a/src/fr/inrialpes/exmo/align/service/WSAlignment.java
+++ b/src/fr/inrialpes/exmo/align/service/WSAlignment.java
@@ -30,6 +30,7 @@ import java.util.List;
 import java.util.Set;
 import java.util.ArrayList;
 import java.io.File;
+import java.io.FileWriter;
 import java.io.PrintStream;
 import java.io.PrintWriter;
 import java.io.BufferedReader;
@@ -114,6 +115,8 @@ public class WSAlignment extends URIAlignment implements AlignmentProcess {
 	 message += "  </SOAP-ENV:Body>\n</SOAP-ENV:Envelope>\n";
 	 byte[] byteMess = message.getBytes();
 
+	 //System.err.println("SOAP for sending=" + message);
+
 	 // Connect with the web service (in parameter)
 	 HttpURLConnection httpConn = null;
 	 try {
@@ -123,6 +126,7 @@ public class WSAlignment extends URIAlignment implements AlignmentProcess {
 	     httpConn.setRequestProperty( "Content-Length",
 					  String.valueOf( byteMess.length ) );
 	     httpConn.setRequestProperty("Content-Type","text/xml; charset=utf-8");
+	     //httpConn.setRequestProperty("SOAPAction","http://kameleon.ijs.si/ontolight/align");
 	     httpConn.setRequestProperty("SOAPAction","align");
 	     httpConn.setRequestMethod( "POST" );
 	     httpConn.setDoOutput(true);
@@ -145,13 +149,32 @@ public class WSAlignment extends URIAlignment implements AlignmentProcess {
 	 // Get the result
 	 // Parse the result in this alignment
 	 try {
+	     
+             //System.err.println("  response code =" + httpConn.getResponseCode() );
+             //System.err.println("  response mess =" + httpConn.getResponseMessage() );
+	     //InputStream  inSt = httpConn.getInputStream(); 
+ 	     //InputStreamReader isr = new InputStreamReader( inSt );
+	     //BufferedReader in = new BufferedReader(isr);
+	      
+	     //String line;
+	     //String res= "";
+	     
+	      
+             //while( (line = in.readLine()) !=null ) {
+		//res += line + "\n";
+                
+		//}
+ 
 	     AlignmentParser parser = new AlignmentParser( 0 );
 	     parser.initAlignment( this );
 	     parser.setEmbedded( true );
 	     parser.parse( httpConn.getInputStream() );
+	     //parser.parseString( res ); 
+
 	 } catch (SAXException saxex) {
-	     throw new AlignmentException( "Malformed XML/SOAP result", saxex );
+	     throw new AlignmentException( "Malformed XML/SOAP result ("+saxex.getMessage()+")", saxex );
 	 } catch (IOException ioex) {
+	     
 	     throw new AlignmentException( "XML/SOAP parsing error", ioex );
 	 } catch (javax.xml.parsers.ParserConfigurationException pcex) {
 	     throw new AlignmentException( "XML/SOAP parsing error", pcex );