I can get a WMS GetCapabilities response via AJAX call and I can convert response to JSON using ol.format.WMSCapabilities tool.
But I need to make a WFS GetCapabilities query via a AJAX request and get a JSON result.
How can I do it?
My GetCapabilities operation metadata is like this:
Best Answer
For versions of the WFS interface standard prior to version 2.0, the only format supported as a response was XML.
From WFS version 2.0 whilst a WFS GetCapabilites defaults to XML a request can now include an
AcceptFormats
parameter which must include the"text/xml"
value, but may include other vendor specified formats.So you could make a request like:
http://aWFSsever/wfs?request=GetCapabilities&service=WFS&AcceptFormats=application/json,text/xml&
If the server supports WFS 2.0 it will give you a JSON response if it supports it as a GetCapabilites response format, otherwise it will give you XML. If the server is not WFS 2.0 it will ignore the AcceptFormats parameter and give you XML.