Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

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...

share|improve this question

2 Answers 2

up vote 0 down vote accepted

A quick solution which avoids the need for proxies while testing is to put your web pages in the www directory of your GeoServer data directory. The page will then be served through the same port and host as your WFS and all will work fine.

Ultimately you will need a proxy if (and only if) you move the web pages to some other location.

share|improve this answer

The error indicates a cross-domain issue.

How are you accessing your site? Through http://localhost:80 or http://localhost:8080? And where is your proxy hosted? It should match the location and port of your site.

You say you are running the application locally, but your FireBug message implies you are using the OpenLayers Javascript hosted at: http://www.openlayers.org/api/OpenLayers.js

The alternative is to download and host the JavaScript and CSS files yourself from http://openlayers.org/download/

This shouldn't make a difference however.

share|improve this answer
    
I´m accessing the geoserver from localhost:8080 and my proxy is hosted in the Apache/cgi-bin/ directory. I also added the required lines to the httpd.conf file of Apache... I use the OL script hosted by OpenLayers, what´s the alternative? Thanks for the help! –  philippe Aug 19 '11 at 16:07
    
Did you follow the instructions outlined at gis.stackexchange.com/questions/4323/… –  geographika Aug 19 '11 at 16:50
    
BTW, when typing this: "localhost:8080/geoserver/…; into Firefox, I get a full xml response, listing all the features in the dataset... When I get it right, this means that the WFS is accessible. Any other information I could post to make it clearer? –  philippe Aug 19 '11 at 17:30
    
No, I mostly followed trac.osgeo.org/openlayers/wiki/… to set up the proxy. Since I´m quite new to these issues, the thread appears cryptic but also doesn´t seem to fulfill my wishes. Can it be that just getting a WFS to run is that complicated? I just have a html Document on my local machine, trying to access data from geoserver which is running on localhost:8080... –  philippe Aug 19 '11 at 17:46
1  
Thanks for being patient - my proxy can be accessed via localhost/cgi-bin/proxy.cgi, I access the html document via Windows Explorer, it is saved in a directory like C:/Users/Me/WebMap/map.html, which is configured as document root in the apache config. 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... –  philippe Aug 19 '11 at 21:36

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.