[Qgis-user] Geoserver WFS update request error

Richard Duivenvoorde rdmailings at duif.net
Sat Nov 28 00:34:08 PST 2015


Hi Maxx,

a very thourough bug report!

plz create an issue for it. It would even be better if you had a public
wfs while this issue is not fixed...

Looking into http://www.w3.org/TR/1999/REC-xml-names-19990114/#dt-NSDecl
to me it looks like you should use the namespace prefix in the xmlns
attributes, not the uri's. So that would make QGIS generate not 100%
valid xml? But I'm not a xml gury myself.

https://github.com/qgis/QGIS/blob/master/src/providers/wfs/qgswfsprovider.cpp#L53

is the place where you see the declaration of the namespace part of the
elements when building the xml:

https://github.com/qgis/QGIS/blob/master/src/providers/wfs/qgswfsprovider.cpp#L496

2 options:
- xml guru confirms that it is not ok to write a uri in a xmlns attribute
- if you are able to compile yourself, you could try to change #53 to
change to 'wfs' instead of the uri, and check if all requests are still
valid...

Hope this helps, others please chime in

Regards,

Richard

On 28-11-15 08:52, emmexx wrote:
> I posted the following on the geoserver mailing list but nobody replied.
> 
> I have a problem when I try to update a multilinestring geometry.
> I had the same issue in the past, I thought I had solved it but now it
> is back again. :-(
> 
> Setup: geoserver 2.7.1 and a test layer connected to a postgis table.
> Qgis 2.10.
> 
> I connect to the layer in qgis.
> I can create a new feature (line), I can update feature attributes but I
> can't update the geometry of any feature. If I add or move a node I get
> an error:
> 
> Transaction failed
> org.geoserver.wfs.WFSTransactionException: Update error:
> java.lang.String cannot be cast to com.vividsolutions.jts.geom.Geometry
> 
> I enabled geoserver debug log and the xml transaction sent from qgis is
> the following:
> 
> <Transaction xmlns="http://www.opengis.net/wfs"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0"
> xmlns:ws1="http://****.***"
> service="WFS"   xmlns:wfs="http://www.opengis.net/wfs"
> xmlns:ogc="http://www.opengis.net/ogc"
> xsi:schemaLocation="http://****.***
> http://*****.***:8080/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=ws1:test&SRSNAME=EPSG:4326&username=user1&password=***"
> xmlns:gml="http://www.opengis.net/gml">
>   <Update xmlns="http://www.opengis.net/wfs" typeName="ws1:test">
>      <Property xmlns="http://www.opengis.net/wfs">
>         <Name xmlns="http://www.opengis.net/wfs">geom</Name>
>         <Value xmlns="http://www.opengis.net/wfs">
>           <gml:MultiLineString srsName="EPSG:4326">
>              <gml:lineStringMember>
>                 <gml:LineString>
>                   <gml:coordinates cs="," ts="
> ">8.00003043999999974,44.23241551000000271
> 8.00578959672930246,44.17149441442651892
> 8.06909135999999982,44.16719473999999934</gml:coordinates>
>                 </gml:LineString>
>             </gml:lineStringMember>
>           </gml:MultiLineString>
>         </Value>
>      </Property>
>      <Filter xmlns="http://www.opengis.net/ogc">
>                 <FeatureId xmlns="http://www.opengis.net/ogc"
> fid="test.4"/>
>      </Filter>
>   </Update>
> </Transaction>
> 
> I tried to execute it in the demo requests and got the same error.
> 
> So I compared the example xml request created by the demo with the one
> created by qgis and the only relevant difference is in the xmlns used in
> any tags or declared in the transaction tag.
> 
> So I started from a working xml request (based on the one generated by
> the demo) and modified the tags from the outer tag to transform it to an
> xml similar to the qgis-generated one. First I modified the transaction
> tag followed by the Update tag and so on.
> The transactions were successful up to when I used the following xml:
> 
> <Transaction xmlns="http://www.opengis.net/wfs" service="WFS"
> version="1.0.0"
> xmlns:ws1="http://*****.***"
> xmlns:ogc="http://www.opengis.net/ogc"
> xmlns:wfs="http://www.opengis.net/wfs"
> xmlns:gml="http://www.opengis.net/gml"
> xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
>   xsi:schemaLocation="http://*****.***
> http://******.***:8080/geoserver/wfs?SERVICE=WFS&VERSION=1.0.0&REQUEST=DescribeFeatureType&TYPENAME=ws1:test&SRSNAME=EPSG:4326&username=user1&password=******">
> 
>      <Update xmlns="http://www.opengis.net/wfs" typeName="ws1:test">
>         <Property xmlns="http://www.opengis.net/wfs">
>           <Name xmlns="http://www.opengis.net/wfs">geom</Name>
>           <Value xmlns="http://www.opengis.net/wfs">
>              <gml:MultiLineString
> srsName="http://www.opengis.net/gml/srs/epsg.xml#4326">
>                 <gml:lineStringMember>
>                   <gml:LineString>
>                     
> <gml:coordinates>8.00003043999999974,44.23241551000000271
> 8.00578959672930246,44.17149441442651892
> 8.06909135999999982,44.16719473999999934</gml:coordinates>
>                   </gml:LineString>
>                 </gml:lineStringMember>
>              </gml:MultiLineString>
>           </Value>
>         </Property>
>         <ogc:Filter>
>           <ogc:FeatureId fid="test.4"/>
>         </ogc:Filter>
>      </Update>
>   </Transaction>
> 
> The problem seems to be in the Value tag.
> If the xml has <wfs:Value>...</wfs:Value> it works.
> If I change it to <Value xmlns="http://www.opengis.net/wfs">...</Value>
> I get the aforementioned error.
> 
> Any clue on what's wrong here?
> 
> I suppose the problem is in the way geoserver parses the xml transaction
> but I wonder if there could be an error in the way qgis generates the
> xml request. I'm not an expert in wfs-t and xml but my opinion is that
> both xml are syntactically correct. But the one created by qgis is not
> working.
> 
> thank you
>     maxx
>     
> _______________________________________________
> Qgis-user mailing list
> Qgis-user at lists.osgeo.org
> List info: http://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-user




More information about the Qgis-user mailing list