[mapserver-users] WMS Client Error Handling

Daniel Morissette dmorissette at mapgears.com
Tue Sep 15 20:15:01 EDT 2009


Chris Hodgson wrote:
> I'm implementing a WMS proxy server using PHP mapscript. I'm fetching 
> the capabilities programmatically and storing them in a database and 
> then building a mapfile on the fly. The mapfile contains multiple 
> "connectiontype WMS" layers, and I'd like to be able to (a) determine 
> when one of the WMS client requests has failed, and (b) get the error 
> message returned for each failed layer. I'm starting to think this may 
> not be possible currently, and it seems that the code for doing anything 
> like this has been pushed back for a while [ 
> http://trac.osgeo.org/mapserver/ticket/1246 ].
> 
> Any chance that I'm wrong and there is already a way to do this? Anybody 
> else interested in this feature? Anybody already done something like this?
> 

Ticket 1246 is only about the *default* exception format, but using the 
wms_exceptions_format metadata you can override the default and request 
text/xml or application/vnd.ogc.se_xml exceptions (depending on WMS 
version).

Then if an exception is received MapServer will try to read the 
exception message and pass it to msSetError() with an error code of 
MS_WMSERR (24). This does not cause a fatal error and won't stop your 
script though, the message is only stored in the error stack. In 
MapScript you should be able to read the error stack (errorObj) and 
extract the error messages.

More about the errorObj at 
http://mapserver.org/trunk/en/mapscript/php/index.html#errorobj-class

I think the handling of WMS exceptions could be greatly improved, but 
you may be able to get along with this basic stuff.

Daniel
-- 
Daniel Morissette
http://www.mapgears.com/


More information about the mapserver-users mailing list