Search code examples
javascriptpythonopenlayersgeoserver

Strange error in WFS request with Openlayers


I have written a script using OpenLayers library to get some layers from Geoserver and display them on the map. I use both WMS and WFS layers. Everything worked fine in my localhost (MAMP) in windows OS. Now I have to migrate in an UBUNTU 12.10 system. Although I get the WMS correctly, I can not make it to get the WFS.

I used firebug and this is the POST request:

<wfs:GetFeature xmlns:wfs="http://www.opengis.net/wfs" service="WFS" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.1.0/wfs.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
 <wfs:Query typeName="rural:foc_network" srsName="EPSG:4326" xmlns:rural="http://www.opengeospatial.net/rural">
 <ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
 <ogc:BBOX>
 <gml:Envelope xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
 <gml:lowerCorner>21.831815896484 37.948519811767</gml:lowerCorner>
 <gml:upperCorner>22.346800027344 38.120181188719</gml:upperCorner>
 </gml:Envelope>
 </ogc:BBOX>
 </ogc:Filter>
 </wfs:Query>
</wfs:GetFeature>

And this the POST response (which is actually the content of my cgi file:

 #!/usr/bin/env python

"""This is a blind proxy that we use to get around browser
restrictions that prevent the Javascript from loading pages not on the
same server as the Javascript.  This has several problems: it's less
efficient, it might break some sites, and it's a security risk because
people can use this proxy to browse the web and p

In the XML tag of firegu I get this error:

 XML Parsing Error: not well-formed Location: moz-nullprincipal:{79ed7c81-0daf-4525-a315-808f0894befd} Line Number 1, Column 2:

 #!/usr/bin/env python

Do you have any idea what is going wrong here? Is the path: #!/usr/bin/env python wrongly set? Or what else could be the problem?

And this is my WFS request:

  wfs_layer_komvoi = new OpenLayers.Layer.Vector("Κόμβοι", {
        strategies: [new OpenLayers.Strategy.BBOX()],
        protocol: new OpenLayers.Protocol.WFS({
                version: "1.1.0",
                url: "http://localhost:8080/geoserver/wfs", 
                featurePrefix: "rural", //workspace from geoserver
                featureType: "komvoi_real", //layer name from geoserver
                        featureNS : "http://www.opengeospatial.net/rural", //namespace from geoserver
                        styles: "point"
                    })
                })

Thanks D.


Solution

  • It seems that the problem is the network. Is there a proxy from geoserver and your application? Have you tried using geoserver interface to display your WFS file instead your application?