users@jax-rpc.java.net

Re: How to set a SOAP fault message's faultcode element

From: Simon Horrell <simonh_at_develop.com>
Date: Fri, 24 May 2002 08:38:35 +0100

OK, so I see that SOAPFaultException changed from a checked to a runtime
exception after the 0.7 release of the spec and is no longer tied to literal
representation. I am happy and await the FCS release.
Si.

----- Original Message -----
From: "Simon Horrell" <simonh_at_DEVELOP.COM>
To: <JAXRPC-INTEREST_at_JAVA.SUN.COM>
Sent: Thursday, May 23, 2002 6:32 PM
Subject: How to set a SOAP fault message's faultcode element


> 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="http://schemas.xmlsoap.org/soap/envelope/") 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
> it.
>
> 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?
>
> Si.