Index: trunk/zoo-project/zoo-client/lib/js/wps-client/wps-payload.js
===================================================================
--- trunk/zoo-project/zoo-client/lib/js/wps-client/wps-payload.js	(revision 718)
+++ trunk/zoo-project/zoo-client/lib/js/wps-client/wps-payload.js	(revision 719)
@@ -85,4 +85,6 @@
             } else if (params.request == 'Execute') {
                 return this.getPayload_Execute(params);
+            } else if (params.request == 'Dismiss') {
+                return this.getPayload_Dismiss(params);
             } else {
                 console.log("#### UNKNOWN REQUEST ####");
@@ -107,5 +109,8 @@
 	 */
         getPayload_GetCapabilities: function(params) {
-            return templates["payload_GetCapabilities"].render(params);
+	    var id="payload_GetCapabilities";
+	    if(params.version=="2.0.0")
+		id+="2";
+	    return templates[id].render(params);
         },
         
@@ -128,14 +133,48 @@
 	 */
         getPayload_DescribeProcess: function(params) {
+	    var id="payload_DescribeProcess";
+	    if(params.version=="2.0.0")
+		id+="2";
             if (params.Identifier) {
                 if ($.isArray(params.Identifier)) {
-                    return templates["payload_DescribeProcess"].render({identifiers: params.Identifier,language: params.language});
+                    return templates[id].render({identifiers: params.Identifier,language: params.language});
                 }
                 else {
-                    return templates["payload_DescribeProcess"].render({identifiers: [params.Identifier],language: params.language});
+                    return templates[id].render({identifiers: [params.Identifier],language: params.language});
                 }
             }
             // TODO: no Identifier
         },
+
+        /**
+	 * The getPayload_Dismiss function is used to generate a valid 
+	 * WPS XML Dimiss request using the 
+	 * [payload_Dismiss.mustache]{@link http://zoo-project.org/trac/browser/trunk/zoo-project/zoo-client/lib/tpl/payload_Dismiss.mustache} 
+	 * template.
+	 * 
+	 * @static
+	 * @param {Object} params - The object representing the request.
+	 * @returns {string} - The corresponding XML request
+	 * @example
+	 * // log the XML request in console
+	 * var request_params = {
+	 *     jobId: ["XXXX","XXX"]
+         * };
+	 * console.log(wpsPayload.getPayload_DescribeProcess(request_params));
+	 */
+        getPayload_Dismiss: function(params) {
+	    var id="payload_Dismiss";
+	    params.version="2.0.0";
+            if (params.jobid) {
+                if ($.isArray(params.jobid)) {
+                    return templates[id].render({jobid: params.jobid});
+                }
+                else {
+                    return templates[id].render({jobid: [params.jobid]});
+                }
+            }
+            // TODO: no Identifier
+        },
+
 
         /**
@@ -159,4 +198,7 @@
 	 */
         getPayload_Execute: function(params) {
+	    var id="payload_Execute";
+	    if(params.version=="2.0.0")
+		id+="2";
             if (params.DataInputs) {
                 for (var i = 0; i < params.DataInputs.length; i++) {
@@ -210,9 +252,6 @@
                     
                     // Complex data from payload callback.
-		    console.log("CALLBACK");
-		    console.log(params.DataInputs[i]);
                     if (params.DataInputs[i].complexPayload_callback) {
                         params.DataInputs[i].value = window[params.DataInputs[i].complexPayload_callback];
-			console.log(params.DataInputs[i].value);
                     }
                     
@@ -245,5 +284,5 @@
             }
             
-            return templates["payload_Execute"].render(params);
+            return templates[id].render(params);
         },
         
Index: trunk/zoo-project/zoo-client/lib/js/wps-client/zoo.js
===================================================================
--- trunk/zoo-project/zoo-client/lib/js/wps-client/zoo.js	(revision 718)
+++ trunk/zoo-project/zoo-client/lib/js/wps-client/zoo.js	(revision 719)
@@ -73,4 +73,10 @@
          * @access public
 	 * @memberof ZooProcess#
+	 * @var version {String} The WPS version
+	 */
+        this.version = params.version?params.version:"1.0.0";
+        /**
+         * @access public
+	 * @memberof ZooProcess#
 	 * @var language {String} The language to be used to request the WPS Server
 	 * @default "en-US"
@@ -137,5 +143,5 @@
                 request: 'GetCapabilities',
                 service: 'WPS',
-                version: '1.0.0',
+                version: (params.hasOwnProperty('version')?params.version:closure.version),
             }
 
@@ -170,5 +176,5 @@
                 request: 'DescribeProcess',
                 service: 'WPS',
-                version: '1.0.0',
+                version: (params.hasOwnProperty('version')?params.version:closure.version),
             }
 
@@ -198,5 +204,5 @@
                 request: 'Execute',
                 service: 'WPS',
-                version: '1.0.0',
+                version: (params.hasOwnProperty('version')?params.version:closure.version),
                 Identifier: params.identifier,
                 DataInputs: params.dataInputs ? params.dataInputs : '',
@@ -204,7 +210,11 @@
             }
 
+	    console.log(zoo_request_params);
 
             if (params.hasOwnProperty('responseDocument')) {
                 zoo_request_params.ResponseDocument = params.responseDocument;
+            }
+            if (params.hasOwnProperty('mode')) {
+                zoo_request_params.mode = params.mode;
             }
             if (params.hasOwnProperty('storeExecuteResponse') &&  params.storeExecuteResponse) {
@@ -257,4 +267,5 @@
                     console.log("======== POST PAYLOAD ========");
                     console.log(payload);
+		    console.log(params);
 		}
 
@@ -367,13 +378,25 @@
 			}
 			var launched;
-			
-			if (params.storeExecuteResponse == 'true' && params.status == 'true') {
-			    launched = closure.parseStatusLocation(data);            
-			    closure.statusLocation[launched.sid] = launched.statusLocation;
-			    
-			    if ( launched.hasOwnProperty('sid') && 
-				 !closure.launched.hasOwnProperty(launched.sid)) {
-				closure.launched[launched.sid] = launched.statusLocation;
+			var version=(params.version?params.version:closure.version);
+			if(version=="1.0.0"){
+			    if (params.storeExecuteResponse == 'true' && params.status == 'true') {
+				launched = closure.parseStatusLocation(data);            
+				closure.statusLocation[launched.sid] = launched.statusLocation;
+				
+				if ( launched.hasOwnProperty('sid') && 
+				     !closure.launched.hasOwnProperty(launched.sid)) {
+				    closure.launched[launched.sid] = launched.statusLocation;
+				}
 			    }
+			}
+			else{
+			    if (params.mode == 'async') {
+				launched = closure.parseJobID(data);
+				closure.statusLocation[launched.sid] = closure.url+"?request=GetStatus&service=WPS&version=2.0.0&JobID="+launched.jobid;
+				if ( launched.hasOwnProperty('sid') && 
+				     !closure.launched.hasOwnProperty(launched.sid)) {
+				    closure.launched[launched.sid] = launched.jobid;
+				}
+			    }	    
 			}
 
@@ -446,4 +469,77 @@
 		}
 
+		if(data.StatusInfo || data.Result){
+		    if (data.Result) {
+
+			var ret = {
+                            sid: sid,
+                            text: "",
+                            result: data
+			};
+
+			if (handlers.onProcessSucceeded instanceof Function) {
+                            handlers.onProcessSucceeded(ret);
+			}
+
+			return;
+		    }
+		    if (data.StatusInfo.Status == "Running") {
+			if(closure.debug){
+			    console.log("#### ProcessStarted");
+			}
+			
+			var message="";
+			for(index=0;index<data._origin.childNodes[0].childNodes.length;index++){
+			    if(data._origin.childNodes[0].childNodes[index].nodeType==8){
+				message=data._origin.childNodes[0].childNodes[index].textContent;
+			    }
+			}
+			var ret = {
+                            sid: sid,
+                            percentCompleted: (data.StatusInfo.PercentCompleted?data.StatusInfo.PercentCompleted:0),
+                            text: message,
+                            creationTime: "",
+			};
+
+			if (handlers.onPercentCompleted instanceof Function) {
+                            handlers.onPercentCompleted(ret);
+			}
+                    }
+                    else if (data.StatusInfo.Status == "Succeeded") {
+			if(closure.debug){
+			    console.log("#### ProcessSucceeded");
+			}
+
+			var text = "";
+			closure.terminated[sid] = true;
+
+			ret = {
+                            sid: sid,
+                            text: text,
+                            result: data
+			};
+			
+			closure.getResult(sid, onSuccess, onError);
+                    }
+                    else {
+			if(closure.debug){
+			    console.log("#### UNHANDLED EXCEPTION");
+			}
+			closure.terminated[sid] = true;
+			ret = {
+                            sid: sid,
+                            code: 'BAD',
+                            text: 'UNHANDLED EXCEPTION'
+			};
+			
+			//closure.emit('exception', ret);
+			if (handlers.onError instanceof Function) {
+                            handlers.onError(ret);
+			}
+                    }
+
+		    return
+		}
+
 		if (data.ExecuteResponse.Status.ProcessAccepted) {
                     var ret = {
@@ -529,4 +625,5 @@
                     console.log("PING: "+sid);
 		}
+
                 closure.getStatus(sid, onSuccess, onError);
                 if (closure.terminated[sid]) {
@@ -613,4 +710,53 @@
 		    });
         };
+
+	/**
+	 * The getResult method is used by {@link ZooProcess#watch} to get the
+	 * final result of services called asynchronously.
+	 * 
+	 * @method getResult
+	 * @memberof ZooProcess#
+	 * @param {Integer} sid Service Identifier
+	 * @param {Function} onSuccess callback 
+	 * @param {Function} onError callback 
+	 */
+        this.getResult = function(sid, onSuccess, onError) {
+            var closure = this;
+	    if(closure.debug){
+		console.log("GET STATUS: "+sid);
+		console.log(closure.statusLocation[sid].replace(/GetStatus/g,"GetResult"));
+	    }
+            $.ajax({
+		url: closure.statusLocation[sid].replace(/GetStatus/g,"GetResult")
+	    })
+		.fail(
+                    function(jqXHR, textStatus, errorThrown) {
+			if(closure.debug){
+			    console.log("======== ERROR ========");
+			}
+			var robj=_x2js.xml2json( jqXHR.responseXML );
+			if(closure.debug){
+			    console.log(robj);
+			}
+			if(onError)
+			    onError(robj);
+                    }
+		)
+		.done(
+                    function(data, textStatus, jqXHR) {
+			if(closure.debug){
+			    console.log("======== SUCCESS ========2");
+			    console.log(data);
+			}
+			var ctype=jqXHR.getResponseHeader("Content-Type").split(";")[0];
+			if( ctype=="text/xml" ){
+			    var tmpD=data;
+			    data = _x2js.xml2json( data );
+			    data._origin=tmpD;
+			}
+			if(onSuccess)
+			    onSuccess(data);
+		    });
+        };
         
 	/**
@@ -791,4 +937,63 @@
             }
         };        
+
+	/**
+	 * The parseJobID method parse the JobID and return an
+	 * object with sid and the JobID attributes which contains
+	 * respectively: a unique identifier named sid and the JobID
+	 * value returned by the WPS server.
+	 * 
+	 * @method parseJobID
+	 * @memberof ZooProcess#
+	 * @param {Object} data The XML response parsed by x2js.xml2json
+	 * @returns {Object} The result is an object with sid and jobID
+	 */
+        this.parseJobID = function(data) {
+            var closure = this;
+
+            if (jobID = data.StatusInfo.JobID) {
+
+		var lsid=0;
+		for(i in closure.statusLocation)
+		    lsid++;
+		
+                return {sid: lsid, jobid: jobID};
+            }
+        }; 
+
+	/**
+	 * The dismiss method run the Dismiss request by calling {@link ZooProcess#request}.
+	 * 
+	 * @method dismiss
+	 * @memberof ZooProcess#
+	 * @param {Object} params 
+	 * @example
+	 * // Log x2js representation of all available services in console
+	 * myZooObject.dismiss({
+	 *     type: 'POST',
+	 *     jobid: "XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX"
+	 *     success: function(data){
+	 *         console.log(data);
+	 *     }
+	 * });
+	 */
+        this.dismiss = function(params) {
+            var closure = this;
+
+            if (!params.hasOwnProperty('type')) {
+                params.type = 'GET';
+            }
+
+            var zoo_request_params = {
+                Identifier: params.identifier,
+                request: 'Dismiss',
+                service: 'WPS',
+		jobid: params.jobid,
+                version: "2.0.0",
+            }
+
+            this.request(zoo_request_params, params.success, params.error, params.type);
+        };
+
     };
     
Index: trunk/zoo-project/zoo-client/lib/tpl/payload_DescribeProcess2.mustache
===================================================================
--- trunk/zoo-project/zoo-client/lib/tpl/payload_DescribeProcess2.mustache	(revision 719)
+++ trunk/zoo-project/zoo-client/lib/tpl/payload_DescribeProcess2.mustache	(revision 719)
@@ -0,0 +1,14 @@
+<wps:DescribeProcess
+	xmlns:ows="http://www.opengis.net/ows/2.0"
+	xmlns:wps="http://www.opengis.net/wps/2.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.opengis.net/wps/2.0 ../wps.xsd"
+	
+	service="WPS"
+	version="2.0.0">
+	
+{{#identifiers}}
+  <ows:Identifier>{{.}}</ows:Identifier>
+{{/identifiers}}
+	
+</wps:DescribeProcess>
Index: trunk/zoo-project/zoo-client/lib/tpl/payload_Dismiss.mustache
===================================================================
--- trunk/zoo-project/zoo-client/lib/tpl/payload_Dismiss.mustache	(revision 719)
+++ trunk/zoo-project/zoo-client/lib/tpl/payload_Dismiss.mustache	(revision 719)
@@ -0,0 +1,10 @@
+<wps:Dismiss
+	xmlns:wps="http://www.opengis.net/wps/2.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.opengis.net/wps/2.0 ../wps.xsd"
+	service="WPS"
+	version="2.0.0">
+{{#jobid}}
+	<wps:JobID>{{.}}</wps:JobID>
+{{/jobid}}
+</wps:Dismiss>
Index: trunk/zoo-project/zoo-client/lib/tpl/payload_Execute2.mustache
===================================================================
--- trunk/zoo-project/zoo-client/lib/tpl/payload_Execute2.mustache	(revision 719)
+++ trunk/zoo-project/zoo-client/lib/tpl/payload_Execute2.mustache	(revision 719)
@@ -0,0 +1,62 @@
+<wps:Execute
+	xmlns:wps="http://www.opengis.net/wps/2.0"
+	xmlns:ows="http://www.opengis.net/ows/2.0"
+	xmlns:xlink="http://www.w3.org/1999/xlink"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.opengis.net/wps/2.0 ../wps.xsd"
+	
+	service="WPS"
+	version="2.0.0"
+	response="{{#RawDataOutput}}{{/RawDataOutput}}{{^RawDataOutput}}document{{/RawDataOutput}}"
+	mode="{{#mode}}{{mode}}{{/mode}}{{^mode}}sync{{/mode}}">
+
+	<ows:Identifier>{{Identifier}}</ows:Identifier>
+{{#DataInputs}}
+{{#is_literal}}
+		<wps:Input id="{{identifier}}">
+			<wps:Data>{{value}}</wps:Data>
+		</wps:Input>
+{{/is_literal}}
+{{#is_bbox}}
+		<wps:Input id="{{identifier}}">
+			<wps:Data>
+				<wps:BoundingBoxData ows:crs="{{crs}}" ows:dimensions="{{dimension}}">
+            <ows:LowerCorner>{{lowerCorner}}</ows:LowerCorner>
+            <ows:UpperCorner>{{upperCorner}}</ows:UpperCorner>
+         </wps:BoundingBoxData>
+			</wps:Data>
+		</wps:Input>
+{{/is_bbox}}
+{{#is_complex}}
+{{#is_reference}}
+{{#is_get}}
+		<wps:Input id="{{identifier}}">
+			<wps:Reference xlink:href="{{href}}"/>
+		</wps:Input>
+{{/is_get}}
+{{#is_post}}
+		<wps:Input id="{{identifier}}">
+			<wps:Reference xlink:href="{{href}}" method="{{method}}">
+{{#mimeType}}
+			  <wps:Header key="Content-type" value="{{mimeType}}" />
+{{/mimeType}}
+			  <wps:Body>{{{complexPayload}}}</wps:Body>
+			</wps:Reference>
+		</wps:Input>
+{{/is_post}}
+{{/is_reference}}
+{{^is_reference}}
+		<wps:Input id="{{identifier}}">
+      <wps:Data>
+        <wps:ComplexData{{#schema}} schema="{{shema}}"{{/schema}}{{#mimeType}} mimeType="{{mimeType}}"{{/mimeType}}{{#encoding}} encoding="{{encoding}}"{{/encoding}}>
+        	{{{complexPayload}}}
+        </wps:ComplexData>
+      </wps:Data>
+    </wps:Input>
+{{/is_reference}}
+{{/is_complex}}
+{{/DataInputs}}
+{{#DataOutputs}}
+      <wps:Output id="{{identifier}}" transmission="{{#asReference}}{{asReference}}{{/asReference}}{{^asReference}}value{{/asReference}}"{{#schema}} schema="{{schema}}"{{/schema}}{{#mimeType}} mimeType="{{mimeType}}"{{/mimeType}}{{#encoding}} encoding="{{encoding}}"{{/encoding}}{{#uom}} uom="{{uom}}"{{/uom}} />
+{{/DataOutputs}}
+</wps:Execute>
Index: trunk/zoo-project/zoo-client/lib/tpl/payload_GetCapabilities2.mustache
===================================================================
--- trunk/zoo-project/zoo-client/lib/tpl/payload_GetCapabilities2.mustache	(revision 719)
+++ trunk/zoo-project/zoo-client/lib/tpl/payload_GetCapabilities2.mustache	(revision 719)
@@ -0,0 +1,7 @@
+<wps:GetCapabilities
+	xmlns:wps="http://www.opengis.net/wps/2.0"
+	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+	xsi:schemaLocation="http://www.opengis.net/wps/2.0 ../wps.xsd"
+	service="WPS">
+	
+</wps:GetCapabilities>
