1

I've got a TinyOWS on localhost that works fine (both through browser GetFeature and QGIS). But my OpenLayers code fails. I've checked here: Display a WFS layer with OpenLayers and here : How to add a simple WFS layer from GeoServer to OpenLayers map? and other similar questions to no avail. Can anyone help?

Here is the code:

    wfs = new OpenLayers.Layer.Vector("Editable Features", {
    strategies : [new OpenLayers.Strategy.Fixed(), saveStrategy],
    projection: new OpenLayers.Projection("EPSG:4326"),
    protocol: new OpenLayers.Protocol.WFS({
        version: "1.1.0",
        srsName: "EPSG:4326",
        url: "http://localhost/cgi-bin/tinyows",
        featurePrefix: "tows",
        featureNS :  "http://www.tinyows.org/",
        featureType: "trad",
        geometryName: "wkb_geometry",
        schema: "http://127.0.0.1/cgi-bin/tinyows?service=WFS&version=1.1.0&request=DescribeFeatureType&Typename=tows:trad"
    })
}); 

map.addLayers([gphy, wfs]);

Here is the xml according to Firebug:

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

Here is the post response according to firebug:

<?xml version='1.0' encoding='UTF-8'?>
<ows:ExceptionReport
  xmlns='http://www.opengis.net/ows'
  xmlns:ows='http://www.opengis.net/ows'
  xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'
  xsi:schemaLocation='http://www.opengis.net/ows http://schemas.opengis.net/ows/1.0.0/owsExceptionReport.xsd'
  version='1.1.0' language='en'>
<ows:Exception exceptionCode='InvalidParameterValue' locator='request'>
<ows:ExceptionText>XML request isn't valid</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

Here is the TinyOWS config file:

<tinyows online_resource="http://127.0.0.1/cgi-bin/tinyows"
     schema_dir="/usr/local/tinyows/schema/">
<pg host="127.0.0.1" user="postgres" password="****" dbname="****" port="5432"/>
<metadata name="TinyOWS Server"
       title="TinyOWS Server - Demo Service" />
<layer retrievable="1"
    writable="1"
    ns_prefix="tows"
    ns_uri="http://www.tinyows.org/"
    name="trad"
    title="Träd" />
</tinyows>
user10895
  • 71
  • 1
  • 6

2 Answers2

1

In your TinyOWS config you write online_resource="http://127.0.0.1/cgi-bin/tinyows" but in OpenLayers you use another host name - http://localhost/cgi-bin/tinyows. This mismatch causes an error.

drnextgis
  • 6,938
  • 2
  • 29
  • 49
  • tried that - made no difference. – user10895 Mar 11 '13 at 06:52
  • Try to move schema option from WFS protocol config. – drnextgis Mar 11 '13 at 08:08
  • Ok, can you clarify - are you talking about the tinyows config file or the javascript? – user10895 Mar 11 '13 at 08:41
  • OpenLayers javascript – drnextgis Mar 11 '13 at 11:07
  • Ok, thanks, do you mean REMOVE or change the schema? If change, what to? – user10895 Mar 11 '13 at 11:44
  • Simple remove this option. – drnextgis Mar 11 '13 at 11:46
  • Nope, no difference, the xml resonse is still saying exceptionCode='InvalidParameterValue' locator='request' – user10895 Mar 11 '13 at 11:57
  • In this case try to debug your system using log and log_level options of TinyOWS. – drnextgis Mar 11 '13 at 14:26
  • Thanks for the help drnextgis - here's the important part of the logfile: [Mon Mar 11 17:00:25 2013] [ERROR] local list type: A type, derived by list or union, must have the simple ur-type definition as base type, not '{http://www.opengis.net/gml}doubleOrNullList'.

    [Mon Mar 11 17:00:25 2013] [ERROR] local list type: A type, derived by list or union, must have the simple ur-type definition as base type, not '{http://www.opengis.net/gml}NameOrNullList'.

    [Mon Mar 11 17:00:25 2013] [ERROR] XML request isn't valid

    – user10895 Mar 11 '13 at 16:06
  • Looks like it might be a LibXML2 problem? (I've got 2.7.8 on Ubuntu 12.04) http://mapserver.org/tinyows/libxmlschemagmlbug.html – user10895 Mar 11 '13 at 22:09
0

Oops - turns out I had the wrong schema_dir in tinyows.xml. I changed /usr/local/tinyows/schema/ to /usr/share/tinyows/schema and now it's loading fine. Maybe someone could update the config file example on http://mapserver.org/tinyows/configfile.html ?

user10895
  • 71
  • 1
  • 6