I struggle getting a WFS overlay from geoserver to work. I think I meet all the requirements for the WFS to be displayed in my map, but the request seems to get stuck somewhere... FireBug gives the error-message:
Access to restricted URI denied" code: "1012
http://www.openlayers.org/api/OpenLayers.js
Line 1188
whereas Line 1188 contains the following:
this._object.send(vData);if(bGecko&&!this._async){this.readyState=cXMLHttpRequest.OPENED;
fSynchronizeValues(this)while(this.readyState<cXMLHttpRequest.DONE)
{this.readyState++;fReadyStateChange(this);if(this._aborted)
The whole applications are running on localhost, I installed Apache Webserver and configured a proxy since that was recommended in most Threads concerning WFS running on localhost. I used the proxy.cgi from http://trac.osgeo.org/openlayers/browser/trunk/openlayers/examples/proxy.cgi and allowed access for 'localhost','localhost:80' and 'localhost:8080'same with my IP (IP, IP:80, IP:8080).
When I visit localhost/cgi-bin/proxy.cgi I get to see the OpenLayers Page so that should be working! My WFS Variable looks like this:
var wfs = new OpenLayers.Layer.Vector("WFS", {
strategies: [new OpenLayers.Strategy.Fixed()],
protocol: new OpenLayers.Protocol.WFS({
version: "1.1.0",
url: "http://localhost:8080/geoserver/wfs",
featurePrefix: "workspacename",
featureType: "layername",
featureNS: "http://lvr", [tried many, it doesn´t need to be an existing URL right?]
srsName: "EPSG:4326",
geometryName: "the_geom"
})
});
then I set
OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url=";
Is that one complete and where do I put it in the map document? Can anybody help? Tried a lot of options, nothing really helped but it seems like it´s some connection/security issue rather than smth related to the map script itself... Do I neccesarily need a format variable, a schema location or a stylemap? Anything else important missing?
Update from comments:
I can open it, typing localhost:8080/map.html... And when I just did that, the WFS data showed up!
Can´t believe it - I just accessed the html wrongly?! Beginners mistake. Thanks geographika...