diff --git a/lib/OpenLayers/WPSClient.js b/lib/OpenLayers/WPSClient.js index fef748915e..257e43166f 100644 --- a/lib/OpenLayers/WPSClient.js +++ b/lib/OpenLayers/WPSClient.js @@ -94,9 +94,10 @@ OpenLayers.WPSClient = OpenLayers.Class({ * geometries or features. * success - {Function} Callback to call when the process is complete. * This function is called with an outputs object as argument, which - * will have a 'result' property. For processes that generate spatial - * output, this will either be a single or - * an array of features. + * will have a property with the name of the requested output (e.g. + * 'result'). For processes that generate spatial output, the value + * will either be a single or an array of + * features. * scope - {Object} Optional scope for the success callback. */ execute: function(options) { diff --git a/lib/OpenLayers/WPSProcess.js b/lib/OpenLayers/WPSProcess.js index efca240a83..749c3473a8 100644 --- a/lib/OpenLayers/WPSProcess.js +++ b/lib/OpenLayers/WPSProcess.js @@ -212,9 +212,10 @@ OpenLayers.WPSProcess = OpenLayers.Class({ * provided, the first output will be parsed. * success - {Function} Callback to call when the process is complete. * This function is called with an outputs object as argument, which - * will have a 'result' property. For processes that generate spatial - * output, this will either be a single or - * an array of features. + * will have a property with the name of the requested output (e.g. + * 'result'). For processes that generate spatial output, the value + * will either be a single or an array of + * features. * scope - {Object} Optional scope for the success callback. */ execute: function(options) { @@ -223,10 +224,10 @@ OpenLayers.WPSProcess = OpenLayers.Class({ callback: function() { var me = this; //TODO For now we only deal with a single output - var output = this.getOutputIndex( + var outputIndex = this.getOutputIndex( me.description.processOutputs, options.output ); - me.setResponseForm({outputIndex: output}); + me.setResponseForm({outputIndex: outputIndex}); (function callback() { OpenLayers.Util.removeItem(me.executeCallbacks, callback); if (me.chained !== 0) { @@ -241,15 +242,16 @@ OpenLayers.WPSProcess = OpenLayers.Class({ url: me.client.servers[me.server].url, data: new OpenLayers.Format.WPSExecute().write(me.description), success: function(response) { + var output = me.description.processOutputs[outputIndex]; var mimeType = me.findMimeType( - me.description.processOutputs[output].complexOutput.supported.formats + output.complexOutput.supported.formats ); //TODO For now we assume a spatial output var features = me.formats[mimeType].read(response.responseText); if (options.success) { - options.success.call(options.scope, { - result: features - }); + var outputs = {}; + outputs[output.identifier] = features; + options.success.call(options.scope, outputs); } }, scope: me