[OpenLayers-Users] WMSCapabilities

Morper-Busch, Lucia Lucia.Morper-Busch at sbg.ac.at
Fri Apr 27 11:18:46 EDT 2012


Hello,
I want to read the WMS capability xml, in order to get the abstract and
the metadata link of each layer.

My code is:

var request = OpenLayers.Request.GET({
	url: url +
'?service=wms&version=1.1.1&format=text/xml&request=getcapabilities'
	,success: function(response){
		//alert(response.responseText);
		var obj = new
OpenLayers.Format.WMSCapabilities.v1_1_1().read(response.responseText);
//var obj = new
OpenLayers.Format.WMSCapabilities().read(response.responseText);
		var capability = obj.capability;
		for (var i=0, len=capability.layers.length; i<len; i++)
{
			var layerObj = capability.layers[i];
			alert(layerObj.name);
		}
	}
})

The error is: "capability is undefined"

But "response.responseText" gives me the right xml as text.
"response.responseXML" is null.

response properties:

	_object: [object XMLHttpRequest]
	_listeners:
	_async: true
	readyState: 4
	responseXML: null
	statusText: OK
	status: 200
	priority: NORMAL

I use a proxy, that works fine for getFeatureInfo-Requests.

What is my problem?

Thank you
Lucia

Dipl.-Geogr. Lucia Morper-Busch | Researcher
University of Salzburg | Centre for Geoinformatics - Z_GIS
Schillerstr.30 | Techno-Z, Block 15, 3rd floor, Room 320 | 5020
Salzburg, Austria
Phone +43 (0)662 8044 5298 | Fax +43 (0)662 8044 5260
> Z_GIS...experts for the spatial view


More information about the Users mailing list