Issue Type: Bug Bug
Assignee: Jody Garnett
Components: wms extension
Created: 10/Sep/12 5:29 AM
Description:

WMS1_1_1 overrides and sets VERSION to "1.1.1" only for createGetCapabilitiesRequest(), createGetMapRequest() and createGetFeatureInfoRequest().

Other methods in WMS1_1_0, among which createDescribeLayerRequest() are not overridden which means that these are performed with the VERSION parameter set to "1.1.0".

This breaks GeoServer DescribeLayer which throws an error:

<ServiceException code="InvalidVersion" locator="DescribeLayerKvpRequestReader">
      Wrong value for version parameter: 1.1.0. This server accetps version 1.1.1
</ServiceException>

Code example / OnlineTest code:

WebMapServer wms = new WebMapServer(new URL("http://localhost:8080/geoserver/ows")) {
    protected void setupSpecifications() {
        specs = new Specification[] {
            new WMS1_1_1() // GeoServer supports no DescribeLayer in WMS 1.3.0 capabilities
        };
    }
};
System.out.println("Capabilities version: " + wms.getCapabilities().getVersion());
DescribeLayerRequest dlr = wms.createDescribeLayerRequest();
dlr.setLayers("tiger:giant_polygon");
System.out.println("DescribeLayer URL: " + dlr.getFinalURL());
System.out.println(wms.issueRequest(dlr).getLayerDescs());

Output:

Capabilities version: 1.1.1
DescribeLayer URL: http://localhost:8084/geoserver/wms?REQUEST=DescribeLayer&LAYERS=tiger:giant_polygon&VERSION=1.1.0&SERVICE=WMS
Exception in thread "main" java.lang.ClassCastException: org.geotools.ows.ServiceException cannot be cast to [Lorg.geotools.data.ows.LayerDescription;
	at org.geotools.data.wms.response.DescribeLayerResponse.<init>(DescribeLayerResponse.java:63)
	at org.geotools.data.wms.WMS1_1_0$InternalDescribeLayerRequest.createResponse(WMS1_1_0.java:196)
	at org.geotools.data.ows.AbstractOpenWebService.internalIssueRequest(AbstractOpenWebService.java:432)
	at org.geotools.data.wms.WebMapServer.issueRequest(WebMapServer.java:431)

(also the the error handling for DescribeLayer is not very useful).

Workaround is to add the following before calling issueRequest():

dlr.setProperty("VERSION", wms.getCapabilities().getVersion());

A fix would be to override all the WMS1_1_0 methods for all requests, or maybe use the getVersion() virtual method call to set the VERSION so overriding is not necessary if only the version parameter is different. This would be a lot less code.

Project: GeoTools
Priority: Minor Minor
Reporter: Matthijs Laan
This message is automatically generated by JIRA.
If you think it was sent incorrectly, please contact your JIRA administrators.
For more information on JIRA, see: http://www.atlassian.com/software/jira
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
GeoTools-Devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/geotools-devel

Reply via email to