Looking at the JAX-WS 2.0 spec:
{{{
The following standard exceptions are defined by JAX-WS.
''javax.xml.ws.WebServiceException'' A runtime exception that is
thrown by methods in JAX-WS APIs when errors occur during local
processing.
''javax.xml.ws.ProtocolException'' A base class for exceptions
related to a specific protocol binding. Subclasses are used to
communicate protocol level fault information to clients and may be
used by a service implementation to control the protocol specific
fault representation.
''javax.xml.ws.soap.SOAPFaultException'' A subclass of
ProtocolException, may be used to carry SOAP specific information.
''javax.xml.ws.http.HTTPException'' A subclass of ProtocolException,
may be used to carry HTTP specific information.
}}}
Are these recommended exception types, when writing CXF applications?
The reason I ask is this. My interceptors are designed to raise
org.apache.cxf.interceptor.Fault exteptions under error conditions,
as this seems to be the prescribed behavior. Why do I think this?
Not sure. I think I read it somewhere. (Sorry I can't be more
specific). These exceptions are being thrown from server-side
interceptors.
What I'm finding is, my client is getting exceptions of type
org.apache.cxf.binding.soap.SoapFault. Tracing the inheritance tree,
we basically seem to have:
+ java.lang.RuntimeException
|
+ org.apache.cxf.common.i18n.UncheckedException
|
+ org.apache.cxf.interceptor.Fault
|
+ org.apache.cxf.binding.soap.SoapFault
No javax.ws.xml.* to be found. Am I throwing the wrong types from my
interceptors? Is there any guidance for what to do here? (Apologies
for the naivete of the question)
As an aside, is there an analogue to CORBA::SystemException and
CORBA::UserException (and their descendents) in jax-ws? The somewhat
nice thing about exceptions of that type is that it is a catch-all
for problems with the plumbing, as opposed to problems with the
application, which can form a convenient switch in a lot of code.
PS> It's a shame exceptions aren't interfaces in Java. (It's also a
shame Java doesn't support multiple inheritance, but I won't ignite
another holy war! :)
-Fred