The handling of the "service-not-found" error is broken
in Jeeves.
To observe:
1. Note the definition in web/geonetwork/WEB-INF/config.xml:
<!-- service not found -->
<error id="service-not-found" sheet="error.xsl">
<xml name="error" file="xml/service-not-found-error.xml"
/>
</error>
2. Bring up the GN "front page" in a browser, edit
the URL to replace "main.home" with e.g. "dummy".
3. You get the raw XML of the stacktrace, but you
_should_ get the nice formatted error page as
specified in config.xml.
I attach a patch for Jeeves. Please check it carefully!
(I am submitting this patch with some fear and trembling
because on looking through the
Jeeves SVN repository it seems this
bit of code has had a few modifications over the years
but it has only ever been "almost" right. Certainly the
code as it stands _looks_ wrong - the third branch
of the "else if" test, i.e., "srvInfo == null", is followed in
the "else" branch by a test "srvInfo != null". And indeed
it seems the handling of the "service-not-found" error has
never worked correctly - but I am wondering if my patch breaks
the handling of _some other_ error(s).)
--
Richard Walker
Software Improvements Pty Ltd
Phone: +61 2 6273 2055
Fax: +61 2 6273 2082
(attachments)
jeevespatch1.txt (609 Bytes)
Hello all
Along the same lines as "The handling of the "service-not-found" error
is broken in Jeeves, error reporting for XML services such as
xml.metadata.get should return its errors as XML statements rather as
HTML pages. When we access GeoNetwork externally as a metadata server,
we expect XML as a return, not the HTML error message.
JF
Hi Richard,
I think that indeed fixed the problem. My testing did not show other problems related to this change (and I also hope I'm right
). I've made it part of the 2.2.0 final code.
Thanks! Ciao,
Jeroen
On Apr 1, 2008, at 8:43 AM, Software Improvements gn-devel wrote:
The handling of the "service-not-found" error is broken
in Jeeves.
To observe:
1. Note the definition in web/geonetwork/WEB-INF/config.xml:
<!-- service not found -->
<error id="service-not-found" sheet="error.xsl">
<xml name="error" file="xml/service-not-found-error.xml"
/>
</error>
2. Bring up the GN "front page" in a browser, edit
the URL to replace "main.home" with e.g. "dummy".
3. You get the raw XML of the stacktrace, but you
_should_ get the nice formatted error page as
specified in config.xml.
I attach a patch for Jeeves. Please check it carefully!
(I am submitting this patch with some fear and trembling
because on looking through the
Jeeves SVN repository it seems this
bit of code has had a few modifications over the years
but it has only ever been "almost" right. Certainly the
code as it stands _looks_ wrong - the third branch
of the "else if" test, i.e., "srvInfo == null", is followed in
the "else" branch by a test "srvInfo != null". And indeed
it seems the handling of the "service-not-found" error has
never worked correctly - but I am wondering if my patch breaks
the handling of _some other_ error(s).)
--
Richard Walker
Software Improvements Pty Ltd
Phone: +61 2 6273 2055
Fax: +61 2 6273 2082
Index: src/jeeves/server/dispatchers/ServiceManager.java
--- src/jeeves/server/dispatchers/ServiceManager.java (revision 57)
+++ src/jeeves/server/dispatchers/ServiceManager.java (working copy)
@@ -443,7 +443,7 @@
req.write(SOAPUtil.embedExc(error, sender, id, message));
}
- else if (input == InputMethod.XML || output == OutputMethod.XML || srvInfo == null)
+ else if (input == InputMethod.XML || output == OutputMethod.XML)
{
req.setStatusCode(code);
req.beginStream("application/xml; charset=UTF-8", cache);
-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://ad.doubleclick.net/clk;164216239;13503038;w?http://sf.net/marketplace
_______________________________________________
GeoNetwork-devel mailing list
GeoNetwork-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geonetwork-devel
GeoNetwork OpenSource is maintained at http://sourceforge.net/projects/geonetwork
Jean-Francois Meunier wrote:
Hello all
Along the same lines as "The handling of the "service-not-found" error
is broken in Jeeves, error reporting for XML services such as
xml.metadata.get should return its errors as XML statements rather as
HTML pages. When we access GeoNetwork externally as a metadata server,
we expect XML as a return, not the HTML error message.
Umm . . . that _does_ seem to work,
with or without my patch.
Here's a quick test to show this working.
Use a terminal window and the "telnet" command.
Connect to your GN instance directly thus:
telnet localhost 8080
(Replace hostname and port number as appropriate.)
Now enter one of these three things, pressing
Enter twice at the end so as to get a blank line
to signal the end of the request.
1. To get an error page in HTML:
GET /geonetwork/srv/en/xml.metadata.get HTTP/1.0
2. To get an error as "raw" XML:
GET /geonetwork/srv/en/xml.metadata.get HTTP/1.0
Accept: application/xml
3. To get an error as a SOAP envelope:
GET /geonetwork/srv/en/xml.metadata.get HTTP/1.0
Accept: application/soap+xml
Hey, this is even documented! (Well, sort of.)
See the chapter "XML Services" of the manual.
--
Richard Walker
Software Improvements Pty Ltd
Phone: +61 2 6273 2055
Fax: +61 2 6273 2082