com.sun.xml.ws.fault
Class SOAPFaultBuilder

java.lang.Object
  extended by com.sun.xml.ws.fault.SOAPFaultBuilder

public abstract class SOAPFaultBuilder
extends java.lang.Object

Base class that represents SOAP 1.1 or SOAP 1.2 fault. This class can be used by the invocation handlers to create an Exception from a received messge.


Field Summary
static boolean captureStackTrace
          Set to false if you don't want the generated faults to have stack trace in it.
 
Constructor Summary
SOAPFaultBuilder()
           
 
Method Summary
static SOAPFaultBuilder create(Message msg)
          Parses a fault Message and returns it as a SOAPFaultBuilder.
 java.lang.Throwable createException(java.util.Map<javax.xml.namespace.QName,CheckedExceptionImpl> exceptions)
          This should be called from the client side to throw an Exception for a given soap mesage
static Message createSOAPFaultMessage(SOAPVersion soapVersion, CheckedExceptionImpl ceModel, java.lang.Throwable ex)
          To be called by the server runtime in the situations when there is an Exception that needs to be transformed in to a soapenv:Fault payload.
static Message createSOAPFaultMessage(SOAPVersion soapVersion, CheckedExceptionImpl ceModel, java.lang.Throwable ex, javax.xml.namespace.QName faultCode)
          Create the Message with the specified faultCode
static Message createSOAPFaultMessage(SOAPVersion soapVersion, javax.xml.ws.ProtocolException ex, javax.xml.namespace.QName faultcode)
          To be called to convert a ProtocolException and faultcode for a given SOAPVersion in to a Message.
static Message createSOAPFaultMessage(SOAPVersion soapVersion, javax.xml.soap.SOAPFault fault)
           
static Message createSOAPFaultMessage(SOAPVersion soapVersion, java.lang.String faultString, javax.xml.namespace.QName faultCode)
          Server runtime will call this when there is some internal error not resulting from an exception.
 javax.xml.namespace.QName getFirstDetailEntryName()
           
protected abstract  java.lang.Throwable getProtocolException()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

captureStackTrace

public static final boolean captureStackTrace
Set to false if you don't want the generated faults to have stack trace in it.

Constructor Detail

SOAPFaultBuilder

public SOAPFaultBuilder()
Method Detail

getFirstDetailEntryName

@Nullable
public javax.xml.namespace.QName getFirstDetailEntryName()

createException

public java.lang.Throwable createException(java.util.Map<javax.xml.namespace.QName,CheckedExceptionImpl> exceptions)
                                    throws javax.xml.bind.JAXBException
This should be called from the client side to throw an Exception for a given soap mesage

Throws:
javax.xml.bind.JAXBException

createSOAPFaultMessage

@NotNull
public static Message createSOAPFaultMessage(@NotNull
                                                     SOAPVersion soapVersion,
                                                     @NotNull
                                                     javax.xml.ws.ProtocolException ex,
                                                     @Nullable
                                                     javax.xml.namespace.QName faultcode)
To be called to convert a ProtocolException and faultcode for a given SOAPVersion in to a Message.

Parameters:
soapVersion - SOAPVersion.SOAP_11 or SOAPVersion.SOAP_12
ex - a ProtocolException
faultcode - soap faultcode. Its ignored if the ProtocolException instance is SOAPFaultException and it has a faultcode present in the underlying SOAPFault.
Returns:
Message representing SOAP fault

createSOAPFaultMessage

public static Message createSOAPFaultMessage(SOAPVersion soapVersion,
                                             CheckedExceptionImpl ceModel,
                                             java.lang.Throwable ex)
To be called by the server runtime in the situations when there is an Exception that needs to be transformed in to a soapenv:Fault payload.

Parameters:
ceModel - CheckedExceptionImpl model that provides useful informations such as the detail tagname and the Exception associated with it. Caller of this constructor should get the CheckedException model by calling JavaMethodImpl.getCheckedException(Class), where Class is t.getClass().

If its null then this is not a checked exception and in that case the soap fault will be serialized only from the exception as described below.

ex - Exception that needs to be translated into soapenv:Fault, always non-null.
  • If t is instance of SOAPFaultException then its serilaized as protocol exception.
  • If t.getCause() is instance of SOAPFaultException and t is a checked exception then the soap fault detail is serilaized from t and the fault actor/string/role is taken from t.getCause().
soapVersion - non-null

createSOAPFaultMessage

public static Message createSOAPFaultMessage(SOAPVersion soapVersion,
                                             CheckedExceptionImpl ceModel,
                                             java.lang.Throwable ex,
                                             javax.xml.namespace.QName faultCode)
Create the Message with the specified faultCode

See Also:
createSOAPFaultMessage(SOAPVersion, CheckedExceptionImpl, Throwable)

createSOAPFaultMessage

public static Message createSOAPFaultMessage(SOAPVersion soapVersion,
                                             java.lang.String faultString,
                                             javax.xml.namespace.QName faultCode)
Server runtime will call this when there is some internal error not resulting from an exception.

Parameters:
soapVersion - SOAPVersion.SOAP_11 or SOAPVersion.SOAP_12
faultString - must be non-null
faultCode - For SOAP 1.1, it must be one of For SOAP 1.2
Returns:
non-null Message

createSOAPFaultMessage

public static Message createSOAPFaultMessage(SOAPVersion soapVersion,
                                             javax.xml.soap.SOAPFault fault)

getProtocolException

protected abstract java.lang.Throwable getProtocolException()

create

public static SOAPFaultBuilder create(Message msg)
                               throws javax.xml.bind.JAXBException
Parses a fault Message and returns it as a SOAPFaultBuilder.

Returns:
always non-null valid object.
Throws:
javax.xml.bind.JAXBException - if the parsing fails.


Copyright (c) 1997-2012 Oracle and/or its affiliates. All rights reserved.