1

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:

<ogc:FeatureId fid="none"/>

Does anyone has an idea what's going on?

EDIT

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
  • 1
    can you add the python code you are using? – Ian Turton Aug 2 '16 at 8:05
2

Did you set the "Content-type" header of your request to "application/xml" or "text/xml"?

  • Yes. I set it as: headers = {'Content-Type': 'application/xml'} – user1919 Aug 1 '16 at 12:43
  • In my geoserver log I get: columnNumber: 31; Content is not allowed in trailing section. Which I dont understand. I have checked the XML in an online validator and its valid. – user1919 Aug 1 '16 at 12:52
  • Seems like whatever geoserver is getting is not valid anymore. Maybe there are character encoding issues? – Andrea Aime Aug 2 '16 at 15:30

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.