AW: [OpenLayers-Users] WMSCapabilities

Morper-Busch, Lucia Lucia.Morper-Busch at sbg.ac.at
Sat Apr 28 16:19:06 EDT 2012


After trying and searching finally I discovered the error!
The capabilities-XML of my Geoserver was corrupted! The xml structure was interrupted by the following ServiceExceptionReport:
 
<ServiceExceptionReport version="1.1.1" > <ServiceException>javax.xml.transform.TransformerException: 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</ServiceException></ServiceExceptionReport>

The xml-tags weren't closed. And so the document could not be read and parsed.

But the Pk50095-layer is an example layer of Geoserver, not added by me. That is very strange. Anyway, I deleted the layer, and the request gave me the desired response. 

Lucia


________________________________

Von: openlayers-users-bounces at lists.osgeo.org im Auftrag von Morper-Busch, Lucia
Gesendet: Fr 27.04.2012 17:18
An: openlayers-users at lists.osgeo.org
Betreff: [OpenLayers-Users] WMSCapabilities



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
_______________________________________________
Users mailing list
Users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/openlayers-users


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/openlayers-users/attachments/20120428/097c1b47/attachment.html


More information about the Users mailing list