[Geoserver-devel] Can't insert new WFS features

With Geoserver-1.4.0-M2-WCS (and 1.3.4a, and 1.3.3a) I can no longer
insert new WFS features (in a PostGIS datastore). [With 1.3.0a I can.]
The request that's being sent is:

  POST /geoserver/wfs HTTP/1.1
  User-Agent: Jakarta Commons-HttpClient/2.0.1
  Host: localhost:8888
  Content-Length: 628

  <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs&quot;&gt;&lt;wfs:Insert&gt;&lt;edd:alerts xmlns:edd="http://www.west.nl/edd&quot;&gt;
      <edd:mmsiNumber>test</edd:mmsiNumber>
      <edd:weight>1.0</edd:weight>
      <edd:length>2.0</edd:length>
      <edd:width>3.0</edd:width>
      <edd:draught>4.0</edd:draught>
      <edd:height>5.0</edd:height>
      <edd:geom>
  <gml:Point xmlns:gml="http://www.opengis.net/gml&quot; srsName="epsg:4326">
    <gml:coordinates decimal="." cs="," ts=" ">2.83,52.54</gml:coordinates>
  </gml:Point>
      </edd:geom>
      <edd:timestamp>13/10/2006 08:45</edd:timestamp>
    </edd:alerts></wfs:Insert></wfs:Transaction>

The response from Geoserver is:

  HTTP/1.1 200 OK
  Server: Apache-Coyote/1.1
  Set-Cookie: JSESSIONID=420BA66CF8C5A525B539582117C2C84C; Path=/geoserver
  Content-Type: text/xml;charset=UTF-8
  Content-Length: 476
  Date: Fri, 13 Oct 2006 08:45:31 GMT

  <?xml version="1.0" ?>
  <ServiceExceptionReport
     version="1.2.0"
     xmlns="http://www.opengis.net/ogc&quot;
     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
     xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8888/geoserver/schemas/wfs/1.0.0/OGC-exception.xsd&quot;&gt;
     <ServiceException>
  org.geotools.data.DataSourceException: Could not create alerts out of provided feature: fid--1043f4e5:10e40d10b4d:-7ffc </ServiceException>
  </ServiceExceptionReport>

Something seems to be going wrong with interpreting the XML, although my
schema for the edd:alerts feature type is correct.
The relevant entries in the Geoserver log are:

  13-Oct-2006 10:38:01 org.vfny.geoserver.util.requests.readers.DispatcherXmlReader getRequest
  INFO: getting request type from org.vfny.geoserver.util.requests.DispatcherHandler@anonymised.com
  13-Oct-2006 10:38:01 org.vfny.geoserver.wfs.requests.InsertRequest addFeature
  INFO: got type alerts,http://www.west.nl/edd
  13-Oct-2006 10:38:01 org.vfny.geoserver.servlets.AbstractService doService
  INFO: handling request: Lock Id: null
  releaseAction: ALL
  handle: null
  Handle: null alerts 1
  ReleaseAll: false
  TypeName: alerts
  Feature[ id=fid--1043f4e5:10e40d10b4d:-7fff , mmsiNumber=test , weight=1.0 , length=2.0 , width=3.0 , draught=4.0 , height=5.0 , geom=POINT (3.3925 52.81) , timestamp=Fri Oct 13 08:38:00 CEST 2006 ]

  13-Oct-2006 10:38:01 org.vfny.geoserver.servlets.AbstractService doService
  WARNING: service exception while executing request: Lock Id: null
  releaseAction: ALL
  handle: null
  Handle: null alerts 1
  ReleaseAll: false
  TypeName: edd:alerts
  Feature[ id=fid--1043f4e5:10e40d10b4d:-7fff , mmsiNumber=test , weight=1.0 , length=2.0 , width=3.0 , draught=4.0 , height=5.0 , geom=POINT (3.3925 52.81) , timestamp=Fri Oct 13 08:38:00 CEST 2006 ]

  cause: org.geotools.data.DataSourceException: Could not create alerts out of provided feature: fid--1043f4e5:10e40d10b4d:-7fff
  13-Oct-2006 10:38:01 org.vfny.geoserver.ServiceException getXmlResponse
  WARNING: encountered error: org.geotools.data.DataSourceException: Could not create alerts out of provided feature: fid--1043f4e5:10e40d10b4d:-7fff
  StackTrace: org.geotools.data.DataSourceException: Could not create alerts out of provided feature: fid--1043f4e5:10e40d10b4d:-7fff
    at org.geotools.data.jdbc.JDBCFeatureStore.addFeatures(JDBCFeatureStore.java:331)
    at org.vfny.geoserver.global.GeoServerFeatureStore.addFeatures(GeoServerFeatureStore.java:87)
    at org.vfny.geoserver.wfs.responses.TransactionResponse.execute(TransactionResponse.java:442)
    at org.vfny.geoserver.wfs.responses.TransactionResponse.execute(TransactionResponse.java:118)
    at org.vfny.geoserver.servlets.AbstractService.doService(AbstractService.java:511)
    at org.vfny.geoserver.servlets.AbstractService.doPost(AbstractService.java:436)
    at org.geoserver.request.Dispatcher.post(Dispatcher.java:267)
    at org.geoserver.request.Dispatcher.dispatch(Dispatcher.java:159)
    at org.geoserver.request.Dispatcher.handleRequestInternal(Dispatcher.java:54)
    at org.springframework.web.servlet.mvc.AbstractController.handleRequest(AbstractController.java:139)
    at org.springframework.web.servlet.mvc.SimpleControllerHandlerAdapter.handle(SimpleControllerHandlerAdapter.java:44)
    at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:684)
    at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
    at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:392)
    at org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:357)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.vfny.geoserver.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:122)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:202)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
    at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:541)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
    at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
    at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:664)
    at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
    at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
    at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
    at java.lang.Thread.run(Thread.java:595)
  Caused by: IllegalAttribute: com.vividsolutions.jts.geom.Point , but got java.lang.Double
    at org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:215)
    at org.geotools.feature.DefaultFeature.setAttributes(DefaultFeature.java:256)
    at org.geotools.data.jdbc.JDBCFeatureStore.addFeatures(JDBCFeatureStore.java:329)
    ... 34 more
  Caused by: java.lang.IllegalArgumentException: AttributeGT.Geometric cannot parse 5.0
    at org.geotools.feature.type.GeometricAttributeType.parse(GeometricAttributeType.java:117)
    at org.geotools.feature.DefaultFeature.setAttribute(DefaultFeature.java:211)
    ... 36 more

Regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600

To answer my own question:

As quoted from Gertjan van Oosten <gertjan@anonymised.com>:

With Geoserver-1.4.0-M2-WCS (and 1.3.4a, and 1.3.3a) I can no longer
insert new WFS features (in a PostGIS datastore).

I've done some more digging, and it turns out that the problem is caused
by the fact that the order of the columns in the PostGIS datastore is
not exactly the same as the order of the feature properties in the WFS-T
request. Is this is a known restriction?

  <wfs:Transaction xmlns:wfs="http://www.opengis.net/wfs&quot;&gt;&lt;wfs:Insert&gt;&lt;edd:alerts xmlns:edd="http://www.west.nl/edd&quot;&gt;
      <edd:mmsiNumber>test</edd:mmsiNumber>
      <edd:weight>1.0</edd:weight>
      <edd:length>2.0</edd:length>
      <edd:width>3.0</edd:width>
      <edd:draught>4.0</edd:draught>
      <edd:height>5.0</edd:height>
      <edd:geom>
  <gml:Point xmlns:gml="http://www.opengis.net/gml&quot; srsName="epsg:4326">
    <gml:coordinates decimal="." cs="," ts=" ">2.83,52.54</gml:coordinates>
  </gml:Point>
      </edd:geom>
      <edd:timestamp>13/10/2006 08:45</edd:timestamp>
    </edd:alerts></wfs:Insert></wfs:Transaction>

Turned out that the height field was out-of-order with respect to the
table in PostGIS.

Regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600

Is it working by setting the right column order?

On 10/13/06, Gertjan van Oosten <gertjan@anonymised.com> wrote:

To answer my own question:

As quoted from Gertjan van Oosten < gertjan@anonymised.com>:

With Geoserver-1.4.0-M2-WCS (and 1.3.4a, and 1.3.3a) I can no longer
insert new WFS features (in a PostGIS datastore).

I’ve done some more digging, and it turns out that the problem is caused
by the fact that the order of the columns in the PostGIS datastore is
not exactly the same as the order of the feature properties in the WFS-T
request. Is this is a known restriction?

<wfs:Transaction xmlns:wfs=“http://www.opengis.net/wfs”>wfs:Insert<edd:alerts xmlns:edd=“http://www.west.nl/edd”>
edd:mmsiNumbertest</edd:mmsiNumber>
edd:weight1.0</edd:weight>
edd:length 2.0</edd:length>
edd:width3.0</edd:width>
edd:draught4.0</edd:draught>
edd:height5.0</edd:height>
edd:geom
<gml:Point xmlns:gml=“http://www.opengis.net/gml” srsName=“epsg:4326”>
<gml:coordinates decimal=“.” cs=“,” ts=" ">2.83,52.54</gml:coordinates>
</gml:Point>
</edd:geom>
edd:timestamp13/10/2006 08:45</edd:timestamp>
</edd:alerts></wfs:Insert></wfs:Transaction>

Turned out that the height field was out-of-order with respect to the
table in PostGIS.

Regards,

– Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600


Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642


Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Eng. Alessio Fabiani
Vice President/CTO GeoSolutions

http://www.geo-solutions.it


Hi Alessio,

As quoted from Alessio Fabiani <alessio.fabiani@anonymised.com>:

Is it working by setting the right column order?

Yes, it is, sorry for not being more explicit in my previous message.
I exported the table from Postgres and recreated it with the columns in
the correct order (i.e. the same order as in the XML schema) and then
everything worked fine.

The odd thing was that editing *existing* features worked (event though
the WFS-T update requests would have also the fields in the "wrong"
order), just adding *new* features failed. That was rather non-intuitive...

Regards,
--
-- Gertjan van Oosten, gertjan@anonymised.com, West Consulting B.V., +31 15 2191 600

Gertjan van Oosten wrote:

To answer my own question:

As quoted from Gertjan van Oosten <gertjan@anonymised.com>:
  

With Geoserver-1.4.0-M2-WCS (and 1.3.4a, and 1.3.3a) I can no longer
insert new WFS features (in a PostGIS datastore).
    
I've done some more digging, and it turns out that the problem is caused
by the fact that the order of the columns in the PostGIS datastore is
not exactly the same as the order of the feature properties in the WFS-T
request. Is this is a known restriction?
  

Well it *is* an XML restriction, the schema served up specifies the correct order of attributes . In the case
where we generate a schema (for DescribeFeatureType) the description should match the columns exactly.

Turned out that the height field was out-of-order with respect to the
table in PostGIS.
  

Can we check the order described the the XML Schema as well?
Jody