public abstract class AbstractSoapExceptionFilter extends Object implements org.apache.camel.Processor
If SOAP exception
occurs and there is fault detail defined
then new exception is thrown by createException(QName, Node)
- if isAsynchMessage()
returns true.
Otherwise (for synchronous messages) is changed exception in the exchange Exchange.EXCEPTION_CAUGHT
and processing is redirected to ExceptionTranslator
.
If there is no fault detail defined or new exception wasn't thrown then exchange property
AsynchConstants.EXCEPTION_ERROR_CODE
would contain error code
that is defined by getErrorCodeForException(Exception)
and processing is redirected to ExceptionTranslator
for synchronous messages
(isAsynchMessage()
returns false).
Filter accepts SOAP standards 1.1 and 1.2.
Modifier | Constructor and Description |
---|---|
protected |
AbstractSoapExceptionFilter(boolean asynchMessage)
Creates exception filter.
|
Modifier and Type | Method and Description |
---|---|
protected abstract Exception |
createException(QName exName,
Node detailNode)
Creates exception from SOAP detail node (= element detail/Detail).
|
protected abstract ErrorExtEnum |
getErrorCodeForException(Exception faultException)
Returns
error code for the specified exception. |
protected QName |
getExceptionName(Node detailNode)
Gets the exception name.
|
protected static String |
getExFaultName(Class clazz)
Gets the SOAP fault name from the class with
@WebFault . |
protected Node |
getFirstElm(Node node)
Gets first child element (node with type
Node.ELEMENT_NODE . |
boolean |
isAsynchMessage() |
boolean |
isRedirectToExTranslator() |
void |
process(org.apache.camel.Exchange exchange) |
void |
setRedirectToExTranslator(boolean redirectToExTranslator)
Sets whether to redirect response to
ExceptionTranslator . |
protected AbstractSoapExceptionFilter(boolean asynchMessage)
asynchMessage
- true
when it's asynchronous processing, otherwise false
public final void process(org.apache.camel.Exchange exchange) throws Exception
process
in interface org.apache.camel.Processor
Exception
protected abstract ErrorExtEnum getErrorCodeForException(@Nullable Exception faultException)
error code
for the specified exception.
If there is no specified input exception then returns error code for common error for specific external system.faultException
- the exception@Nullable protected abstract Exception createException(QName exName, Node detailNode)
Example of the generated SOAP fault response for SOAP 1.1:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <SOAP-ENV:Fault> <faultcode>SOAP-ENV:Server</faultcode> <faultstring xml:lang="en">E102: the validation error</faultstring> <detail> <errorCode xmlns="http://openhubframework.org">E102</errorCode> </detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
Example of the generated SOAP fault response for SOAP 1.2:
<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://www.w3.org/2003/05/soap-envelope"> <SOAP-ENV:Header/> <SOAP-ENV:Body> <SOAP-ENV:Fault> <SOAP-ENV:Code><SOAP-ENV:Value><SOAP-ENV:Server</SOAP-ENV:Value></SOAP-ENV:Code> <SOAP-ENV:Reason xml:lang="en">E102: the validation error</SOAP-ENV:Reason> <SOAP-ENV:Detail> <errorCode xmlns="http://openhubframework.org">E102</errorCode> </SOAP-ENV:Detail> </SOAP-ENV:Fault> </SOAP-ENV:Body> </SOAP-ENV:Envelope>
exName
- the fully qualified exception name (e.g.: ValidityMismatch)detailNode
- the XML node that represents fault detailnull
if specified exception is not supported.protected QName getExceptionName(Node detailNode)
detailNode
- the fault detail nodeprotected Node getFirstElm(Node node)
Node.ELEMENT_NODE
.node
- the nodepublic boolean isAsynchMessage()
protected static String getExFaultName(Class clazz)
@WebFault
.clazz
- the class that represents faultpublic boolean isRedirectToExTranslator()
public void setRedirectToExTranslator(boolean redirectToExTranslator)
redirectToExTranslator
- true
for redirecting otherwise false
Copyright © 2018 Pivotal Software, Inc.. All rights reserved.