Take the 2-minute tour ×
Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. It's 100% free, no registration required.

I wanna teke capabilities from tomcat's geoserver. Use this.

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 url from capability request in browser get 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 look in firebut that can see that application was geted capabilities.

In standalone Geoserver all work fine.

share|improve this question
    
can you try to get your localhost:8080/geoserver. is it ok? or is there any error? –  Aragon May 22 '12 at 7:17
    
yes, i can see Geoserver on this url, its ok. –  Kliver Max May 22 '12 at 7:43
add comment

1 Answer

up vote 2 down vote accepted

Service parameter is mandatory for making requests to WMS services. Your URL should looks like:

http://localhost:8080/geoserver/wms/filedata?request=GetCapabilities&service=WMS
share|improve this answer
    
it not work too. –  Kliver Max May 22 '12 at 7:50
    
I find the error. If someone interest. Problem was in one of tomcat's geoserver standart layer. In capabilities was error text. javax.xml.transform.TransformerExeption: Translator error Translator error Error occurred trying to write out metadata for layer: Pk50095 Unable to acquire a reader for this coverage with format: WorldImage Have no idea why it happening. But when im delete this layer all start work fine. Tnx for your answers. –  Kliver Max May 22 '12 at 8:17
2  
It's a known issue: jira.codehaus.org/browse/GEOS-4544 –  unicoletti May 22 '12 at 9:51
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.