0

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?

4
  • First, always make sure that your data is showing properly with shp2img commandline utility (soon to be renamed 'map2img'). Something like shp2img -m craccen_dev_map -o ttt.png -all_debug 3 Then, once your data is appearing properly there, execute a GetCapabilities request, and examine the response (remove any 'warning' messages). Question: what version of MS4W is this? (execute mapserv -v to find out) Make sure you are using MS4W 4.0.5 or more recent (MS4W 5.0 is in beta release mode now). Finally, thanks for using MS4W ! :) -jeff
    – mapserving
    Commented Mar 3, 2022 at 20:40
  • 1
    I would also remove the OUTPUTFORMAT object and wfs_getfeature_formatlist, for this test. (first see if you can get valid GML back, first before trying other crazy formats) Then try that GetFeature request inside QGIS, to see if the GML loads. Have fun. :) -jeff
    – mapserving
    Commented Mar 3, 2022 at 20:45
  • 1
    Show what do you get with http://localhost:8080/cgi-bin/mapserv.exe?map=c:\ms4w\apps\craccen_dev_map\htdocs\craccendev.map&SERVICE=WFS&version=2.0.0&request=DescribeFeatureType&TYPENAMES=ms:NAVY?
    – user30184
    Commented Mar 3, 2022 at 20:53
  • might be related to stackoverflow.com/questions/71040542/…
    – Ian Turton
    Commented Mar 4, 2022 at 8:43

1 Answer 1

0

Thanks for the replies everyone.

After a lot of testing I determined that the problem was in the:

"wfs_onlineresource" "http://localhost:8080/cgi-bin/mapserv.exe?map=c:\ms4w\apps\craccen_dev_map\htdocs\craccen_wfs.map"

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:

"wfs_onlineresource" "http://localhost:8080/cgi-bin/mapserv.exe?map=c:/ms4w/apps/craccen_dev_map/htdocs/craccen_wfs.map"

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. :)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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