Package com.sun.xml.ws.fault
Class SOAPFaultBuilder
java.lang.Object
com.sun.xml.ws.fault.SOAPFaultBuilder
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
FieldsModifier and TypeFieldDescriptionstatic final booleanSet to false if you don't want the generated faults to have stack trace in it. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic SOAPFaultBuilderParses a faultMessageand returns it as aSOAPFaultBuilder.createException(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, SOAPFault fault) static MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, ProtocolException ex, QName faultcode) static MessagecreateSOAPFaultMessage(SOAPVersion soapVersion, String faultString, QName faultCode) Server runtime will call this when there is some internal error not resulting from an exception.protected abstract Throwablestatic booleanstatic voidsetCaptureExceptionMessage(boolean capture)
-
Field Details
-
captureStackTrace
public static final boolean captureStackTraceSet to false if you don't want the generated faults to have stack trace in it.
-
-
Constructor Details
-
SOAPFaultBuilder
protected SOAPFaultBuilder()Default constructor.
-
-
Method Details
-
getFirstDetailEntryName
-
createException
public Throwable createException(Map<QName, CheckedExceptionImpl> exceptions) throws jakarta.xml.bind.JAXBExceptionThis should be called from the client side to throw anExceptionfor a given soap mesage- Throws:
jakarta.xml.bind.JAXBException
-
createSOAPFaultMessage
@NotNull public static Message createSOAPFaultMessage(@NotNull SOAPVersion soapVersion, @NotNull 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
-
getProtocolException
-
create
Parses a faultMessageand returns it as aSOAPFaultBuilder.- Returns:
- always non-null valid object.
- Throws:
jakarta.xml.bind.JAXBException- if the parsing fails.
-
setCaptureExceptionMessage
public static void setCaptureExceptionMessage(boolean capture) -
isCaptureExceptionMessage
public static boolean isCaptureExceptionMessage()
-