Environment
- MapInfo version 15.0 Release Build 18
- GeoServer version 2.11.1
- QGIS version 2.1.7
Problem
I am publishing a PostGIS layer via WFS from GeoServer. Editing this layer in MapInfo causes the following error:
ERROR [geoserver.ows] - org.xmlpull.v1.XmlPullParserException: duplicated namespace declaration for 'wfs' prefix
Baseline Diagnosis - MapInfo is not playing nicely with others
- I can edit and save records in this WFS layer using QGIS - no problem.
- I can open, query and view the WFS layer in MapInfo - including refreshes to see changes made in QGIS - no problem.
On that basis, I am convinced that I have configured all of the moving parts more or less correctly, and that MapInfo seem to be the problem piece in the stack.
Discovery and Debugging - MapInfo XML
Digging further into the GeoServer logs, I can see the raw XML which MapInfo is sending to GeoServer to effect the update transaction. Note the two starred lines (**) which are, in fact, duplicates, as the error message suggests:
2017-09-15 10:43:14,999 DEBUG [geoserver.ows] - Raw XML request starts with: <?xml version="1.0" encoding="UTF-8"?>
<wfs:Transaction
version="1.0.0"
service="WFS"
** xmlns:wfs="http://www.opengis.net/wfs"
xmlns:geostore_DEV="http://noidea.at.all"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
** xmlns:wfs="http://www.opengis.net/wfs"
xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="geostore_DEV:Nat_BND_EXCHBDY"><wfs:Property><wfs:Name>geostore_DEV:SP_GEOMETRY</wfs:Name><wfs:Value><gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4283"><gml:polygonMember><gml:Polygon><gml:outerBoundaryIs><gml:LinearRing><gml:coordinates>152.902784,-27.958194 152.898579,-27.964123 152.908369,-27.969225 152.916021,-27.965465 152.902784,-27.958194</gml:coordinates></gml:LinearRing></gml:outerBoundaryIs></gml:Polygon></gml:polygonMember></gml:MultiPolygon></wfs:Value></wfs:Property><ogc:Filter xmlns:ogc="http://www.op...
2017-09-15 10:43:14,999 ERROR [geoserver.ows] -
org.xmlpull.v1.XmlPullParserException: duplicated namespace declaration for 'wfs' prefix (position: START_DOCUMENT seen ...http://www.opengis.net/ogc"\nxmlns:wfs="http://www.opengis.net/wfs"... @9:39)
at org.xmlpull.mxp1.MXParser.parseAttribute(MXParser.java:2132)
Teasing this out a bit further, I can construct the transaction statement fully (and a bit more legibly) as follows:
<wfs:Transaction
version="1.0.0"
service="WFS"
xmlns:wfs="http://www.opengis.net/wfs"
xmlns:geostore_DEV="http://noidea.at.all"
xmlns:gml="http://www.opengis.net/gml"
xmlns:ogc="http://www.opengis.net/ogc"
xmlns:wfs="http://www.opengis.net/wfs"
xsi:schemaLocation="http://www.opengis.net/wfs ../wfs/1.0.0/WFS-basic.xsd"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<wfs:Update xmlns:wfs="http://www.opengis.net/wfs" typeName="geostore_DEV:Nat_BND_EXCHBDY">
<wfs:Property>
<wfs:Name>geostore_DEV:SP_GEOMETRY</wfs:Name>
<wfs:Value>
<gml:MultiPolygon xmlns:gml="http://www.opengis.net/gml" srsName="EPSG:4283">
<gml:polygonMember>
<gml:Polygon>
<gml:outerBoundaryIs>
<gml:LinearRing>
<gml:coordinates>152.902784,-27.958194 152.898579,-27.964123 152.908369,-27.969225 152.916021,-27.965465 152.902784,-27.958194</gml:coordinates>
</gml:LinearRing>
</gml:outerBoundaryIs>
</gml:Polygon>
</gml:polygonMember>
</gml:MultiPolygon>
</wfs:Value>
</wfs:Property>
<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">
<ogc:FeatureId fid="Nat_BND_EXCHBDY.5071" />
</ogc:Filter>
</wfs:Update>
</wfs:Transaction>
Discovery and Debugging - XML error is reproducible (and fixable) in GeoServer test console
Using the "TestServlet" on GeoServer "Demo requests" page, I ran the XML requests directly on the server.
- When I copy-and-paste the formatted XML, above, directly into the TestServlet, I get the same error as the MapInfo "save" command
- When I delete one of the duplicated "xmlns:wfs" lines from the XML and rerun it, the command executes correctly, the data is updated correctly, and everybody is happy!
Desperation!
Can somebody please suggest a workaround / configuration change which will address this problem? I'm at my wit's end!
I have only "black box" testing and workaround options available - no code changes possible. I have tried to identify how the MapInfo XML request is being assembled - it looks like partly from the GeoServer WFS information and partly .... hard-coded?
Somehow I need to tweak the existing environment to enable MapInfo to edit this GeoServer data. (Otherwise ... we're looking at an Enterprise changeover to QGIS!)