[mapserver-users] how to throw a custom ExceptionReport

Kralidis,Tom [Ontario] Tom.Kralidis at ec.gc.ca
Wed Dec 10 08:41:55 PST 2008


 

> -----Original Message-----
> From: mapserver-users-bounces at lists.osgeo.org 
> [mailto:mapserver-users-bounces at lists.osgeo.org] On Behalf Of 
> Charlton Galvarino
> Sent: Wednesday, 10 December 2008 11:36
> To: Mapserver Users (mapserver-users at lists.osgeo.org)
> Subject: [mapserver-users] how to throw a custom ExceptionReport
> 
> Hi, all.  I intercept WMS calls on a regular basis using Perl 
> CGI and a final print redirect('mapserv?...'); to actually 
> send the WMS request along.
> 
> I have the case where I'd like to throw a custom 
> ExceptionReport, but I haven't had much luck so far in 
> getting mapserver not to misunderstand it and throw its own 
> WMS ServiceException.
> 
> What I'm trying to do is to communicate to the user, "Hey, 
> you've asked for a file I don't have."
> 
> So what I have is an incoming WMS request.  I snag the 
> request, try to find a matching file.  If I find it, great, I 
> send the image generation request along and pass it back 
> thru.  If it doesn't, I'd like to spit out the XML message.
> 
> I copied the structure of a mapserver msg and tried making it my own.
> 
> print $query->header('text/xml');
> print <<EOH;
> <?xml version='1.0' encoding="ISO-8859-1" standalone="no" ?> 
> <!DOCTYPE ServiceExceptionReport SYSTEM 
> "http://schemas.opengeospatial.net/wms/1.1.1/exception_1_1_1.dtd">
> <ServiceExceptionReport version="1.1.1"> <ServiceException> 
> Sorry, Charlie, you're out of luck.
> </ServiceException>
> </ServiceExceptionReport>
> EOH
> exit;
> 
> But I think I'm confusing myself of how my error messages 
> interface w/ mapserver's.
> 

You can use Perl mapscript WxS to intercept and return a custom
exception.  Check out
http://mapserver.gis.umn.edu/docs/howto/wxs_mapscript for info and
examples.

Hope this helps.

..Tom

> Thanks for any advice.
> 
> 
> 
> 
> Charlton Galvarino
> 1 (803) 233-6205 : voice
> 1 (803) 223-9579 :   fax
> charlton at 2creek.com
> 
> P.O. Box 50960
> Columbia, SC 29250
> 
> _______________________________________________
> mapserver-users mailing list
> mapserver-users at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/mapserver-users
> 



More information about the MapServer-users mailing list