[mapserver-users] TinyOWS insert feature not working

Jiří Kadlec jirikadlec2 at gmail.com
Thu Jan 23 05:08:14 PST 2014


Hi, Thanks for the sample wfs link and for the Kosmo GIS suggestion.

I found a temporary workaround for my problem.
In the tinyows.xml file I added a setting: check_schema="0". Now adding new
features works like charm with OpenLayers and with QGIS.

So, it seems that my error is somehow related to "schema validation". When
I looked at my insert request, I found that the xsi:schemaLocation is
different from your example. In my error case it is:


   1. xsi:schemaLocation="http://www.opengis.net/wfs
   http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="
   http://www.w3.org/2001/XMLSchema-instance"


But in your working example it is:

      xsi:schemaLocation="http://www.opengis.net/wfs
http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
http://hip.latuviitta.org/cgi-bin/tinyows?SERVICE=WFS&REQUEST=DescribeFeatureType&version=1.0.0&TYPENAME=lv:editable_multipolygons&NAMESPACE=xmlns(lv=http://latuviitta.fi/)<http://hip.latuviitta.org/cgi-bin/tinyows?SERVICE=WFS&REQUEST=DescribeFeatureType&version=1.0.0&TYPENAME=lv:editable_multipolygons&NAMESPACE=xmlns(lv=http://latuviitta.fi/)>
 http://latuviitta.fi/"

So, it seems that I'm missing some parts of the xsi:schemaLocation
attribute such as TYPENAME and NAMESPACE.
Any ideas what the xsi:schemaLocation means? Is this somehow related to the
schema_dir, ns_prefix and ns_uri settings in my tinyows.xml file? I'm
really quite confused what the schema, prefix and namespace in the wfs come
from.

--Jiri


On Thu, Jan 23, 2014 at 7:56 AM, Rahkonen Jukka (Tike) <
jukka.rahkonen at mmmtike.fi> wrote:

>  Hi,
>
> You can try if you can have success with my server
> http://hip.latuviitta.org/cgi-bin/tinyows
> Kosmo GIS which is an excellent open source GIS client for WFS creates the
> following request. Compare and see if you'll find something interesting.
>
>
> <?xml version='1.0' encoding='UTF-8'?>
> <wfs:Transaction version="1.0.0" service="WFS" xmlns:lv="
> http://latuviitta.fi/"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:ogc="http://www.opengis.net/ogc"
> xmlns:wfs="http://www.opengis.net/wfs"
> xmlns:xlink="http://www.w3.org/1999/xlink"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> xsi:schemaLocation="http://www.opengis.net/wfs
> http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd
> http://hip.latuviitta.org/cgi-bin/tinyows?SERVICE=WFS&REQUEST=DescribeFeatureType&version=1.0.0&TYPENAME=lv:editable_multipolygons&NAMESPACE=xmlns(lv=http://latuviitta.fi/)<http://hip.latuviitta.org/cgi-bin/tinyows?SERVICE=WFS&REQUEST=DescribeFeatureType&version=1.0.0&TYPENAME=lv:editable_multipolygons&NAMESPACE=xmlns(lv=http://latuviitta.fi/)>
> http://latuviitta.fi/">
> <wfs:Insert handle="insert1" idgen="GenerateNew">
> <lv:editable_multipolygons xmlns:lv="http://latuviitta.fi/">
> <lv:geom><gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml"
> srsName="EPSG:3067">
> <gml:polygonMember>
> <gml:Polygon xmlns:gml="http://www.opengis.net/gml"
> srsName="EPSG:3067">
> <gml:outerBoundaryIs>
> <gml:LinearRing>
> <gml:coordinates>195203.757,7279828.574 225034.737,7307065.556
> 262647.711,7278531.575 260053.713,7238324.602 217252.742,7242215.6
> 195203.757,7279828.574
> </gml:coordinates>
> </gml:LinearRing>
> </gml:outerBoundaryIs>
> </gml:Polygon>
> </gml:polygonMember>
> </gml:MultiPolygon>
> </lv:geom>
> </lv:editable_multipolygons>
> </wfs:Insert>
> </wfs:Transaction>
>
> -Jukka Rahkonen-
>
>
>
>  Jiří Kadlec wrote:
>
>   > I have installed and set-up TinyOWS for editing features from PostGIS
> database on a RHEL6 Linux server.
> > Displaying features is working OK in QGIS and in Openlayers.
>  > Editing a feature also works correctly.
> > However, when I try to insert a new feature I get the following error
> response:
>
>  <?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 Request payload that gets posted to TinyOWS:
>
>    1. <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs"
>    service="WFS" version="1.0.0" xsi:schemaLocation="
>    http://www.opengis.net/wfs
>    http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" xmlns:xsi="
>    http://www.w3.org/2001/XMLSchema-instance"><wfs:Insert><feature:mk_city_centre
>    xmlns:feature="https://geoinformatics.aalto.fi/"><feature:the_geom3857><gml:MultiPolygon
>    xmlns:gml="http://www.opengis.net/gml"
>    srsName="EPSG:3857"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates
>    decimal="." cs="," ts=" ">2852436.2002366,8629373.6312116
>    2851633.6114397,8628494.6053864 2850678.1485863,8629067.8830985
>    2850563.4930439,8630176.2200085
>    2852436.2002366,8629373.6312116</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></feature:the_geom3857></feature:mk_city_centre></wfs:Insert></wfs:Transaction>
>
>
>
>
>  --
> My TinyOWS error log shows:
>
>
>    1.
>    2. [Thu Jan 23 04:45:19 2014] [ERROR] Element '{
>    http://www.w3.org/2001/XMLSchema}import': Failed to locate a schema at
>    location '
>    https://geoinformatics.aalto.fi/kala/tinyows.cgi?service=WFS&request=DescribeFeatureType&version=1.0.0'.
>    Skipping the import.
>    3.
>    4. [Thu Jan 23 04:45:19 2014] [ERROR] Element '{
>    https://geoinformatics.aalto.fi/}mk_city_centre': This element is not
>    expected. Expected is one of ( {http://www.opengis.net/gml}_Feature, {
>    http://www.opengis.net/wfs}FeatureCollection ).
>    5.
>    6. [Thu Jan 23 04:45:19 2014] [ERROR] XML request isn't valid
>    7.
>
>
>
>
> Here's my tinyows.xml configuration file:
>
>  <tinyows online_resource="
> https://geoinformatics.aalto.fi/kala/tinyows.cgi"
>          schema_dir="/usr/local/share/tinyows/schema/"
>          log="/tmp/tinyows.log"
>          log_level="1">
>   <pg host="localhost" user="postgres" password="*********" dbname="LAHTI"
> port="5432"/>
>
>    <metadata name="TinyOWS Server"
>             title="Lahti Urban  WFS Server" />
>
>    <layer retrievable="1"
>          writable="1"
>          ns_prefix="tows"
>          ns_uri="https://geoinformatics.aalto.fi/"
>          name="subwatersheds"
>          title="subwatersheds" />
>
>   <layer retrievable="1"
>          writable="1"
>          ns_prefix="tows"
>          ns_uri="https://geoinformatics.aalto.fi/"
>          name="mk_city_centre"
>          title="Lahti City Centre"
>          exclude_items="the_geom3880" />
>  </tinyows>
>
>  And finally, here is my OpenLayers editing client javascript code
> snippet:
>
>   var saveStrategy = new OpenLayers.Strategy.Save();
>   saveStrategy.events.register("success", '', showSuccessMsg);
>   saveStrategy.events.register("fail", '', showFailureMsg);
>   wfs = new OpenLayers.Layer.Vector("Editable Features", {
>       strategies: [new OpenLayers.Strategy.BBOX(), saveStrategy],
>       projection: new OpenLayers.Projection("EPSG:3857"),
>       protocol: new OpenLayers.Protocol.WFS({
>           version: "1.0.0",
>           srsName: "EPSG:3857",
>           url: "https://geoinformatics.aalto.fi/kala/tinyows.cgi",
>           featureNS :  "https://geoinformatics.aalto.fi/",
>           featureType: "mk_city_centre",
>           geometryName: "the_geom3857"
>           //schema: "
> https://geoinformatics.aalto.fi/kala/tinyows.cgi?service=wfs&version=1.0.0&request=DescribeFeatureType&typeName=tows:mk_city_centre
> "
>       })
>   });
>
>
>  I've never used TinyOWS before. Any Ideas what I'm doing wrong?
> Especially the error message
> Element '{https://geoinformatics.aalto.fi/}mk_city_centre': This element
> is not expected. Expected is one of ( {http://www.opengis.net/gml}_Feature,
> {http://www.opengis.net/wfs}FeatureCollection ).
>
> is confusing.
>
>  Thanks in advance for any hints or suggestions how to solve the problem.
>
>  Jiri Kadlec
>



-- 
Jiří Kadlec
Research Assistant
Aalto university
Lahti, Finland
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20140123/a8ce93de/attachment-0001.html>


More information about the mapserver-users mailing list