[mapserver-users] how to throw a custom ExceptionReport

Charlton Galvarino charlton at 2creek.com
Wed Dec 10 11:36:03 EST 2008


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.

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



More information about the mapserver-users mailing list