[TinyOWS-users] Problem inserting new features

Nicolás Ardissono nicolasardissono at yahoo.com.ar
Fri Dec 2 15:35:19 EST 2011

I had the same problem, and you have two options to solve it. Because is a field order problem.
Check with pgadmin how your fields are orderer, you have first name and then the_geom, so tinyows doesn'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.

Or you can try this script, but not always work:

 * @requires OpenLayers/Strategy.js

 * Allow to force the ordering of attributes before saving
 * @class
OpenLayers.Strategy.SaveAttrOrder =

   * Order of attributes to save.
   * Only the attributes listed here will be saved!
   * @type {Array.<string>}
  order: [],

   * Strategy to communicate with for save operation
   * @type {OpenLayers.Strategy.Save}
  saveStrategy: null,

   * APIMethod: activate
   * Activate the strategy.  Register any listeners, do appropriate setup.
   * Returns:
   * {Boolean} The strategy was successfully activated.
  activate: function() {
    var activated = OpenLayers.Strategy.prototype.activate.call(this);
    if (activated) {
          start: this.beforeSave,
          scope: this
    return activated;

   * APIMethod: deactivate
   * Deactivate the strategy.  Unregister any listeners, do appropriate
   *     tear-down.
   * Returns:
   * {Boolean} The strategy was successfully deactivated.
  deactivate: function() {
    var deactivated = OpenLayers.Strategy.prototype.deactivate.call(this);
    if(deactivated) {
          start: this.beforeSave,
          scope: this
    return deactivated;

  beforeSave: function(event) {
    var features = event.features;
    features.forEach(dojo.hitch(this, 'reorderFeature'));

  reorderFeature: function(feature) {
    var obj = {};
        function(attr) {
          if (feature.attributes.hasOwnProperty(attr)) {
            obj[attr] = feature.attributes[attr];
    feature.attributes = obj;

Hope this help

 De: Jessica Lapointe <jlapointe at mapgears.com>
Para: tinyows-users at lists.maptools.org 
Enviado: viernes, 2 de diciembre de 2011 16:41
Asunto: [TinyOWS-users] Problem inserting new features
I'm having trouble in inserting new features in my db. In fact I have
the same problem as described in there:
I use openlayers 2.11 and tinyows trunk revision 615.

I'm able to update and delete data with no problem. If I insert simple
features containing only geometry it also works. But if my new feature
has data, my xml response in firebug will be "XML request isn't
valid". Tinyows' log says :

[Fri Dec  2 14:30:11 2011] [ERROR] Element '{}name':
This element is not expected.

[Fri Dec  2 14:30:11 2011] [ERROR] XML request isn't valid

The xml sent to tinyows is the following:

<wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs" service="WFS"
version="1.0.0" xsi:schemaLocation="http://www.opengis.net/wfs
<feature:popplace xmlns:feature="">
<gml:Point xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4326">
<gml:coordinates decimal="." cs="," ts="

Any help would be appreciated.
TinyOWS-users mailing list
TinyOWS-users at lists.maptools.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.maptools.org/pipermail/tinyows-users/attachments/20111202/ec6fb256/attachment.html 

More information about the TinyOWS-users mailing list