[OpenLayers-Commits] r11980 - in sandbox/bartvde/wps/openlayers:
lib/OpenLayers/Format tests/Format
commits-20090109 at openlayers.org
commits-20090109 at openlayers.org
Fri May 20 06:47:51 EDT 2011
Author: bartvde
Date: 2011-05-20 03:47:50 -0700 (Fri, 20 May 2011)
New Revision: 11980
Modified:
sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
Log:
writing out WPS Execute requests
Modified: sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js
===================================================================
--- sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-20 09:52:53 UTC (rev 11979)
+++ sandbox/bartvde/wps/openlayers/lib/OpenLayers/Format/WPSExecute.js 2011-05-20 10:47:50 UTC (rev 11980)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
+/* iopyright (c) 2006-2011 by OsenLayers Contributors (see authors.txt for
* full list of contributors). Published under the Clear BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
@@ -23,6 +23,7 @@
ows: "http://www.opengis.net/ows/1.1",
gml: "http://www.opengis.net/gml",
wps: "http://www.opengis.net/wps/1.0.0",
+ wfs: "http://www.opengis.net/wfs",
ogc: "http://www.opengis.net/ogc",
wcs: "http://www.opengis.net/wcs/1.1.1",
xlink: "http://www.w3.org/1999/xlink",
@@ -52,10 +53,9 @@
*/
schemaLocation: "http://www.opengis.net/wps/1.0.0 http://schemas.opengis.net/wps/1.0.0/wpsAll.xsd",
- /**
- * Property: defaultPrefix
- */
- defaultPrefix: "wps",
+ schemaLocationAttr: function(options) {
+ return undefined;
+ },
/**
* Constructor: OpenLayers.Format.WPSExecute
@@ -100,8 +100,23 @@
});
this.writeNode("ows:Identifier", options.identifier, node);
this.writeNode("wps:DataInputs", options.dataInputs, node);
+ this.writeNode("wps:ResponseForm", options.responseForm, node);
return node;
},
+ "ResponseForm": function(responseForm) {
+ var node = this.createElementNSPlus("wps:ResponseForm", {});
+ this.writeNode("wps:RawDataOutput", responseForm.rawDataOutput, node);
+ return node;
+ },
+ "RawDataOutput": function(rawDataOutput) {
+ var node = this.createElementNSPlus("wps:RawDataOutput", {
+ attributes: {
+ mimeType: rawDataOutput.mimeType
+ }
+ });
+ this.writeNode("ows:Identifier", rawDataOutput.identifier, node);
+ return node;
+ },
"DataInputs": function(dataInputs) {
var node = this.createElementNSPlus("wps:DataInputs", {});
for (var i=0, ii=dataInputs.inputs.length; i<ii; ++i) {
@@ -125,9 +140,26 @@
method: reference.method
}
});
+ if (reference.body) {
+ this.writeNode("wps:Body", reference.body, node);
+ }
return node;
+ },
+ "Body": function(body) {
+ var node = this.createElementNSPlus("wps:Body", {});
+ if (body.wfs) {
+ // OpenLayers.Format.WFST expects these to be on the
+ // instance and not in the options
+ this.featureType = body.wfs.featureType;
+ this.version = body.wfs.version;
+ this.writeNode("wfs:GetFeature", body.wfs, node);
+ } else {
+ this.writeNode("wps:Execute", body, node);
+ }
+ return node;
}
},
+ "wfs": OpenLayers.Format.WFST.v1_1_0.prototype.writers.wfs,
"ows": OpenLayers.Format.OWSCommon.v1_1_0.prototype.writers.ows
},
Modified: sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html
===================================================================
--- sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-20 09:52:53 UTC (rev 11979)
+++ sandbox/bartvde/wps/openlayers/tests/Format/WPSExecute.html 2011-05-20 10:47:50 UTC (rev 11980)
@@ -4,6 +4,7 @@
<script type="text/javascript">
function test_write_WPSExecute(t) {
+ t.plan(1);
var expected = '<?xml version="1.0" encoding="UTF-8"?>' +
'<wps:Execute version="1.0.0" service="WPS" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"' +
' xmlns="http://www.opengis.net/wps/1.0.0" xmlns:wfs="http://www.opengis.net/wfs"' +
@@ -17,7 +18,7 @@
' <ows:Identifier>geom</ows:Identifier>' +
' <wps:Reference mimeType="text/xml; subtype=gml/3.1.1" xlink:href="http://geoserver/wps"' +
' method="POST">' +
-' <Body>' +
+' <wps:Body>' +
' <wps:Execute service="WPS" version="1.0.0">' +
' <ows:Identifier>gs:CollectGeometries</ows:Identifier>' +
' <wps:DataInputs>' +
@@ -40,7 +41,7 @@
' </wps:RawDataOutput>' +
' </wps:ResponseForm>' +
' </wps:Execute>' +
-' </Body>' +
+' </wps:Body>' +
' </wps:Reference>' +
' </wps:Input>' +
' </wps:DataInputs>' +
@@ -52,10 +53,51 @@
'</wps:Execute>';
var format = new OpenLayers.Format.WPSExecute();
- var result = format.write({identifier: "JTS:area", dataInputs: {inputs: [{identifier: 'geom',
- reference: {mimeType: "text/xml; subtype=gml/3.1.1", href: "http://geoserver/wps", method: "POST"}
- }]}});
- console.log(result);
+ var result = format.write({
+ identifier: "JTS:area",
+ dataInputs: {
+ inputs: [{
+ identifier: 'geom',
+ reference: {
+ mimeType: "text/xml; subtype=gml/3.1.1",
+ href: "http://geoserver/wps",
+ method: "POST",
+ body: {
+ identifier: "gs:CollectGeometries",
+ dataInputs: {
+ inputs: [{
+ identifier: 'features',
+ reference: {
+ mimeType: "text/xml; subtype=wfs-collection/1.0",
+ href: "http://geoserver/wfs",
+ method: "POST",
+ body: {
+ wfs: {
+ version: "1.0.0",
+ outputFormat: "GML2",
+ featureType: "sf:archsites"
+ }
+ }
+ }
+ }]
+ },
+ responseForm: {
+ rawDataOutput: {
+ mimeType: "text/xml; subtype=gml/3.1.1",
+ identifier: "result"
+ }
+ }
+ }
+ }
+ }]
+ },
+ responseForm: {
+ rawDataOutput: {
+ identifier: "result"
+ }
+ }
+ });
+ t.xml_eq(result, expected, "WPS Execute written out correctly");
}
</script>
More information about the Commits
mailing list