[Qgis-user] Geoserver WFS update request error

emmexx emmexx at tiscalinet.it
Fri Nov 27 23:52:22 PST 2015


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
	



More information about the Qgis-user mailing list