[Geoserver-users] Perform getfeature request through GeoServer using POST method

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&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ows="http://www.opengis.net/ows&quot;&gt;
  <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&#xd;
Accept: */*&#xd;
Content-Length: 837&#xd;
Content-Type: application/x-www-form-urlencoded&#xd;
&#xd;
</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&quot; xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;&lt;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
··················································································

Hi,

WFS 1.0.0 is using GML2. I would change either the version or the outputformat first and see it that helps.

-Jukka Rahkonen-

________________________________

Lähettäjä: David Alda Fernandez de Lezea [mailto:dalda@anonymised.com]
Lähetetty: ke 13.10.2010 16:43
Vastaanottaja: geoserver-users@lists.sourceforge.net
Aihe: [Geoserver-users] Perform getfeature request through GeoServerusing POST method

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&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xmlns:ows="http://www.opengis.net/ows&quot;&gt;
  <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&#xd;
Accept: */*&#xd;
Content-Length: 837&#xd;
Content-Type: application/x-www-form-urlencoded&#xd;
&#xd;
</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&quot; xmlns:ogc="http://www.opengis.net/ogc&quot; xmlns:gml="http://www.opengis.net/gml&quot; xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot; xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;&lt;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
··················································································

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

Does it work using GET(with your filter)?

David Alda Fernandez de Lezea wrote:

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&quot;
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xmlns:ows="http://www.opengis.net/ows&quot;&gt;
  <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&#xd;
Accept: */*&#xd;
Content-Length: 837&#xd;
Content-Type: application/x-www-form-urlencoded&#xd;
&#xd;
</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&quot;
xmlns:ogc="http://www.opengis.net/ogc&quot;
xmlns:gml="http://www.opengis.net/gml&quot;
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-basic.xsd&quot;&gt;&lt;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
··················································································

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1, ECMAScript5, and DOM L2 & L3.
Spend less time writing and rewriting code and more time creating great
experiences on the web. Be a part of the beta today.
http://p.sf.net/sfu/beautyoftheweb
_______________________________________________
Geoserver-users mailing list
Geoserver-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-users

--
View this message in context: http://old.nabble.com/Perform-getfeature-request-through-GeoServer-using-POST-method-tp29953319p29958184.html
Sent from the GeoServer - User mailing list archive at Nabble.com.