I am trying to update some data on postgis through a WFS request to geoserver. More specifically I want to update the geometry of a point. My XML looks like this and works correctly when I execute it through geoserver Demos section:
<wfs:Transaction service="WFS" version="1.1.0" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:gml="http://www.opengis.net/gml"> <wfs:Update typeName="geonode:idn_poi_tradecenter_sumba_rbi25k_big_a"> <wfs:Property> <wfs:Name>the_geom</wfs:Name> <wfs:Value> <gml:Point> <gml:pos>-9.37861241467984 120.9814453125</gml:pos> </gml:Point> </wfs:Value> </wfs:Property> <ogc:Filter> <ogc:FeatureId fid='idn_poi_tradecenter_sumba_rbi25k_big_a.11'/> </ogc:Filter> </wfs:Update> </wfs:Transaction>
When I execute exactly the same xml using python requests, the point is not updated. Although I do get a status_code = 200 back when I print the response of the request I get this:
<?xml version="1.0" encoding="UTF-8"?><wfs:TransactionResponse xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ogc="http://www.opengis.net/ogc" xmlns:wfs="http://www.opengis.net/wfs" xmlns:geonode="http://www.geonode.org/" xmlns:ows="http://www.opengis.net/ows" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:gml="http://www.opengis.net/gml" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.1.0" xsi:schemaLocation="http://www.opengis.net/wfs http://localhost:8080/geoserver/schemas/wfs/1.1.0/wfs.xsd"> <wfs:TransactionSummary><wfs:totalInserted>0</wfs:totalInserted> <wfs:totalUpdated>1</wfs:totalUpdated> <wfs:totalDeleted>0</wfs:totalDeleted></wfs:TransactionSummary> <wfs:TransactionResults/> <wfs:InsertResults> <wfs:Feature> <ogc:FeatureId fid="none"/> </wfs:Feature> </wfs:InsertResults> </wfs:TransactionResponse>
If you notice in the response its mentioned:
Does anyone has an idea what's going on?
I found out what was the problem. It was related with encoding issues and hidden whitespaces or something like this. The issue (and major mistake) was that I have copied my XML structure to my email and then I took it from there. Sometimes this cause trouble such as adding hidden spaces etc.
I had to retype the XML string and then it worked. What made me suspect this issue was this line in geoserver log:
Content is not allowed in trailing section