Opened 19 years ago

Last modified 15 years ago

#1246 assigned defect

WMS client defaults to optional exceptions format for GetMap

Reported by: bartvde@… Owned by: dmorissette
Priority: high Milestone: 6.0 release
Component: WMS Client Version: 4.5
Severity: normal Keywords:
Cc: jmckenna@…, pspencer@…, havard.tveite@…

Description (last modified by dmorissette)

Looking at the source code, Mapserver WMS client, always uses the inimage
type of exceptions in its WMS request:
 
        if (nVersion >= OWS_1_1_0)
            pszExceptionsParam = "application/vnd.ogc.se_inimage";
        else
            pszExceptionsParam = "INIMAGE";

But, application/vnd.ogc.se_inimage is an *optional* exception format in
the WMS spec, so I think your idea would be good of being able to override
this as a user. This is a necessary enhancement, since the default
requested exception format is an optional one, and I would suggest you to
open an enhancement bug for this in the Mapserver bugzilla. Something like
wms_exception_format/ows_exception_format METADATA.

This may also involve some more error handling in Mapserver WMS client
though, since it is not expecting XML type of exceptions for GetMap right
now. So it might not be as straightforward as it looks to implement this.

Change History (15)

comment:1 by dmorissette, 19 years ago

Milestone: 4.6 release
Bart, I'll mark this with "4.6 release" target milestone, let's hope that we can
get back to it before the release, but as you wrote this is not trivial to fix
if we want to do it well, so I'm not sure when we'll have time.

comment:2 by havard.tveite@…, 19 years ago

Cc: havard.tveite@… added

comment:3 by bartvde@…, 19 years ago

Daniel, what kind of error would Mapserver give if a LAYER had TYPE RASTER and a
DATA statement to a tmp file which is actually an XML file? Unable to draw layer
....

If this "error handling" is acceptable, then maybe we should just change the
exception format to the required XML one (application/vnd.ogc.se_xml). That will
be better than the situation we have now.

Or we could do a brief check to see if the tmp file is XML or text, and don't
try to draw the layer in that case. This could be an acceptable and quick solution.

The exact errors won't get to the user, but that could be new enhancement bug
further down the road.

Bart

comment:4 by dmorissette, 19 years ago

Cc: mapserver-bugs@… added
Owner: changed from mapserverbugs to dmorissette@…
Perhaps we should look at the MIME type of the response to decide if it's an XML
or OGC exception format and behave accordingly (i.e. parse the exception and
pass it to msSetError(). We'd fetch this information with the following Curl
call in msHTTPExecuteRequests():

curl_easy_getinfo(http_handle, CURLINFO_CONTENT_TYPE, ...)

comment:5 by dmorissette, 19 years ago

Status: newassigned
I'll start by reading the content type from Curl now, but may not have time to
fix the whole thing today.

comment:6 by dmorissette, 19 years ago

Cc: pspencer@… added
I've done a first pas at this (in 4.6 CVS):

1- Fetch GetMap response content-type from CURL, stored in psRed->pszContentType
2- Before rendering a layer, mapwmslayer.c checks the content-type, if it's
text/xml, or application/vnd.ogc.se_xml then it assumes it's an exception. For
the moment I just read the first 2k from the response and pass that to
msSetError() + msDebug(). The map draw() call is not aborted, but the exception
is available in the error stack to MapScript and in the error_log if layer has
DEBUG TRUE. 
3- You can set "wms_exceptions_format" to "application/vnd.ogc.se_xml" in the
WMS layer's metadata to request XML exceptions.

ToDo:
- Parse the Exception XML to extract the exception code and message and pass
only that to msSetError()
- Perhaps try to be smarter about detecting whether the returned MIME type is
the expected image format?
- Port this to the WFS and WCS code as well
- I think Bart wrote that INIMAGE was optional in the spec so maybe it should
not be the default and XML should be the default instead? Need to look into that

comment:7 by bartvde@…, 19 years ago

Daniel, inimage is optional so should not be the default.

Page 37 of WMS 1.1.1 spec:

application/vnd.ogc.se_xml (required)
application/vnd.ogc.se_inimage (optional)
application/vnd.ogc.se_blank (optional)

comment:8 by dmorissette, 19 years ago

Actually, it's not that simple:

In WMS 1.0.0, INIMAGE was the default, and it wasn't specified which ones were
optional or required (or I didn't see any mention anyway), but one could assume
that if INIMAGE was the default then it's kind of important to support it.

In WMS 1.0.0, the MIME types changed to the application/vnd.ogc.*, and se_xml
was made the default exception format. Still no clear statement of which ones
are required and which ones are optional that I can find.

In WMS 1.1.0, as you pointed, the XML format is teh default and is clearly
marked as being the only required one.

So it seems that for WMS 1.0.0+ we need to change our default exception format
to XML.

comment:9 by dmorissette, 19 years ago

Doh! typos in the WMS versions above... should have been:

In WMS 1.0.0, INIMAGE was the default, and it wasn't specified which ones were
optional or required (or I didn't see any mention anyway), but one could assume
that if INIMAGE was the default then it's kind of important to support it.

In WMS 1.1.0, the MIME types changed to the application/vnd.ogc.*, and se_xml
was made the default exception format. Still no clear statement of which ones
are required and which ones are optional that I can find.

In WMS 1.1.1, as you pointed, the XML format is teh default and is clearly
marked as being the only required one.


comment:10 by bartvde@…, 19 years ago

Good catch Daniel. I had only looked at 1.1.1 and expected it to be similar in
previous versions. They don't make it easy at the OGC for us sometimes .....

comment:11 by jmckenna@…, 18 years ago

i have added a "wms_exceptions_format" metadata description and example in the
wms-client doc.  Thanks Bart for adding the comment.

comment:12 by jmckenna@…, 18 years ago

Cc: jmckenna@… added

comment:13 by dmorissette, 17 years ago

Description: modified (diff)
Milestone: 5.0 release5.2 release

Status update:

There is a "wms_exceptions_format" metadata that can be used to override the exception format for a given WMS layer. However the default is still in-image in all cases and we should change the default at least for WMS 1.1.1+, and also make sure that MapServer is able to ingest the XML exceptions properly in that case.

comment:14 by dmorissette, 16 years ago

Milestone: 5.2 release5.4 release

comment:15 by dmorissette, 15 years ago

Milestone: 5.4 release6.0 release
Note: See TracTickets for help on using tickets.