I have a problem with WFS request:
var wfs = new OpenLayers.Layer.Vector("WFS",{
strategies: [new OpenLayers.Strategy.Fixed()],
projection: new OpenLayers.Projection("EPSG:4326"),
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
url : "http://localhost:8080/geoserver/wfs",//
featureNS : "http://www.opengeospatial.net/cite", // workspace namespace URI
geometryName: "geom", // field in Feature Type details with type "Geometry"
featurePrefix: 'cite', //geoserver workspace name
featureType: "InfoGeometric" //geoserver Layer Name
}),
In particular in chrome console i have the error POST http:// localhost:8081/cgi-bin/proxy.cgi?url=http%3A%2F%2Flocalhost%3A8080%2Fgeoserver%2Fwfs 404 (Not Found). I have create in C:\Program Files\apache-tomcat-6.0.33\lib the folder cgi-bin and in it the file proxy.cgi (i added in allowedHosts variable values'localhost','localhost:8080','localhost:8081', 'localhost:8080/geoserver/wfs'). In OpenLayers.js i set OpenLayers.ProxyHost="/cgi-bin/proxy.cgi?url="; Now, if i go on http:// localhost:8080/geoserver/wfs/DescribeFeatureType?version=1.1.0&typename=cite:InfoGeometric i have a description in xml of my InfoGeometric but if i go on http:// localhost:8081/cgi-bin/proxy.cgi i don't connect to it. I don't know i must do. Thanks very much.
Best Answer
You first need to configure Tomcat to run CGI scripts. I am assuming you are using the OpenLayers provided proxy.cgi file. This is a Python script so you are going to need to make sure that Python is installed.
To enable CGI in Tomcat you need to check the
{CATALINA_HOME}/conf/web.xml
and remove the comments from around the CGI servlet and servlet-mapping configuration elements.You then need to set the configuration of the CGI servlet to match your system, for example the executable that will run the CGI script, the type of script (default is perl) etc.
The script itself should (by default) be placed in the
WEB-INF/cgi
folder of your web application root folder. This is the default setting but you can change it using thecgiPathPrefix
configuration parameter. The Tomcat documentation page provides more details.