[OpenLayers-Users] WFS exception

Guillaume Sueur guillaume.sueur at neogeo-online.net
Fri Mar 14 02:51:27 EDT 2008


Hi Matthew,

It's a normal Ajax Exception which disallows cross-domain requests. The 
WFS server is probably different than your http server.
You should set a proxy file requester on your web server which will 
receive and forward requests and responses.
For few clues, see
http://trac.openlayers.org/wiki/FrequentlyAskedQuestions#ProxyHost
http://gist.fas.harvard.edu/chgis/?p=14

Have a nice day.

Guillaume


Matthew Doyle a écrit :
> Hi All,
> 
> I am relatively new to OpenLayers, so please forgive me if this is a simple
> one.
> 
> I have an instance of OpenLayers 2.5 on my dev server which is happily
> loading 3 WMS layers served by MapServer. 
> Now i have come to include a WFS layer of point based station data (simliar
> to towns), which i have tested as a working layer through uDig, but when i
> attempt to include it as a WFS layer in OpenLayers i get the following
> exception thrown (in firebug):
> ---------------------------------------------
> [Exception... "'Permission denied to call method XMLHttpRequest.open' when
> calling method: [nsIDOMEventListener::handleEvent]" nsresult: "0x8057001e
> (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" data: no
> emptyFunction()
> getImagesLocation()
> emptyFunction()
> dispatch("http://ows.bom.gov.au/cgi-bin/mapserver/users/ncc000/latest?typename=IDY03101_metarid&SERVICE=WFS&VE...",
> Object method=get)
> Class()
> nullHandler("http://ows.bom.gov.au/cgi-bin/mapserver/users/ncc000/latest?typename=IDY03101_metarid&SERVICE=WFS&VE...",
> null, Object layer=Object position=x=-400,y=-300, function(),
> undefined)OpenLayers.js 
> loadFeaturesForRegion(function(), undefined)
> ---------------------------------------------
> 
> 
> my code is as follows - the variable of interest being stationIDLayer with
> {typename:'IDY03101_metarid'}  
> 
> 
> <script type="text/javascript">
> 
> function init() {
> 
>     var map = new OpenLayers.Map('map',{maxResolution: 0.703125} );
>     var serviceURL =
> "http://ows.bom.gov.au/cgi-bin/mapserver/users/ncc000/latest?";
> 
>     var topogLayer = new OpenLayers.Layer.WMS('Aus 10M Elevation',
> serviceURL, {layers: 'free_elevation', format: 'image/png' }, {buffer: 1,
> isBaseLayer:true} );
>      var ausCoastlineLayer = new OpenLayers.Layer.WMS('Aus Coastline',
> serviceURL, {layers: 'free_australia_line', transparent: 'true', format:
> 'image/gif' }, {buffer: 1, isBaseLayer: false} );
>      var rainfallPolygonLayer = new OpenLayers.Layer.WMS('Rainfall Polygon',
> serviceURL, {layers: 'rainfall_polygon', format: 'image/png' }, {buffer: 1,
> isBaseLayer:false} );
>      map.addLayers([topogLayer, rainfallPolygonLayer, ausCoastlineLayer]);
> 
>      var stationIDLayer = new OpenLayers.Layer.WFS('Station ID', serviceURL,
> {typename: 'IDY03101_metarid'},
>        {
>             minZoomLevel: 4,
>             featureNS: 'http://www.openplans.org/topp',
>             extractAttributes: false
>        } );
>      map.addLayer(stationIDLayer);
>  
>  
>      map.addControl(new OpenLayers.Control.LayerSwitcher());
>      map.addControl(new OpenLayers.Control.MousePosition());
>      map.addControl(new OpenLayers.Control.OverviewMap());
>      map.addControl(new OpenLayers.Control.PanZoomBar());   
> 
>      // Set original zoom extent to just cover Australia 
>      map.zoomToExtent(new OpenLayers.Bounds(110.0,-5.0,160.0,-50.0));
>  
>      // avoid pink tiles
>      OpenLayers.IMAGE_RELOAD_ATTEMPTS = 3;
> 
>  
> }
> 
> </script>  
> 
> 
> Is my syntax incorrect? Or am i missing some parameter during the creation
> of the WFS layer? 
> 
> Many thanks in advance. Once again i am new to OL and apologise for any
> simple error. Also, if there are any simple tutorials or good examples on
> the correct usage of WFS layers, could you please link me to one? 
> 
> Cheers and regards,
> Matt
> 





More information about the Users mailing list