Sets this
SOAPFault
object with the given fault code.
Fault codes, which give information about the fault, are defined
in the SOAP 1.1 specification. A fault code is mandatory and must
be of type Name
. This method provides a convenient
way to set a fault code. For example,
SOAPEnvelope se = ...;
// Create a qualified name in the SOAP namespace with a localName
// of "Client". Note that prefix parameter is optional and is null
// here which causes the implementation to use an appropriate prefix.
Name qname = se.createName("Client", null,
SOAPConstants.URI_NS_SOAP_ENVELOPE);
SOAPFault fault = ...;
fault.setFaultCode(qname);
It is preferable to use this method over
SOAPFault.setFaultCode(String)
.
Parameters:
-
faultCodeQName - a
Name
object giving the fault
code to be set. It must be namespace qualified.
Throws:
-
SOAPException - if there was an error in adding the
faultcode element to the underlying XML tree.
Since:
SAAJ 1.2
See Also:
SOAPFault.getFaultCodeAsName()
,