File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes unexpected result when throwing SOAPFaultException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Head First Android this week in the Android forum!
JavaRanch » Java Forums » Java » Web Services
Bookmark "unexpected result when throwing SOAPFaultException " Watch "unexpected result when throwing SOAPFaultException " New topic

unexpected result when throwing SOAPFaultException

michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50

I find that when I throw a SOAPFaultException from a handler's handleRequest method the request is returned to the client as is, whereas I was expecting the SOAPFaultException to be used to automatically generate a fault repsonse.

If I throw a runtime exception then a fault repsonse is returned.

I've had a search for this and looked at sites like
IBM's Exception Handling with JAX-RPC , but still am none the wiser as to whether what I'm expecting is wrong.

Any ideas ?

I'm using Sun's Application Server 8.2 i.e. SAAJ 1.2 and I think JAX-RPC 1.1
michael warren
Ranch Hand

Joined: Oct 20, 2006
Posts: 50
Just to update, I have found this :

is then the responsibility of the current handler (or other handlers in
the chain) to create the SOAP fault

Which suggests that what I assumed was wrong and that when throwing SOAPFaultException from a handler your code also needs to change the body of the response to be a fault, which seems a bit convoluted - whats the point of populating the SOAPFaultException ?
I'm not using latest version of JAX-RPC (or JAX-WS which I think replaces it) as I'm studying for SCDJWS, so perhaps this isn't an issue anymore.
I agree. Here's the link:
subject: unexpected result when throwing SOAPFaultException
It's not a secret anymore!