Opened 12 years ago

Last modified 12 years ago

#4171 new defect

WFS filter is produced as non-standard XML

Reported by: sredl Owned by: msogcbugs
Priority: normal Milestone: 6.2 release
Component: WFS Client Version: svn-trunk (development)
Severity: normal Keywords: wfs filter xml namespace fes
Cc:

Description

The WFS filter is produced as non-standard XML and therefore MapServer WFS client cannot use filters against other WFS servers (Geoserver and Intergraph at least).

The "wfs_filter" specified in the mapfile in layer metadata is surrounded by <ogc:Filter> </ogc:Filter> tags. This is wrong, as "ogc" namespace is used, but not defined. It works against another MapServer, but other servers use standard XML libraries to parse it and fail. I tried both GET and POST methods and in both cases invalid XML was sent.

As a quick-fix, I propose the attached patch. It allows users to specify the filter with the proper leading tag:

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">

and works fine for us.

Next step definitely would be to introduce XML namespaces into MapServer and handle them properly.

More info:

Mapfile is here. The GET request I saw

http://88.81.191.230:8080/geoserver/ows?&
REQUEST=GetFeature&
VERSION=1.0.0&
SERVICE=WFS&
TYPENAME=ccss:Flood2010_FloodActivityGrade&
FILTER=<ogc:Filter>
  <ogc:PropertyIsEqualTo+xmlns:ogc="http://www.opengis.net/ogc">
    <ogc:PropertyName>STUPEN</ogc:PropertyName>
    <ogc:Literal>3</ogc:Literal>
  </ogc:PropertyIsEqualTo>
</ogc:Filter>

doesn't work. It can be fixed manually by moving the namespace definition into the filter tag:

<ogc:Filter xmlns:ogc="http://www.opengis.net/ogc">  
  <ogc:PropertyIsEqualTo>
...

The issue is also discussed here: http://lists.osgeo.org/pipermail/mapserver-users/2012-January/071209.html

Attachments (1)

patch (547 bytes ) - added by sredl 12 years ago.
Patch

Download all attachments as: .zip

Change History (4)

by sredl, 12 years ago

Attachment: patch added

Patch

comment:1 by dmorissette, 12 years ago

Milestone: 6.2 release

The quick-fix patch makes sense, I don't have time to take care of it now. Is there another dev willing to do it?

With respect to proper namespace support everywhere: I fully agree, but that may mean a non trivial amount of work (not sure what would be the best way to go since I haven't played much in the OWS code in a while).

comment:2 by aboudreault, 12 years ago

I'll take care of it in the next days.

in reply to:  2 comment:3 by sredl, 12 years ago

Thanks guys, very kind of you.

Note: See TracTickets for help on using tickets.