I need to create the GetSpatialDataSet stored query in my WFS service to follow the INSPIRE rules.
That WFS service is in a GeoServer 2.10.0. I have checked the official docs about how to create a stored query: http://docs.geoserver.org/stable/en/user/services/wfs/reference.html
The problem is I don't know what I am supposed to do with that piece of code.
<wfs:CreateStoredQuery service='WFS' version='2.0.0'
xmlns:wfs='http://www.opengis.net/wfs/2.0'
xmlns:fes='http://www.opengis.org/fes/2.0'
xmlns:gml='http://www.opengis.net/gml/3.2'
xmlns:myns='http://www.someserver.com/myns'
xmlns:topp='http://www.openplans.org/topp'>
<wfs:StoredQueryDefinition id='myStoredQuery'>
<wfs:Parameter name='AreaOfInterest' type='gml:Polygon'/>
<wfs:QueryExpressionText
returnFeatureTypes='topp:states'
language='urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression'
isPrivate='false'>
<wfs:Query typeNames='topp:states'>
<fes:Filter>
<fes:Within>
<fes:ValueReference>the_geom</fes:ValueReference>
${AreaOfInterest}
</fes:Within>
</fes:Filter>
</wfs:Query>
</wfs:QueryExpressionText>
Where should I paste it? It says it's a POST request, but that doesn't tell me anything.
EDIT: I have tried the following script from another answer:
<html>
<head>
<title>WFS Test</title>
<script language="JavaScript">
function doit()
{
var url = 'http://myserver:8080/geoserver/test/wfs';
var method = 'POST';
var postData = '<wfs:CreateStoredQuery\n'
+ 'xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"\n'
+ 'xsi:schemaLocation=\n'
+ '"http://www.opengis.net/wfs/2.0\n'
+ 'http://schemas.opengis.net/wfs/2.0/wfs.xsd"\n'
+ 'xmlns:cp_inspire="urn:x-
inspire:specification:gmlas:CadastralParcels:4.0"\n'
+ 'xmlns:fes="http://www.opengis.org/fes/2.0"\n'
+ 'xmlns:wfs="http://www.opengis.net/wfs/2.0"\n'
+ 'xmlns:gml="http://www.opengis.net/gml/3.2"\n'
+ 'xmlns:xsd="http://www.w3.org/2001/XMLSchema"\n'
+ 'service="WFS"\n'
+ 'version="2.0.0">\n'
+ '<wfs:StoredQueryDefinition\n'
+ 'id=\'' +
'http://inspire.ec.europa.eu/operation/download/GetSpatialDataSet' + '\'>\n'
+ '<wfs:Parameter name=\'' + 'CRS' + '\' type=\'' + 'xsd:string' + '\'/>\n'
+ '<wfs:Parameter name=\'' + 'DataSetIdCode' + '\' type=\'' + 'xsd:string' +'\'/>\n'
+ '<wfs:Parameter name=\'' + 'DataSetIdNamespace' + '\' type=\'' + 'xsd:string' +'\'/>\n'
+ '<wfs:Parameter name=\'' + 'Language' + '\' type=\'' + 'xsd:string' + '\'/>\n'
+ '<wfs:Parameter name="count" type="xsd:integer"></wfs:Parameter>\n'
+ '<wfs:QueryExpressionText\n'
+ 'returnFeatureTypes=\'' + 'cp_inspire:CP.CadastralParcel' + '\'\n'
+ 'language=\'' + 'urn:ogc:def:queryLanguage:OGC-WFS::WFS_QueryExpression' + '\'\n'
+ 'isPrivate=\'' + 'false' + '\'>\n'
+ '<wfs:Query typeNames=\'' + 'cp_inspire:CP.CadastralParcel' + '\' srsName="${CRS}">\n'
+ '</wfs:Query>\n'
+ '</wfs:QueryExpressionText>\n'
+ '</wfs:StoredQueryDefinition>\n'
+ '</wfs:CreateStoredQuery>\n';
var req = new XMLHttpRequest();
req.open("POST", url, true);
req.setRequestHeader('User-Agent', 'XMLHTTP/1.0');
req.setRequestHeader('Content-type', 'test/xml');
req.onreadystatechange = function () {
if (req.readyState != 4) return;
if (req.status != 200 && req.status != 304) {
alert('HTTP error ' + req.status);
return;
}
alert(req.responseText);
}
if (req.readyState == 4) return;
req.send(postData);
}
But I'm getting this error:
Does anyone see where is the problem?