Thanks Daniel, that seems to be working well. The biggest problem I have is that I need to parse the name of the layer that had the error out of the error->message - this works but obviously the format of the error message could change in the future which would break my parser. I guess there is potentially a lot of different things that could be involved in the error so having a separate field in the error object for each of them might be too much to ask, but a field for the layer name would certainly be handy for me in this case :)

Cheers,
Chris

Daniel Morissette wrote:
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

_______________________________________________
mapserver-users mailing list
[email protected]
http://lists.osgeo.org/mailman/listinfo/mapserver-users

Reply via email to