[OpenLayers-Users] Strange behaviour withOpenLayers.Request.POST and MapServer

David Alda Fernandez de Lezea dalda at ikt.es
Tue Jun 22 03:19:30 EDT 2010


 
David,

Thanks for your response. The strange thing is that I've got a TEMPLATE defined at Layer level in MapServer's mapfile:

LAYER
			DEBUG 5
			NAME "RecintosSigpac"
			PROJECTION
				"init=epsg:23030"
			END
			METADATA
				"wfs_title" "Recintos Sigpac 2009" ## REQUIRED
				"wfs_abstract" "Recintos"
				"wfs_name" "RecintosSigpac"
				"wfs_geometry_element_name" "MS_GEOMETRY"
				"wfs_srs" "EPSG:23030" ## Recommended
				"wfs_extent"          "463506.9978541628 4702558.185239193 603185.4988525142 4811754.780732273"
				"gml_featureid" "gid" ## REQUIRED
				"gml_include_items"	"all"
			END
			TYPE POLYGON
			
			CONNECTIONTYPE oraclespatial
			CONNECTION "admcarto/admcarto at ORA10GEX"
			
			DATA "GEOMETRY FROM (SELECT * FROM GT_SIGPAC_REC_2010_ED50) USING UNIQUE gid SRID 82337" #todo el sigpac
			
			DUMP TRUE ## REQUIRED
			
			CLASS
				NAME "Recintos"
				STYLE
					OUTLINECOLOR 255 255 255
				END
				TEMPLATE "ms_template.html"
			END
			
			
			STATUS ON
		END # Layer

The thing is that with the following instruction:

OpenLayers.Request.POST({url: this.onlineResource, callback: callbackFunction, data: filter});

Having this.onlineResource = http://192.168.1.65/cgi-bin/mapserv.exe?map=../htdocs/MFD/ejemplo_wfs.map&
data = filter for getFeature Request

I don't have any troubles, I get the features correctly. But when I try to make the same request over the proxy, that's when then troubles come:

OpenLayers.Request.POST({url: networkSettings.proxyURL, callback: callbackFunction, params: {url: this.onlineResource, method: "POST", data: filter}});

Having:

networkSettings.proxyURL = http://192.168.1.65/webproxy.php?
filter = filter for getFeature Request

I've tried, also, to use the parameter proxy but without success, in fact, I don't get anything, no error, no response, nothing at all.

Apache log:

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

Maybe there is something wrong with webproxy.php???

Thanks in advance.

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 Users mailing list