[Geoserver-users] wfs insert request returns a read-only exception

Hi,

I'm still trying out stuff in Geoserver and tried to use the demo page to do a wfs insert. Here's my setup: PostGIS with a table named gtest, with columns city (text) and coor (Point Geometry). I added gtest as a featuretype, and tried to submit the following at the wfs demo page:

<wfs:Transaction service="WFS" version="1.0.0"
   xmlns:wfs="http://www.opengis.net/wfs&quot;
   xmlns:topp="http://www.openplans.org/topp&quot;
   xmlns:gml="http://www.opengis.net/gml&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.openplans.org/topp http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:gtest&quot;&gt;
   <wfs:Insert>
     <topp:gtest>
       <topp:coor>
         <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
              <gml:coordinates decimal="." cs="," ts=" ">
23,12
               </gml:coordinates>
         </gml:Point>
       </topp:coor>
       <topp:city>test</topp:city>
     </topp:gtest>
   </wfs:Insert>
</wfs:Transaction>

This is what I got back:
<ServiceExceptionReport version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt;
<ServiceException locator="null gtest 1">
       topp:gtest is read-only </ServiceException>
</ServiceExceptionReport>

What did I do wrong? In the datastore config I put in the username and password that created my database, so it should have write access right?
In the future, where can I look to debug this sort of errors?
Thanks in advance.

Doris

dlamoris@anonymised.com ha scritto:

Hi,

I'm still trying out stuff in Geoserver and tried to use the demo page to do a wfs insert. Here's my setup: PostGIS with a table named gtest, with columns city (text) and coor (Point Geometry). I added gtest as a featuretype, and tried to submit the following at the wfs demo page:

<wfs:Transaction service="WFS" version="1.0.0"
   xmlns:wfs="http://www.opengis.net/wfs&quot;
   xmlns:topp="http://www.openplans.org/topp&quot;
   xmlns:gml="http://www.opengis.net/gml&quot;
   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance&quot;
   xsi:schemaLocation="http://www.opengis.net/wfs http://schemas.opengis.net/wfs/1.0.0/WFS-transaction.xsd http://www.openplans.org/topp http://localhost:8080/geoserver/wfs/DescribeFeatureType?typename=topp:gtest&quot;&gt;
   <wfs:Insert>
     <topp:gtest>
       <topp:coor>
         <gml:Point srsName="http://www.opengis.net/gml/srs/epsg.xml#4326&quot;&gt;
              <gml:coordinates decimal="." cs="," ts=" ">
23,12
               </gml:coordinates>
         </gml:Point>
       </topp:coor>
       <topp:city>test</topp:city>
     </topp:gtest>
   </wfs:Insert>
</wfs:Transaction>

This is what I got back:
<ServiceExceptionReport version="1.2.0" xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/geoserver/schemas//wfs/1.0.0/OGC-exception.xsd&quot;&gt;
<ServiceException locator="null gtest 1">
       topp:gtest is read-only </ServiceException>
</ServiceExceptionReport>

What did I do wrong? In the datastore config I put in the username and password that created my database, so it should have write access right?
In the future, where can I look to debug this sort of errors?
Thanks in advance.

My guess is that the gttest does not have a primary key. As such, it cannot be written correctly because the output of a transaction
must state then new ID of the created feature.
Add a column of type "serial", make it primary key, and you should
be fine.
Yet...hmmm... we could state the nature of the issue a little better than that...

Cheers
Andrea