I have a MapServer (MS4W on Windows) setup with WFS in a mapfile. I cannot load WFS layers from this MapServer, they all return this warning in QGIS:
WARNING Analysis of DescribeFeatureType response failed for url pageSize='0' pagingEnabled='true' preferCoordinatesForWfsT11='false' srsname='EPSG:4326' typename='ms:NAVY' url='http://localhost:8080/cgi-bin/mapserv.exe?map=c:/ms4w/apps/craccen_dev_map/htdocs/craccen_wfs.map' version='2.0.0': Cannot find schema root element
I'm pretty sure MapServer is not the problem as there are no errors in the log file, AND, if I type the request URL into a web browser I get the correct response.
This is my map file that defines the WFS service:
MAP
NAME "CRACCEN_WFS"
STATUS ON
SIZE 400 300
EXTENT -180 -90 180 90
UNITS DD
SHAPEPATH "./shape"
IMAGECOLOR 255 255 255
CONFIG "MS_ERRORFILE" "C:\\ms4w\\apps\\craccen_dev_map\\wfs.log"
DEBUG 5
WEB
IMAGEPATH "/ms4w/tmp/ms_tmp/"
IMAGEURL "/ms_tmp/"
METADATA
"wfs_title" "CRACCEN Test WFS Server"
"wfs_onlineresource" "http://localhost:8080/cgi-bin/mapserv.exe?map=c:\ms4w\apps\craccen_dev_map\htdocs\craccendev.map"
"wfs_srs" "EPSG:4326 EPSG:4269 EPSG:3978 EPSG:3857"
"wfs_abstract" "Open Source Information"
"wfs_enable_request" "*"
END
END
PROJECTION
"init=epsg:4326"
END
OUTPUTFORMAT
NAME "geojson"
DRIVER "OGR/GEOJSON"
MIMETYPE "application/json; subtype=geojson"
FORMATOPTION "STORAGE=stream"
FORMATOPTION "FORM=SIMPLE"
FORMATOPTION "LCO:RFC7496=YES"
END
##############
#Naval Bases
LAYER
NAME "NAVY"
METADATA
"wfs_title" "Naval Bases"
"wfs_srs" "EPGS:4326"
"gml_include_items" "all"
"gml_featureid" "ID"
"wfs_enable_request" "*"
"wfs_getfeature_formatlist" "geojson"
END
TYPE POINT
STATUS ON
DATA "u_naval_bases"
PROJECTION
"init=epsg:4326"
END
END #layer
Any thoughts on what could be happening?
Best Answer
Thanks for the replies everyone.
After a lot of testing I determined that the problem was in the:
line in the map level METADATA. Notice that the path to my map file uses back slashes in the path. I replaced that line with:
and all is well. I did not have that line in my original testing WFS map file, and it seems that Mapserver's default behaviour is smarter than I am. :)