[mapserver-users] RE: [OpenLayers-Users] Strange behaviour with OpenLayers.Request.POST and MapServer

Fawcett, David (MPCA) David.Fawcett at state.mn.us
Mon Jun 21 07:46:14 PDT 2010


David, 

I just skimmed the text of post XML, but if your OpenLayers app is sending a query to MapServer, your layer will need a template.  In the case of WFS, I don't think that you need a real template file.  But, you still might need an entry  in your LAYER that is something like TEMPLATE "dummy.html".

David.

-----Original Message-----
From: mapserver-users-bounces at lists.osgeo.org [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of David Alda Fernandez de Lezea
Sent: Monday, June 21, 2010 6:59 AM
To: mapserver-users at lists.osgeo.org
Subject: [mapserver-users] RV: [OpenLayers-Users] Strange behaviour with OpenLayers.Request.POST and MapServer 


Hi list,

I posted this question in OpenLayers mailing list but without response, maybe here someone knwos what could be happening. I'm trying to load some data from a remote WFS Server (MapServer). At the beginning I used OpenLayers.Request.POST({url: this.onlineResource, callback: callbackFunction, method: 'POST', data: filter}); to load the features and it worked perfectly, but now, due to some architecture issues, I have to make the request over a proxy script made in php, but I don't get the features. I don't get any OpenLayers error but I get an error from MapServer:

Error:
mapserv(): Web application error. Traditional BROWSE mode requires a TEMPLATE in the WEB section, but none was provided.

Request: 

OpenLayers.Request.POST({url: networkSettings.proxyURL + "?method=POST&url=" + escape(this.onlineResource) + "&data=" + filtro, callback: callbackFunction, method: 'POST', headers: {"Content-Type": "text/xml; charset=utf-8"}});

Web Proxy:

<?

	$strURL = @$_REQUEST["url"];
	$strMethod = @$_REQUEST["method"];
	$strData = @$_REQUEST["data"];

	$ch = curl_init();
	curl_setopt($ch, CURLOPT_URL, $strURL);
	if ($strMethod == "POST"){
		curl_setopt($ch, CURLOPT_POST, 1);
		curl_setopt($ch, CURLOPT_POSTFIELDS, $strData);
	}
	
	$data = curl_exec($ch);
	curl_close($ch);
	
?>

In Firebug I can see all the parameters:

data	<?xml version="1.0" ?><wfs:GetFeature service="WFS" version="1.1.0" outputFormat="text/xml; subtype=gml/3.1.1" xmlns:wfs="http://www.opengis.net/wfs" xmlns:ogc="http://www.opengis.net/ogc" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.1.0/WFS.xsd"><wfs:Query typeName="RecintosSigpac"><PropertyName>msGeometry</PropertyName>  <Filter><Or><And><PropertyIsEqualTo><PropertyName>PROVINCIA</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>MUNICIPIO</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>POLIGONO</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>PARCELA</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>RECINTO</PropertyName><Literal>1</Literal></PropertyIsEqualTo></And><And><PropertyIsEqualTo><PropertyName>PROVINCIA</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>MUNICIPIO</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>POLIGONO</PropertyName><Literal>1</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>PARCELA</PropertyName><Literal>86</Literal></PropertyIsEqualTo><PropertyIsEqualTo><PropertyName>RECINTO</PropertyName><Literal>1</Literal></PropertyIsEqualTo></And></Or></Filter>  </wfs:Query></wfs:GetFeature>
method	POST
url	http://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wfs.map&

And in Apache access.log I get :

192.168.1.65 - - [21/Jun/2010:13:44:56 +0200] "POST /webproxy.php?&url=http%3A%2F%2F192.168.1.65%2Fcgi-bin%2Fmapserv.exe%3Fmap%3D..%2Fhtdocs%2FMFD%2Fejemplo_wfs.map%26&method=POST&data=%3C%3Fxml%20version%3D%221.0%22%20%3F%3E%3Cwfs%3AGetFeature%20service%3D%22WFS%22%20version%3D%221.1.0%22%20outputFormat%3D%22text%2Fxml%3B%20subtype%3Dgml%2F3.1.1%22%20xmlns%3Awfs%3D%22http%3A%2F%2Fwww.opengis.net%2Fwfs%22%20xmlns%3Aogc%3D%22http%3A%2F%2Fwww.opengis.net%2Fogc%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema-instance%22%20xsi%3AschemaLocation%3D%22http%3A%2F%2Fwww.opengis.net%2Fwfs%20..%2Fwfs%2F1.1.0%2FWFS.xsd%22%3E%3Cwfs%3AQuery%20typeName%3D%22RecintosSigpac%22%3E%3CPropertyName%3EmsGeometry%3C%2FPropertyName%3E%0A%09%09%09%09%20%3CFilter%3E%0A%09%09%09%09%09%3COr%3E%0A%09%09%09%09%09%09%3CAnd%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EPROVINCIA%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EMUNICIPIO%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EPOLIGONO%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EPARCELA%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3ERECINTO%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%3C%2FAnd%3E%0A%09%09%09%09%09%09%3CAnd%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EPROVINCIA%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EMUNICIPIO%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EPOLIGONO%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3EPARCELA%3C%2FPropertyName%3E%3CLiteral%3E86%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%3CPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%09%09%3CPropertyName%3ERECINTO%3C%2FPropertyName%3E%3CLiteral%3E1%3C%2FLiteral%3E%0A%09%09%09%09%09%09%09%3C%2FPropertyIsEqualTo%3E%0A%09%09%09%09%09%09%3C%2FAnd%3E%0A%09%09%09%09%09%3C%2FOr%3E%0A%09%09%09%09%3C%2FFilter%3E%20%0A%09%09%09%3C%2Fwfs%3AQuery%3E%3C%2Fwfs%3AGetFeature%3E 

HTTP/1.1" 200 2508

This seems to be OK, isn't it?

Am I doing something wrong with the new request??
 
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 at ikt.es                                web: www.ikt.es
··················································································
_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users



More information about the MapServer-users mailing list