How to set a SOAP fault message's faultcode element

From: Simon Horrell <>
Date: Thu, 23 May 2002 18:32:31 +0100

I am trying to figure out how to pass back a specific faultcode to a client
within a SOAP fault message. The RI uses a faultcode of env:Server
(xmlns:env="") for service-specific
exceptions and it doesn't seem possible for me to influence this and pass,
for example, env:Client.

I tried throwing a SOAPFaultException in my method implementation and
setting the faultcode programmatically. Of course, because
SOAPFaultException is a checked exception, this meant that the method in my
Java service definition interface had to throw SOAPFaultException as part of
its signature. Fair enough. The RI's xrpcc tool complained that
SOAPFaultException was not supported as an exception type.

Next, I authored the WSDL and made the faults 'literal' to try and force
xrpcc to generate a method that threw SOAPFaultException but xrpcc ignored

Of course, even if either of these techniques had worked I would end up with
a 'literal' fault on the wire which isn't necessarily what I require.

What is the generally accepted technique for doing this?