1

This question already has an answer here:

Using WMS I do a GetCapabilities request on a GeoServer instance. This works in FireFox, but not in Chrome, Safari, and Internet Explorer.

The point is that in the web.xml from the server I did add:

"Access-Control-Allow-Origin: *"

So the XML output does not have anything which will put the Access-Control-Allow-Origin header in.

And the case is that in any other request this not an issue, especially when I use jsonp in the jquery AJAX call.

However I didn't find any way to get the Capabilities in a JSON object. In other words I am stuck with XML and this doesn't seem to work.

Is there a way to do the request on jsonp? If not how do I set-up the server so that the GetCapabilities XML does use the Access-Control-Allow-Origin?

marked as duplicate by Ian Turton Jul 30 '17 at 16:12

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    I'd be very surprised if you can get the response in JSON; the WMS spec is all XML based. – GIS-Jonathan Dec 17 '14 at 16:26
  • Well I didn't think I would be able to get it in JSON, at least, not the GetCapaBilities, others might be possible. – user41394 Dec 18 '14 at 10:25
  • A WMS GetCapabilities response document is always an XML document, the same is true of all OGC OWS services (such as WFS, WCS, WPS, CSW, SOS). – nmtoken Nov 22 '16 at 19:06
  • So the XML output does not have anything which will put the Access-Control-Allow-Origin header in. I'm not sure I understand this comment, the Access-Control-Allow-Origin header is always in the HTTP header, never in a file whether it be XML or JSON, and this behaviour is configured on the server providing the XML/JSON documents – nmtoken Nov 22 '16 at 19:14