I want to take capabilities from tomcat's geoserver, using this code:
wms = new OpenLayers.Format.WMSCapabilities();
OpenLayers.Request.GET({
url:"http://localhost:8080/geoserver/wms/filedata?request=GetCapabilities",
success: function(e){
var response = wms.read(e.responseText);
var capability = response.capability;
for (var i=0, len=capability.layers.length; i<len; i+=1) {
var layerObj = capability.layers[i];
if (layerObj.name === 'filedata') {
map.zoomToExtent(OpenLayers.Bounds.fromArray(layerObj.llbbox));
break;
}
}
}
});
But firebug says that "capability is not defined" in this string:
for (var i=0, len=capability.layers.length; i<len; i+=1) {
If I write the url from capability request in a browser, I get the error:
XML Parsing Error: XML or text declaration not at start of entity
Adress: http://localhost:8080/geoserver/wms/filedata?request=GetCapabilities
Line number 5091, column 21: <Abstract><?xml version="1.0" encoding="UTF- 8"?>
<ServiceExceptionReport version="1.3.0" xmlns="http://www.opengis.net/ogc"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.opengis.net/ogc http://localhost:8080/
geoserver/schemas/wms/1.3.0/exceptions_1_3_0.xsd"> <ServiceException>
--------------------^
But if I look in firebug, I can see that application got the capabilities.
In standalone Geoserver all works fine.