Geoserver comes with a simple wfs-t example (wfs-t.html). I tested it, and it works when those layers it calls are shapefiles. However, when I move layers to a postgis database and make some fixes to code (namespace etc), location information does not go to database, although I get SUCCES-feedback from transaction. Can anyone explain why this happens. I can add data to the same layer (tasmania_cities) with another wfst-t app, but not with the one, that comes with Geoserver.
Geoserver version 2.3.5
Oiva
On Thu, Oct 24, 2013 at 9:29 AM, Hakala Oiva (MTT) <oiva.hakala@anonymised.com>wrote:
Geoserver comes with a simple wfs-t example (wfs-t.html). I tested it,
and it works when those layers it calls are shapefiles. However, when I
move layers to a postgis database and make some fixes to code (namespace
etc), location information does not go to database, although I get
SUCCES-feedback from transaction. Can anyone explain why this happens. I
can add data to the same layer (tasmania_cities) with another wfst-t app,
but not with the one, that comes with Geoserver.
Not sure, we run WFS-T tests against postgis every night as part of the OGC
WFS compliance tests, they appear to be working.
Do you have a primary key in that table?
Cheers
Andrea
--
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Thanks Andrea
There is a field gid, which is the primary key. Geoserver adds an empty record to my database with this problematic app. And if I put temporarily some extra code to the handler
feature.attributes.city_name = “new”;
feature.attributes.admin_name = “something”;
those attributes are saved to a new record ok, but not the location. Strange???
Oiva
···
Geoserver comes with a simple wfs-t example (wfs-t.html). I tested it, and it works when those layers it calls are shapefiles. However, when I move layers to a postgis database and make some fixes to code (namespace etc), location information does not go to database, although I get SUCCES-feedback from transaction. Can anyone explain why this happens. I can add data to the same layer (tasmania_cities) with another wfst-t app, but not with the one, that comes with Geoserver.
Not sure, we run WFS-T tests against postgis every night as part of the OGC WFS compliance tests, they appear to be working.
Do you have a primary key in that table?
Cheers
Andrea
–
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Thu, Oct 24, 2013 at 9:59 AM, Hakala Oiva (MTT) <oiva.hakala@anonymised.com>wrote:
Thanks Andrea
There is a field gid, which is the primary key. Geoserver adds an empty
record to my database with this problematic app. And if I put temporarily
some extra code to the handler
feature.attributes.city_name = "new";
feature.attributes.admin_name = "something";
those attributes are saved to a new record ok, but not the location.
Strange???
Ah ok, the most common reason for this is that you're posting the geometry
in the wrong GML version, or the geometry is otherwise
incompatible with the type in the database. For example:
* writing GML2 geometries in a WFS 1.1 transaction, or GML3 geometries in a
WFS 1.0 transaction
* wriging a Point, when the database expects a Polygon
Cheers
Andrea
--
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Ok, but what should be the solution? I am creating a point, and the table expects a point, so that is OK?
I don’t know about GML-versions. I cannot affect how the app itself handles GML versions and WFS-transaction versions. The database is posgresql 9.1 with postgis 2. So what to do?
Oiva
···
Thanks Andrea
There is a field gid, which is the primary key. Geoserver adds an empty record to my database with this problematic app. And if I put temporarily some extra code to the handler
feature.attributes.city_name = “new”;
feature.attributes.admin_name = “something”;
those attributes are saved to a new record ok, but not the location. Strange???
Ah ok, the most common reason for this is that you’re posting the geometry in the wrong GML version, or the geometry is otherwise
incompatible with the type in the database. For example:
- writing GML2 geometries in a WFS 1.1 transaction, or GML3 geometries in a WFS 1.0 transaction
- wriging a Point, when the database expects a Polygon
Cheers
Andrea
–
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
Hi Andrea again
You said:
- writing GML2 geometries in a WFS 1.1 transaction, or GML3 geometries in a WFS 1.0 transaction
My Geoserver log says:
service = WFS
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
…
idgen = GenerateNew
inputFormat = text/xml; subtype=gml/3.1.1
releaseAction = ALL
So if I am right, the reason is GML 3.11 against WFS 1.0.0 ?
How to change this? Some way to configure Geoserver?
Oiva
···
Thanks Andrea
There is a field gid, which is the primary key. Geoserver adds an empty record to my database with this problematic app. And if I put temporarily some extra code to the handler
feature.attributes.city_name = “new”;
feature.attributes.admin_name = “something”;
those attributes are saved to a new record ok, but not the location. Strange???
Ah ok, the most common reason for this is that you’re posting the geometry in the wrong GML version, or the geometry is otherwise
incompatible with the type in the database. For example:
- writing GML2 geometries in a WFS 1.1 transaction, or GML3 geometries in a WFS 1.0 transaction
- wriging a Point, when the database expects a Polygon
Cheers
Andrea
–
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
On Thu, Oct 24, 2013 at 11:11 AM, Hakala Oiva (MTT) <oiva.hakala@anonymised.com>wrote:
Ok, but what should be the solution? I am creating a point, and the
table expects a point, so that is OK?
I don't know about GML-versions. I cannot affect how the app itself
handles GML versions and WFS-transaction versions. The database is
posgresql 9.1 with postgis 2. So what to do?
Stop GeoServer, go edit the web.xml file in geoserver/WEB-INF, enable the
logging filter, and enable logging the POST bodies:
<filter>
<filter-name>Request Logging Filter</filter-name>
<filter-class>org.geoserver.filters.LoggingFilter</filter-class>
<init-param>
<param-name>enabled</param-name>
<param-value>true</param-value>
</init-param>
<init-param>
<param-name>log-request-bodies</param-name>
<param-value>true</param-value>
</init-param>
</filter>
Restart GeoServer and have your client do and edit. Look in the logs for
the Transaction XML,
post it here. At least we can see what is the client doing
Cheers
Andrea
--
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------
Restart GeoServer and have your client do and edit. Look in the logs for the Transaction XML,
post it here. At least we can see what is the client doing
Cheers
Andrea
Maybe I could edit web.xml right. Anyway, here is the log just after transaction trial.
WFS 1.0.0, but GML 3.1.1 
Oiva
Request: getServiceInfo
2013-10-25 13:32:57,794 INFO [geoserver.gwc] - DataStoreChange: {http://localhost:8080/geoserver\}tasmania_cities PreInsert
2013-10-25 13:32:57,816 INFO [geoserver.gwc] - DataStoreChange: {http://localhost:8080/geoserver\}tasmania_cities PostInsert
2013-10-25 13:32:57,897 INFO [geoserver.wfs] -
Request: transaction
service = WFS
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
group[0] = wfs:insert=net.opengis.wfs.impl.InsertElementTypeImpl@anonymised.com.5951... (feature: [SimpleFeatureImpl:tasmania_cities=[SimpleFeatureImpl.Attribute: gid<gid id=fid--2c919365_141ef2c92a5_-8000>=0, SimpleFeatureImpl.Attribute: city_name<city_name id=fid--2c919365_141ef2c92a5_-8000>=Test-town, SimpleFeatureImpl.Attribute: admin_name<admin_name id=fid--2c919365_141ef2c92a5_-8000>=Tasmania, SimpleFeatureImpl.Attribute: cntry_name<cntry_name id=fid--2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: status<status id=fid--2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: pop_class<pop_class id=fid--2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: geom<geom id=fid--2c919365_141ef2c92a5_-8000>=null]], handle: null, idgen: <unset>, inputFormat: <unset>, srsName: null)
insert[0]:
feature[0] = SimpleFeatureImpl:tasmania_cities=[SimpleFeatureImpl.Attribute: gid<gid id=fid--2c919365_141ef2c92a5_-8000>=0, SimpleFeatureImpl.Attribute: city_name<city_name id=fid--2c919365_141ef2c92a5_-8000>=Test-town, SimpleFeatureImpl.Attribute: admin_name<admin_name id=fid--2c919365_141ef2c92a5_-8000>=Tasmania, SimpleFeatureImpl.Attribute: cntry_name<cntry_name id=fid--2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: status<status id=fid--2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: pop_class<pop_class id=fid--2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: geom<geom id=fid--2c919365_141ef2c92a5_-8000>=null]
idgen = GenerateNew
inputFormat = text/xm
inputFormat = text/xml; subtype=gml/3.1.1
releaseAction = ALL
Hi everyone. Problem sorted out.
For some reason, that I dont know, Geoserver’s sample wfs-t app assumes, that the field (column) containing geometry is the_geom (the default of shp file). I cannot understand why it is still used, when the data is in a database, and the geo column is there geom? Is this burned in in Openlayers version??
When I modified that column name to the_geom when importing data to Postgis, everything started to work, and point was saved ok.
Special thanks to Jukka Rahkonen and also Andrea for help. Without examining POST-data, I could not figure this out!
Oiva Hakala 
···
Restart GeoServer and have your client do and edit. Look in the logs for the Transaction XML,
post it here. At least we can see what is the client doing
Cheers
Andrea
Maybe I could edit web.xml right. Anyway, here is the log just after transaction trial.
WFS 1.0.0, but GML 3.1.1 
Oiva
Request: getServiceInfo
2013-10-25 13:32:57,794 INFO [geoserver.gwc] - DataStoreChange: {http://localhost:8080/geoserver}tasmania_cities PreInsert
2013-10-25 13:32:57,816 INFO [geoserver.gwc] - DataStoreChange: {http://localhost:8080/geoserver}tasmania_cities PostInsert
2013-10-25 13:32:57,897 INFO [geoserver.wfs] -
Request: transaction
service = WFS
version = 1.0.0
baseUrl = http://localhost:8080/geoserver/
group[0] = wfs:insert=net.opengis.wfs.impl.InsertElementTypeImpl@anonymised.com (feature: [SimpleFeatureImpl:tasmania_cities=[SimpleFeatureImpl.Attribute: gid=0, SimpleFeatureImpl.Attribute: city_name<city_name id=fid–2c919365_141ef2c92a5_-8000>=Test-town, SimpleFeatureImpl.Attribute: admin_name<admin_name id=fid–2c919365_141ef2c92a5_-8000>=Tasmania, SimpleFeatureImpl.Attribute: cntry_name<cntry_name id=fid–2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: status=null, SimpleFeatureImpl.Attribute: pop_class<pop_class id=fid–2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: geom=null]], handle: null, idgen: , inputFormat: , srsName: null)
insert[0]:
feature[0] = SimpleFeatureImpl:tasmania_cities=[SimpleFeatureImpl.Attribute: gid=0, SimpleFeatureImpl.Attribute: city_name<city_name id=fid–2c919365_141ef2c92a5_-8000>=Test-town, SimpleFeatureImpl.Attribute: admin_name<admin_name id=fid–2c919365_141ef2c92a5_-8000>=Tasmania, SimpleFeatureImpl.Attribute: cntry_name<cntry_name id=fid–2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: status=null, SimpleFeatureImpl.Attribute: pop_class<pop_class id=fid–2c919365_141ef2c92a5_-8000>=null, SimpleFeatureImpl.Attribute: geom=null]
idgen = GenerateNew
inputFormat = text/xm
inputFormat = text/xml; subtype=gml/3.1.1
releaseAction = ALL
On Mon, Oct 28, 2013 at 5:58 PM, Hakala Oiva (MTT) <oiva.hakala@anonymised.com>wrote:
Hi everyone. Problem sorted out.
For some reason, that I dont know,* Geoserver's sample wfs-t app*assumes, that the field (column) containing geometry is
*the_geom (the default of shp file).* I cannot understand why it is still
used, when the data is in a database, and the geo column is there* geom*?
Is this burned in in Openlayers version??
It is the default, you can change it (don't remember how).
The field name must match the one in the db
When I modified that column name to* the_geom* when importing data to
Postgis, everything started to work, and point was saved ok.
Special thanks to *Jukka Rahkonen* and also *Andrea* for help. Without
examining POST-data, I could not figure this out!
Cool 
Cheers
Andrea
--
Ing. Andrea Aime
@geowolf
Technical Lead
GeoSolutions S.A.S.
Via Poggio alle Viti 1187
55054 Massarosa (LU)
Italy
phone: +39 0584 962313
fax: +39 0584 1660272
mob: +39 339 8844549
http://www.geo-solutions.it
http://twitter.com/geosolutions_it
-------------------------------------------------------