QGIS – How to Connect WFS or WMS from .xml File

qgiswfswmsxml

I'm new to working with WFS and WMS in QGIS, but most connections I tried so far have worked the usual way with the "GetCapabilities"-link.
Some public servers provide however an .xml file like the one shown below, and I haven't found a way yet to import that to QGIS – how can I write an URL for the WMS- (or WFS-) connection in QGIS using the info I can find in the .xml?

Here the link to the .xml, below the full code:

[https://geoportal.saarland.de/mapbender/php/wms.php?layer_id=41945&PHPSESSID=nbnqb46uav1vogib4pk8hnvqe2&INSPIRE=1&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS]

This XML file does not appear to have any style information associated with it. The document tree is shown below.

<WMT_MS_Capabilities xmlns:inspire_common="http://inspire.ec.europa.eu/schemas/common/1.0" xmlns:inspire_vs="http://inspire.ec.europa.eu/schemas/inspire_vs/1.0" updateSequence="1681971951" version="1.1.1">
<Service>
<Name>OGC:WMS</Name>
<Title>Photovoltaikanlagen</Title>
<Abstract>Der Kartendienst (WMS-Gruppe) stellt Daten derjenigen Flächen dar, die für eine Bebauung mit Photovoltaikanlagen in Frage kommen.</Abstract>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://geoportal.saarland.de/mapbender/php/wms.php?layer_id=41945&PHPSESSID=nbnqb46uav1vogib4pk8hnvqe2&INSPIRE=1&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&INSPIRE=1" xlink:type="simple"/>
<ContactInformation>
<ContactPersonPrimary>
<ContactPerson>Geodatenzentrum</ContactPerson>
<ContactOrganization>Ministerium für Umwelt, Klima, Mobilität, Agrar und Verbraucherschutz</ContactOrganization>
</ContactPersonPrimary>
<ContactPosition>Ansprechpartner</ContactPosition>
<ContactAddress>
<AddressType>postal</AddressType>
<Address>Von der Heydt 22</Address>
<City>Saarbrücken</City>
<StateOrProvince>Saarland</StateOrProvince>
<PostCode>66115</PostCode>
<Country>Deutschland</Country>
</ContactAddress>
<ContactVoiceTelephone>+49 (0)681 / 9712 – 03</ContactVoiceTelephone>
<ContactFacsimileTelephone>+49 (0)681 / 9712 – 200</ContactFacsimileTelephone>
<ContactElectronicMailAddress>[email protected]</ContactElectronicMailAddress>
</ContactInformation>
<Fees>none</Fees>
<AccessConstraints>noLimitations</AccessConstraints>
<KeywordList>
<Keyword>Agrarflächen</Keyword>
<Keyword>Gebietskulisse</Keyword>
<Keyword>Photovoltaikanlagen</Keyword>
<Keyword>PV</Keyword>
</KeywordList>
</Service>
<Capability>
<Request>
<GetCapabilities>
<Format>application/vnd.ogc.wms_xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://geoportal.saarland.de/mapbender/php/wms.php?layer_id=41945&PHPSESSID=nbnqb46uav1vogib4pk8hnvqe2&INSPIRE=1&REQUEST=GetCapabilities&VERSION=1.1.1&SERVICE=WMS&INSPIRE=1" xlink:type="simple"/>
</Get>
<Post>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="" xlink:type="simple"/>
</Post>
</HTTP>
</DCPType>
</GetCapabilities>
<GetMap>
<Format>image/bmp</Format>
<Format>image/gif</Format>
<Format>image/jpeg</Format>
<Format>image/png</Format>
<Format>image/png24</Format>
<Format>image/png32</Format>
<Format>image/png8</Format>
<Format>image/svg+xml</Format>
<Format>image/tiff</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://geoportal.saarland.de/arcgis/services/Internet/Photovoltaik_Agrarfl/MapServer/WmsServer?" xlink:type="simple"/>
</Get>
<Post>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://geoportal.saarland.de/arcgis/services/Internet/Photovoltaik_Agrarfl/MapServer/WmsServer?" xlink:type="simple"/>
</Post>
</HTTP>
</DCPType>
</GetMap>
<GetFeatureInfo>
<Format>application/geojson</Format>
<Format>application/vnd.esri.wms_featureinfo_xml</Format>
<Format>application/vnd.esri.wms_raw_xml</Format>
<Format>application/vnd.ogc.wms_xml</Format>
<Format>text/html</Format>
<Format>text/plain</Format>
<Format>text/xml</Format>
<DCPType>
<HTTP>
<Get>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://geoportal.saarland.de/arcgis/services/Internet/Photovoltaik_Agrarfl/MapServer/WmsServer?" xlink:type="simple"/>
</Get>
<Post>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="https://geoportal.saarland.de/arcgis/services/Internet/Photovoltaik_Agrarfl/MapServer/WmsServer?" xlink:type="simple"/>
</Post>
</HTTP>
</DCPType>
</GetFeatureInfo>
</Request>
<Exception>
<Format>application/vnd.ogc.se_blank</Format>
<Format>application/vnd.ogc.se_inimage</Format>
<Format>application/vnd.ogc.se_xml</Format>
</Exception>
<VendorSpecificCapabilities>
<inspire_vs:ExtendedCapabilities xmlns:inspire_vs="http://inspire.ec.europa.eu/schemas/inspire_vs/1.0">
<inspire_common:MetadataUrl xmlns:inspire_common="http://inspire.ec.europa.eu/schemas/common/1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:type="inspire_common:resourceLocatorType">
<inspire_common:URL xmlns:inspire_common="http://inspire.ec.europa.eu/schemas/common/1.0">https://geoportal.saarland.de/mapbender/php/mod_layerISOMetadata.php?SERVICE=WMS&outputFormat=iso19139&Id=41945</inspire_common:URL>
<inspire_common:MediaType xmlns:inspire_common="http://inspire.ec.europa.eu/schemas/common/1.0">application/vnd.iso.19139+xml</inspire_common:MediaType>
</inspire_common:MetadataUrl>
<inspire_common:SupportedLanguages>
<inspire_common:DefaultLanguage>
<inspire_common:Language>ger</inspire_common:Language>
</inspire_common:DefaultLanguage>
<inspire_common:SupportedLanguage>
<inspire_common:Language>ger</inspire_common:Language>
</inspire_common:SupportedLanguage>
</inspire_common:SupportedLanguages>
<inspire_common:ResponseLanguage>
<inspire_common:Language>ger</inspire_common:Language>
</inspire_common:ResponseLanguage>
</inspire_vs:ExtendedCapabilities>
</VendorSpecificCapabilities>
<Layer>
<Title>Photovoltaikanlagen auf Agrarflächen</Title>
<Abstract>Der Kartendienst (WMS-Gruppe) stellt Daten derjenigen Flächen dar, die für eine Bebauung mit Photovoltaikanlagen in Frage kommen.</Abstract>
<SRS>EPSG:4326</SRS>
<SRS>EPSG:31466</SRS>
<SRS>EPSG:31462</SRS>
<SRS>EPSG:3034</SRS>
<SRS>EPSG:3044</SRS>
<SRS>EPSG:3045</SRS>
<SRS>EPSG:4258</SRS>
<SRS>EPSG:4839</SRS>
<SRS>EPSG:25832</SRS>
<SRS>EPSG:25833</SRS>
<SRS>EPSG:31467</SRS>
<SRS>EPSG:31463</SRS>
<SRS>EPSG:3857</SRS>
<SRS>EPSG:102100</SRS>
<LatLonBoundingBox minx="6.501781" miny="49.114854" maxx="7.397016" maxy="49.620075"/>
<BoundingBox SRS="EPSG:4326" minx="6.501781" miny="49.114854" maxx="7.397016" maxy="49.620075"/>
<BoundingBox SRS="EPSG:31466" minx="2536621.9" miny="5442765.43" maxx="2600948.4" maxy="5498150.4438"/>
<BoundingBox SRS="EPSG:31462" minx="2536621.9" miny="5442765.43" maxx="2600948.4" maxy="5498150.4438"/>
<BoundingBox SRS="EPSG:3034" minx="3753416.124618" miny="2493322.050226" maxx="3818345.784241" maxy="2550090.562351"/>
<BoundingBox SRS="EPSG:3044" minx="317729.066955" miny="5441482.662355" maxx="384201.092098" maxy="5499375.560145"/>
<BoundingBox SRS="EPSG:3045" minx="-119729.823364" miny="5468221.956376" maxx="-48986.696687" maxy="5531122.728984"/>
<BoundingBox SRS="EPSG:4258" minx="6.501781" miny="49.114854" maxx="7.397016" maxy="49.620075"/>
<BoundingBox SRS="EPSG:4839" minx="-291607.140211" miny="-204714.693944" maxx="-224056.852809" maxy="-145543.420316"/>
<BoundingBox SRS="EPSG:25832" minx="317729.066955" miny="5441482.662355" maxx="384201.092098" maxy="5499375.560145"/>
<BoundingBox SRS="EPSG:25833" minx="-119729.823364" miny="5468221.956376" maxx="-48986.696687" maxy="5531122.728984"/>
<BoundingBox SRS="EPSG:31467" minx="3317678.327703" miny="5443103.627979" maxx="3384168.866647" maxy="5501013.120721"/>
<BoundingBox SRS="EPSG:31463" minx="3317678.327703" miny="5443103.627979" maxx="3384168.866647" maxy="5501013.120721"/>
<BoundingBox SRS="EPSG:3857" minx="723774.956147" miny="6294372.185085" maxx="823432.010586" maxy="6380737.6886"/>
<BoundingBox SRS="EPSG:102100" minx="723774.956147" miny="6294372.185085" maxx="823432.010586" maxy="6380737.6886"/>
<Layer queryable="0">
<Name>Photovoltaik_Agrarflaechen</Name>
<Title>Photovoltaikanlagen auf Agrarflächen</Title>
<Abstract>Der Kartendienst (WMS-Gruppe) stellt Daten derjenigen Flächen dar, die für eine Bebauung mit Photovoltaikanlagen in Frage kommen.</Abstract>
<KeywordList>
<Keyword>Agrarflächen</Keyword>
<Keyword>Photovoltaikanlagen</Keyword>
<Keyword>PV</Keyword>
</KeywordList>
<SRS>EPSG:102100</SRS>
<SRS>EPSG:25832</SRS>
<SRS>EPSG:25833</SRS>
<SRS>EPSG:3034</SRS>
<SRS>EPSG:3044</SRS>
<SRS>EPSG:3045</SRS>
<SRS>EPSG:31462</SRS>
<SRS>EPSG:31463</SRS>
<SRS>EPSG:31466</SRS>
<SRS>EPSG:31467</SRS>
<SRS>EPSG:3857</SRS>
<SRS>EPSG:4258</SRS>
<SRS>EPSG:4326</SRS>
<SRS>EPSG:4839</SRS>
<LatLonBoundingBox minx="6.501781" miny="49.114854" maxx="7.397016" maxy="49.620075"/>
<BoundingBox SRS="EPSG:4326" minx="6.501781" miny="49.114854" maxx="7.397016" maxy="49.620075"/>
<BoundingBox SRS="EPSG:31466" minx="2536621.9" miny="5442765.43" maxx="2600948.4" maxy="5498150.4438"/>
<BoundingBox SRS="EPSG:31462" minx="2536621.9" miny="5442765.43" maxx="2600948.4" maxy="5498150.4438"/>
<BoundingBox SRS="EPSG:3034" minx="3753416.124618" miny="2493322.050226" maxx="3818345.784241" maxy="2550090.562351"/>
<BoundingBox SRS="EPSG:3044" minx="317729.066955" miny="5441482.662355" maxx="384201.092098" maxy="5499375.560145"/>
<BoundingBox SRS="EPSG:3045" minx="-119729.823364" miny="5468221.956376" maxx="-48986.696687" maxy="5531122.728984"/>
<BoundingBox SRS="EPSG:4258" minx="6.501781" miny="49.114854" maxx="7.397016" maxy="49.620075"/>
<BoundingBox SRS="EPSG:4839" minx="-291607.140211" miny="-204714.693944" maxx="-224056.852809" maxy="-145543.420316"/>
<BoundingBox SRS="EPSG:25832" minx="317729.066955" miny="5441482.662355" maxx="384201.092098" maxy="5499375.560145"/>
<BoundingBox SRS="EPSG:25833" minx="-119729.823364" miny="5468221.956376" maxx="-48986.696687" maxy="5531122.728984"/>
<BoundingBox SRS="EPSG:31467" minx="3317678.327703" miny="5443103.627979" maxx="3384168.866647" maxy="5501013.120721"/>
<BoundingBox SRS="EPSG:31463" minx="3317678.327703" miny="5443103.627979" maxx="3384168.866647" maxy="5501013.120721"/>
<BoundingBox SRS="EPSG:3857" minx="723774.956147" miny="6294372.185085" maxx="823432.010586" maxy="6380737.6886"/>
<BoundingBox SRS="EPSG:102100" minx="723774.956147" miny="6294372.185085" maxx="823432.010586" maxy="6380737.6886"/>
<DataURL>
<Format>text/html</Format>
<OnlineResource xmlns:xlink="http://www.w3.org/1999/xlink" xlink:href="41945" xlink:type="simple"/>
</DataURL>
</Layer>
</Layer>
</Capability>
</WMT_MS_Capabilities>

Best Answer

The xml file is an error message that says "Parameter 'layers' contains unacceptable layer names." which I suspect is a reference to the umlaut in the layer name that they provide in the capabilities file and is an odd problem for a German web site not to have noticed but since it occurs in my browser as well as QGIS I think it is their problem not ours so you should probably contact the owners of the site and ask them to fix their server or sanitize their layer names.

Related Question