Yeah - I&#39;ve had this problem too.<div><br></div><div>Reordering the attribute fields in postgis has thus far been the only reliable way of ensuring that this does not occur.</div><div>( I could never get that OpenLayers strategy to work for my use-case, but so it goes).</div>

<div><br></div><div>Regrettably, postgres does<a href="http://wiki.postgresql.org/wiki/Alter_column_position"> not support column re-ordering</a> , so the only way is to do it via dropping/recreating columns or tables.</div>

<div><br></div><div>Kind regards,</div><div>Gissur<br><br><div class="gmail_quote">On Sat, Dec 3, 2011 at 12:42 PM, Rahkonen Jukka <span dir="ltr">&lt;<a href="mailto:Jukka.Rahkonen@mmmtike.fi">Jukka.Rahkonen@mmmtike.fi</a>&gt;</span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi,<br>
<br>
Yes, order of attributes does matter in WFS. Here is a part of a FeatureType schema that comes with DescribeFeatureType request<br>
<br>
&lt;xs:complexType name=&quot;osm_pointType&quot;&gt;<br>
&lt;xs:complexContent&gt;&lt;xs:extension base=&quot;gml:AbstractFeatureType&quot;&gt;<br>
&lt;xs:sequence&gt;<br>
&lt;xs:element name=&quot;osm_id&quot; type=&quot;int&quot; nillable=&quot;true&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;<br>
&lt;xs:element name=&quot;note&quot; type=&quot;string&quot; nillable=&quot;true&quot; minOccurs=&quot;0&quot; maxOccurs=&quot;1&quot;/&gt;<br>
...<br>
<br>
List of properities is defined to be &quot;xs:sequence&quot; which means that they must appear in correct order if they are used in the requests which contain XML. The only reliable way for knowing the correct order is to make the client to do DescribeFeatureType and read it from the service.<br>


<br>
GET requests without any XML do not care about the propertyname order and both following requests work.<br>
<br>
<a href="http://188.64.1.61/cgi-bin/tinyows?service=wfs&amp;version=1.0.0&amp;request=GetFeature&amp;typename=lv:mml_railway&amp;BBOX=246700,6780800,436400,6924000&amp;propertyname=sahko,the_geom&amp;maxfeatures=1" target="_blank">http://188.64.1.61/cgi-bin/tinyows?service=wfs&amp;version=1.0.0&amp;request=GetFeature&amp;typename=lv:mml_railway&amp;BBOX=246700,6780800,436400,6924000&amp;propertyname=sahko,the_geom&amp;maxfeatures=1</a><br>


<a href="http://188.64.1.61/cgi-bin/tinyows?service=wfs&amp;version=1.0.0&amp;request=GetFeature&amp;typename=lv:mml_railway&amp;BBOX=246700,6780800,436400,6924000&amp;propertyname=the_geom,sahko&amp;maxfeatures=1" target="_blank">http://188.64.1.61/cgi-bin/tinyows?service=wfs&amp;version=1.0.0&amp;request=GetFeature&amp;typename=lv:mml_railway&amp;BBOX=246700,6780800,436400,6924000&amp;propertyname=the_geom,sahko&amp;maxfeatures=1</a><br>


<br>
However, if the latter is send as http POST it will probably lead to an error because &quot;the_geom&quot; should come after &quot;sahko&quot;.<br>
<br>
-Jukka Rahkonen-<br>
<br>
________________________________<br>
<div><div></div><div class="h5">Nicolás Ardissono wrote:<br>
<br>
I had the same problem, and you have two options to solve it. Because is a field order problem.<br>
Check with pgadmin how your fields are orderer, you have first name and then the_geom, so tinyows doesn&#39;t except anything after the_geom. What you have to do is delete the name field and create it again so it will be after the_geom, with that it works for me.<br>


<br>
Or you can try this script, but not always work:<br>
<br>
/**<br>
 * @requires OpenLayers/Strategy.js<br>
 */<br>
<br>
/**<br>
 * Allow to force the ordering of attributes before saving<br>
 *<br>
 * @class<br>
 */<br>
OpenLayers.Strategy.SaveAttrOrder =<br>
  OpenLayers.Class(OpenLayers.Strategy,<br>
{<br>
<br>
  /**<br>
   * Order of attributes to save.<br>
   *<br>
   * Only the attributes listed here will be saved!<br>
   *<br>
   * @type {Array.&lt;string&gt;}<br>
   */<br>
  order: [],<br>
<br>
  /**<br>
   * Strategy to communicate with for save operation<br>
   *<br>
   * @type {OpenLayers.Strategy.Save}<br>
   */<br>
  saveStrategy: null,<br>
<br>
  /**<br>
   * APIMethod: activate<br>
   * Activate the strategy.  Register any listeners, do appropriate setup.<br>
   *<br>
   * Returns:<br>
   * {Boolean} The strategy was successfully activated.<br>
   */<br>
  activate: function() {<br>
    var activated = OpenLayers.Strategy.prototype.activate.call(this);<br>
    if (activated) {<br>
      this.saveStrategy.events.on({<br>
          start: this.beforeSave,<br>
          scope: this<br>
      });<br>
    }<br>
    return activated;<br>
  },<br>
<br>
  /**<br>
   * APIMethod: deactivate<br>
   * Deactivate the strategy.  Unregister any listeners, do appropriate<br>
   *     tear-down.<br>
   *<br>
   * Returns:<br>
   * {Boolean} The strategy was successfully deactivated.<br>
   */<br>
  deactivate: function() {<br>
    var deactivated = OpenLayers.Strategy.prototype.deactivate.call(this);<br>
    if(deactivated) {<br>
      this.saveStrategy.events.un({<br>
          start: this.beforeSave,<br>
          scope: this<br>
      });<br>
    }<br>
    return deactivated;<br>
  },<br>
<br>
  beforeSave: function(event) {<br>
    var features = event.features;<br>
    features.forEach(dojo.hitch(this, &#39;reorderFeature&#39;));<br>
  },<br>
<br>
  reorderFeature: function(feature) {<br>
    var obj = {};<br>
    this.order.forEach(<br>
        function(attr) {<br>
          if (feature.attributes.hasOwnProperty(attr)) {<br>
            obj[attr] = feature.attributes[attr];<br>
          }<br>
        });<br>
    feature.attributes = obj;<br>
  }<br>
<br>
<br>
<br>
Hope this help<br>
<br>
________________________________<br>
De: Jessica Lapointe &lt;<a href="mailto:jlapointe@mapgears.com">jlapointe@mapgears.com</a>&gt;<br>
Para: <a href="mailto:tinyows-users@lists.maptools.org">tinyows-users@lists.maptools.org</a><br>
Enviado: viernes, 2 de diciembre de 2011 16:41<br>
Asunto: [TinyOWS-users] Problem inserting new features<br>
<br>
Hello,<br>
I&#39;m having trouble in inserting new features in my db. In fact I have<br>
the same problem as described in there:<br>
<a href="http://lists.maptools.org/pipermail/tinyows-users/2010-November/000230.html" target="_blank">http://lists.maptools.org/pipermail/tinyows-users/2010-November/000230.html</a><br>
I use openlayers 2.11 and tinyows trunk revision 615.<br>
<br>
I&#39;m able to update and delete data with no problem. If I insert simple<br>
features containing only geometry it also works. But if my new feature<br>
has data, my xml response in firebug will be &quot;XML request isn&#39;t<br>
valid&quot;. Tinyows&#39; log says :<br>
<br>
[Fri Dec  2 14:30:11 2011] [ERROR] Element &#39;{<a href="http://127.0.0.1/}name" target="_blank">http://127.0.0.1/}name</a>&#39;:<br>
This element is not expected.<br>
<br>
[Fri Dec  2 14:30:11 2011] [ERROR] XML request isn&#39;t valid<br>
<br>
The xml sent to tinyows is the following:<br>
<br>
&lt;wfs:Transaction xmlns:wfs=&quot;<a href="http://www.opengis.net/wfs" target="_blank">http://www.opengis.net/wfs</a>&quot; service=&quot;WFS&quot;<br>
version=&quot;1.0.0&quot; xsi:schemaLocation=&quot;<a href="http://www.opengis.net/wfs" target="_blank">http://www.opengis.net/wfs</a><br>
<a href="http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd" target="_blank">http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd</a>&quot;<br>
xmlns:xsi=&quot;<a href="http://www.w3.org/2001/XMLSchema-instance" target="_blank">http://www.w3.org/2001/XMLSchema-instance</a>&quot;&gt;<br>
&lt;wfs:Insert&gt;<br>
&lt;feature:popplace xmlns:feature=&quot;<a href="http://127.0.0.1/" target="_blank">http://127.0.0.1/</a>&quot;&gt;<br>
&lt;feature:the_geom&gt;<br>
&lt;gml:Point xmlns:gml=&quot;<a href="http://www.opengis.net/gml" target="_blank">http://www.opengis.net/gml</a>&quot; srsName=&quot;EPSG:4326&quot;&gt;<br>
&lt;gml:coordinates decimal=&quot;.&quot; cs=&quot;,&quot; ts=&quot;<br>
&quot;&gt;-45.925780534744,-11.97656750679&lt;/gml:coordinates&gt;<br>
&lt;/gml:Point&gt;<br>
&lt;/feature:the_geom&gt;<br>
&lt;feature:name&gt;test&lt;/feature:name&gt;<br>
&lt;/feature:popplace&gt;<br>
&lt;/wfs:Insert&gt;<br>
&lt;/wfs:Transaction&gt;<br>
<br>
Any help would be appreciated.<br>
_______________________________________________<br>
TinyOWS-users mailing list<br>
</div></div><a href="mailto:TinyOWS-users@lists.maptools.org">TinyOWS-users@lists.maptools.org</a>&lt;mailto:<a href="mailto:TinyOWS-users@lists.maptools.org">TinyOWS-users@lists.maptools.org</a>&gt;<br>
<a href="http://lists.maptools.org/mailman/listinfo/tinyows-users" target="_blank">http://lists.maptools.org/mailman/listinfo/tinyows-users</a><br>
<div><div></div><div class="h5"><br>
<br>
_______________________________________________<br>
TinyOWS-users mailing list<br>
<a href="mailto:TinyOWS-users@lists.maptools.org">TinyOWS-users@lists.maptools.org</a><br>
<a href="http://lists.maptools.org/mailman/listinfo/tinyows-users" target="_blank">http://lists.maptools.org/mailman/listinfo/tinyows-users</a><br>
</div></div></blockquote></div><br><br clear="all"><div><br></div>-- <br>Gissur Þórhallsson<br><br>Loftmyndir ehf.<br>Laugavegur 13<br>IS 101 Reykjavík - Iceland<br>sími (tel): (+354) 540 2500<br>tölvupóstur (email): <a href="mailto:gissur@loftmyndir.is">gissur@loftmyndir.is</a><br>


</div>