Hi list,
I'm a bit newbie in GeoServer, so forgive me if this is something stupid. I want from an OpenLayers based web application to ask for some features of a layer served via GeoServer. I'm using a filter and I need to do it using POST method. I've got my porxy script made in PHP that works fine, but when I make the request I get the following message from GeoServer:
<?xml version="1.0" encoding="UTF-8"?>
<ows:ExceptionReport version="1.0.0"
xsi:schemaLocation="http://www.opengis.net/ows http://192.168.1.38:8080/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:ows="http://www.opengis.net/ows">
<ows:Exception exceptionCode="MissingParameterValue" locator="request">
<ows:ExceptionText>Could not determine geoserver request from http request POST /geoserver/wfs? HTTP/1.1
Host: 192.168.1.38:8080
Accept: */*
Content-Length: 837
Content-Type: application/x-www-form-urlencoded

</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>
My POST data is:
<wfs:GetFeature service="WFS" version="1.0.0" outputFormat="GML3" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd"><wfs:Query typeName="Municipios"> <Filter><Or><And><PropertyIsEqualTo><PropertyName>PROVINCIA</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>MUNICIPIO</PropertyName><Literal>1</Literal></PropertyIsEqualTo></And><And><PropertyIsEqualTo><PropertyName>PROVINCIA</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>MUNICIPIO</PropertyName><Literal>2</Literal></PropertyIsEqualTo></And></Or></Filter> </wfs:Query></wfs:GetFeature>
It seems that GeoServer is waiting from another parameter in the URL which would be request to execute, but it's defined in the XML parameter.
My JavaScript code:
var theUrl = networkSettings.proxyURL + "method=POST&url=" + this.onlineResource + "&data=" + filtro;
//06-10-2010
var myAjax = new OpenLayers.Ajax.Request(
theUrl,
{
method: 'post',
contentType: 'application/xml',
postBody: filtro,
onComplete: callbackFunction,
onFailure: function(){alert("Error petición AJAX.");}
});
I can see the data in the proxy.
Am I doing something wrong??
Thanks in advance.
Un saludo,
··················································································
David Alda Fernández de Lezea
Lurralde eta Biodibertsitate Saila / Dpto. de Territorio y Biodiversidad
IKT
Granja Modelo s/n · 01192 · Arkaute (Araba)
··················································································
Tlfnos.: 945-00-32-95 Fax: 945-00.32.90
··················································································
email: dalda@anonymised.com web: www.ikt.es
··················································································