dev@jax-ws.java.net

Re: MessageContext HTTP Status code and ResponseCode

From: Kohsuke Kawaguchi <Kohsuke.Kawaguchi_at_Sun.COM>
Date: Mon, 07 Aug 2006 13:57:18 -0700

kathy walsh wrote:
> So given the current programming model in JAX-WS rearch,
> how might you suggest we fix this problem? I would like to get this bug fix
> in tonight's build without causing side effects. Your quick response
> would be
> appreciated.

If it's not strictly a requirement to preserve the original behavior, I
think the right thing to do is to capture such information into the
exception being thrown. That is, if the HTTP transport decided to throw
an exception because of 404, then the exception should indicate so. We
could define a custom exception type that carries related information,
such as the URL, the HTTP status code, or even the whole HTTP response
(which might reveal more useful information.)

Generally speaking, exceptions should capture as much information as
possible, so this kind of enhancements are along this line and useful on
its own.

Between when a client application sends a request and receives a
message, there are a lot of things that can go wrong. Having all those
points report back diagnostic information via a general "response
context" isn't actually that useful, because when you catch
WebServiceException, the caller has no way of knowing what kind of
details to look for.



That said, if it's a requirement to keep the original behavior, then I
need to do more thinking. I can't think of a clean way of doing this
right now.


-- 
Kohsuke Kawaguchi
Sun Microsystems                   kohsuke.kawaguchi_at_sun.com