<!DOCTYPE html PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
<html><head><meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<style>BODY{font:10pt Tahoma,Verdana,sans-serif} .MsoNormal{line-height:120%;margin:0}</style></head><body>
Hi!<br><br>This isn't the first question here about inserting features in TinyOWS, but I haven't found solution to my problem in archives.<br><br>The working environment is OpenLayers 2.13dev + TinyOWS from github + PostGIS 2.0 + PostgreSQL 9.2<br><br>Relevant js-code is:<br><br>    var POINT = 1;<br>    var save_objs_strategy = new OpenLayers.Strategy.Save(<br>    { "saves_what": "cities" });<br>    var cities = new OpenLayers.Layer.Vector(<br>    'Города', {<br>        strategies: [new OpenLayers.Strategy.BBOX(), <br>             save_objs_strategy],<br>        protocol: new OpenLayers.Protocol.WFS(<br>        {<br>            version: "1.1.0",<br>            url: "http://localhost/mapserver/tinyows",<br>            featureType: "cities",<br>            featureNS: "http://www.tinyows.org",<br>            geometryName: "geom",<br>            outputFormat: "JSON",<br>            schema: "http://localhost/mapserver/tinyows?service=wfs&amp;request=DescribeFeatureType&amp;version=1.1.0&amp;typename=tows:cities"<br>        })<br>    }<br>    );<br><br>    var draw = new OpenLayers.Control.DrawFeature(<br>    cities, OpenLayers.Handler.Point,<br>    {<br>            title: "Создание объектов",<br>            displayClass: "olControlDrawFeaturePoint"<br>    }<br>    );<br>    draw.events.on(<br>    {<br>        "featureadded": function(e) {<br>        var attrs = e.feature.attributes;<br>        attrs.pop_hk = 99;<br>        attrs.city_name = "Новый город";<br>        attrs.type_id = POINT;<br>        save_objs_strategy.save();<br>        }<br>    });<br><br>Adding a vector point feature (city) somewhere on the map creates the following XML request to tinyows:<br><div role="presentation" class="nodeBox open  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><br><<span class="nodeTag ">wfs:Transaction</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">xmlns:wfs</span>="<span class="nodeValue editable ">http://www.opengis.net/wfs</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">service</span>="<span class="nodeValue editable ">WFS</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">version</span>="<span class="nodeValue editable ">1.1.0</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">xsi:schemaLocation</span>="<span class="nodeValue editable ">http://www.opengis.net/wfs
 http://schemas.opengis.net/wfs/1.1.0/wfs.xsd http://www.tinyows.org 
http://localhost/mapserver/tinyows?service=wfs&amp;request=DescribeFeatureType&amp;version=1.1.0&amp;typename=tows:cities</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">xmlns:xsi</span>="<span class="nodeValue editable ">http://www.w3.org/2001/XMLSchema-instance</span>"</span><span class="nodeBracket ">></span></span></div><div role="group" class="nodeChildBox "><div role="presentation" class="nodeBox open  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">wfs:Insert</span><span class="nodeBracket ">></span></span></div><div role="group" class="nodeChildBox "><div role="presentation" class="nodeBox open  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">feature:cities</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">xmlns:feature</span>="<span class="nodeValue editable ">http://www.tinyows.org</span>"</span><span class="nodeBracket ">></span></span></div><div role="group" class="nodeChildBox "><div role="presentation" class="nodeBox open  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">feature:geom</span><span class="nodeBracket ">></span></span></div><div role="group" class="nodeChildBox "><div role="presentation" class="nodeBox open  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">gml:Point</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">xmlns:gml</span>="<span class="nodeValue editable ">http://www.opengis.net/gml</span>"</span><span class="nodeAttr editGroup "> <span class="nodeName editable ">srsName</span>="<span class="nodeValue editable ">EPSG:4326</span>"</span><span class="nodeBracket ">></span></span></div><div role="group" class="nodeChildBox "><div role="presentation" class="nodeBox textNodeBox  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">gml:pos</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable "><span class="  ">37.962548828124 55.22265625</span></span></<span class="nodeTag ">gml:pos</span>></span></div></div></div><div role="presentation" class="nodeCloseLabel "></<span class="nodeTag ">gml:Point</span>></div></div></div><div role="presentation" class="nodeCloseLabel "></<span class="nodeTag ">feature:geom</span>></div></div><div role="presentation" class="nodeBox textNodeBox  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">feature:pop_hk</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable "><span class="  ">99</span></span></<span class="nodeTag ">feature:pop_hk</span>></span></div></div><div role="presentation" class="nodeBox textNodeBox  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">feature:city_name</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable "><span class="  ">Новый город</span></span></<span class="nodeTag ">feature:city_name</span>></span></div></div><div role="presentation" class="nodeBox textNodeBox  "><div role="presentation" class="nodeLabel "><span role="treeitem" class="nodeLabelBox repTarget "><<span class="nodeTag ">feature:type_id</span><span class="nodeBracket editable insertBefore ">></span><span class="nodeText editable "><span class="  ">1</span></span></<span class="nodeTag ">feature:type_id</span>></span></div></div></div><div role="presentation" class="nodeCloseLabel "></<span class="nodeTag ">feature:cities</span>></div></div></div><div role="presentation" class="nodeCloseLabel "></<span class="nodeTag ">wfs:Insert</span>></div></div></div><div role="presentation" class="nodeCloseLabel "></<span class="nodeTag ">wfs:Transaction</span>></div></div><br>The request fails with the following string in tinyows.log:<br><br>[Wed Nov  7 19:55:01 2012] [ERROR] Element '{http://www.tinyows.org}cities': This element is not expected. Expected is one of ( {http://www.opengis.net/gml}_Feature, {http://www.opengis.net/gml}FeatureCollection, {http://www.opengis.net/gml}MultiPointCoverage, {http://www.opengis.net/gml}MultiCurveCoverage, {http://www.opengis.net/gml}MultiSurfaceCoverage, {http://www.opengis.net/gml}MultiSolidCoverage, {http://www.opengis.net/gml}GridCoverage, {http://www.opengis.net/gml}RectifiedGridCoverage, {http://www.opengis.net/gml}Observation, {http://www.opengis.net/gml}DirectedObservation ).<br><br>This seems a little bit cryptic to me because the "schema" parameter in js-code (http://localhost/mapserver/tinyows?service=wfs&amp;request=DescribeFeatureType&amp;version=1.1.0&amp;typename=tows:cities) returns the following xsd:<br><br><xs:schema targetNamespace="http://www.tinyows.org/" elementFormDefault="qualified" version="1.1"><xs:import namespace="http://www.opengis.net/gml" schemaLocation="http://schemas.opengis.net/gml/3.1.1/base/gml.xsd"/><xs:element name="cities" type="tows:citiesType" substitutionGroup="gml:_Feature"/><xs:complexType name="citiesType"><xs:complexContent><xs:extension base="gml:AbstractFeatureType"><xs:sequence><xs:element name="pop_hk" type="int" nillable="true" minOccurs="0" maxOccurs="1"/><xs:element name="city_name" nillable="false" minOccurs="1" maxOccurs="1"><xs:simpleType><xs:restriction base="string"><xs:maxLength value="100"/></xs:restriction></xs:simpleType></xs:element><xs:element name="geom" type="gml:PointPropertyType" nillable="true" minOccurs="0" maxOccurs="1"/><xs:element name="type_id" type="int" nillable="true" minOccurs="0" maxOccurs="1"/></xs:sequence></xs:extension></xs:complexContent></xs:complexType></xs:schema><br><br>and this xsd should make tinyows use element '{http://www.tinyows.org}cities' like '{http://www.opengis.net/gml}_Feature'<br><br>Where am I wrong and what should be changed in my setup?<br><br>Best regards,<br>Timur Sufiev<br></body></html>