|
From: Ronald v. K. <rv...@ab...> - 2003-11-01 19:37:10
|
Hi,
I'm playing a little with time-to-live from the monitor application.
When I send a message with a time-to-live of 1d (one day) which is of
course in the wrong format. I get a nice error message back with a
"ValueNotRecognized" error:
<eb:ErrorList
xmlns:eb="http://www.oasis-open.org/committees/ebxml-msg/schema/msg-header-2_0.xsd"
soap-env:mustUnderstand="1" eb:version="2.0" eb:highestSeverity="Error">
<eb:Error eb:errorCode="ValueNotRecognized" eb:severity="Error">
<eb:Description xml:lang="en-US">
Value cannot be parsed / recognized
</eb:Description>
</eb:Error>
</eb:ErrorList>
IMHO there are two things wrong with this error. The long description of
"ValueNotRecognized" according to the specs is:
Although the document is well formed and valid, the element/ attribute
contains a value that could not be recognized and therefore could not be
used by the ebXML Message Service.
According to the ebxml-ms schema type of TimeToLive is dateTime:
<element name="TimeToLive" type="dateTime"/>
But... all the long descriptions in the ebxml specs mention "well formed
and valid". Probably because they expect a schema-check to have taken
place before the document will be parsed by an MSH. So I do not know
what is the correct error to return in a situation like this. So making
the error more specific and/or including the location in the form of an
xpath statement.
But shouldn't we also do a validation check before sending out the
message? Since the error comes back from the MSH, the creation of the
message in the Monitor probably does not include a validation of the
message. I think we should include at least one of these (use the
location in the error, or validate the message on creation) . The code
that generates the message is in MessageServiceHandler.java:
if (ttlString != null) {
final Date timestamp = Utility.fromUTCString(ttlString);
EbxmlMessage errorMessage = null;
if (timestamp == null) {
String err = ErrorMessages.getMessage(
ErrorMessages.ERR_HERMES_DATA_ERROR,
"cannot recognize TTL value in message");
logger.warn(err);
errorMessage = generateErrorMessage
(ebxmlMessage, ErrorList.CODE_VALUE_NOT_RECOGNIZED,
ErrorList.SEVERITY_ERROR,
"Value cannot be parsed / recognized");
}
I think we should use the errorstring (err, or at least the
"cannot.....message" part) be used instead of the "Value cannot be
parsed / recognized" or the other signature of generateErrorMessage
which includes the location?
Ronald
|