Package com.sun.xml.ws.fault
Class SOAPFaultBuilder
- java.lang.Object
-
- com.sun.xml.ws.fault.SOAPFaultBuilder
-
public abstract class SOAPFaultBuilder extends 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.- Author:
- Vivek Pandey
-
-
Field Summary
Fields Modifier and Type Field Description static booleancaptureStackTraceSet to false if you don't want the generated faults to have stack trace in it.
-
Constructor Summary
Constructors Constructor Description SOAPFaultBuilder()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description static SOAPFaultBuildercreate(Message msg)Parses a faultMessageand returns it as aSOAPFaultBuilder.ThrowablecreateException(Map<QName,CheckedExceptionImpl> exceptions)This should be called from the client side to throw anExceptionfor a given soap mesagestatic MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, CheckedExceptionImpl ceModel, 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 MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, CheckedExceptionImpl ceModel, Throwable ex, QName faultCode)Create the Message with the specified faultCodestatic MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, String faultString, QName faultCode)Server runtime will call this when there is some internal error not resulting from an exception.static MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, javax.xml.soap.SOAPFault fault)static MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, javax.xml.ws.ProtocolException ex, QName faultcode)QNamegetFirstDetailEntryName()protected abstract ThrowablegetProtocolException()
-
-
-
Method Detail
-
createException
public Throwable createException(Map<QName,CheckedExceptionImpl> exceptions) throws javax.xml.bind.JAXBException
This should be called from the client side to throw anExceptionfor 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 QName faultcode)
- Parameters:
soapVersion-SOAPVersion.SOAP_11orSOAPVersion.SOAP_12ex- a ProtocolExceptionfaultcode- soap faultcode. Its ignored if theProtocolExceptioninstance isSOAPFaultExceptionand it has a faultcode present in the underlyingSOAPFault.- Returns:
Messagerepresenting SOAP fault
-
createSOAPFaultMessage
public static Message createSOAPFaultMessage(SOAPVersion soapVersion, CheckedExceptionImpl ceModel, 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-CheckedExceptionImplmodel 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 callingJavaMethodImpl.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
SOAPFaultExceptionthen its serilaized as protocol exception. - If t.getCause() is instance of
SOAPFaultExceptionand 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().
- If t is instance of
soapVersion- non-null
-
createSOAPFaultMessage
public static Message createSOAPFaultMessage(SOAPVersion soapVersion, CheckedExceptionImpl ceModel, Throwable ex, QName faultCode)
Create the Message with the specified faultCode
-
createSOAPFaultMessage
public static Message createSOAPFaultMessage(SOAPVersion soapVersion, String faultString, QName faultCode)
Server runtime will call this when there is some internal error not resulting from an exception.- Parameters:
soapVersion-SOAPVersion.SOAP_11orSOAPVersion.SOAP_12faultString- must be non-nullfaultCode- 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 Throwable getProtocolException()
-
create
public static SOAPFaultBuilder create(Message msg) throws javax.xml.bind.JAXBException
Parses a faultMessageand returns it as aSOAPFaultBuilder.- Returns:
- always non-null valid object.
- Throws:
javax.xml.bind.JAXBException- if the parsing fails.
-
-