Interface ClientInterceptor
- All Known Implementing Classes:
AbstractValidatingInterceptor
,ClientInterceptorAdapter
,PayloadValidatingInterceptor
WebServiceTemplate
, to add common
pre- and postprocessing behavior without needing to modify payload handling code.
A ClientInterceptor
gets called after payload creation (using
WebServiceTemplate.marshalSendAndReceive(Object)
or similar methods, and
after callback
invocation, but before the
message is sent over the WebServiceConnection
. This mechanism can be used for a large field of preprocessing
aspects, e.g. for authorization checks, or message header checks. Its main purpose is to allow for factoring out
meta-data (i.e. SoapHeader
) related code.
Client interceptors are defined on a WebServiceTemplate
, using the
interceptors
property.
- Since:
- 1.5.0
- Author:
- Giovanni Cuccu, Arjen Poutsma
- See Also:
-
Method Summary
Modifier and TypeMethodDescriptionvoid
afterCompletion
(MessageContext messageContext, Exception ex) Callback after completion of request and response (fault) processing.boolean
handleFault
(MessageContext messageContext) Processes the incoming response fault.boolean
handleRequest
(MessageContext messageContext) Processes the outgoing request message.boolean
handleResponse
(MessageContext messageContext) Processes the incoming response message.
-
Method Details
-
handleRequest
Processes the outgoing request message. Called after payload creation and callback invocation, but before the message is sent.- Parameters:
messageContext
- contains the outgoing request message- Returns:
true
to continue processing of the request interceptors;false
to indicate blocking of the request endpoint chain- Throws:
WebServiceClientException
- in case of errors- See Also:
-
handleResponse
Processes the incoming response message. Called for non-fault response messages before payload handling in theWebServiceTemplate
.Note: Will only be called if this interceptor's
handleRequest(org.springframework.ws.context.MessageContext)
method has successfully completed.- Parameters:
messageContext
- contains the outgoing request message- Returns:
true
to continue processing of the request interceptors;false
to indicate blocking of the response endpoint chain- Throws:
WebServiceClientException
- in case of errors- See Also:
-
handleFault
Processes the incoming response fault. Called for response fault messages before payload handling in theWebServiceTemplate
.Note: Will only be called if this interceptor's
handleRequest(org.springframework.ws.context.MessageContext)
method has successfully completed.- Parameters:
messageContext
- contains the outgoing request message- Returns:
true
to continue processing of the request interceptors;false
to indicate blocking of the request endpoint chain- Throws:
WebServiceClientException
- in case of errors- See Also:
-
afterCompletion
Callback after completion of request and response (fault) processing. Will be called on any outcome, thus allows for proper resource cleanup.Note: Will only be called if this interceptor's
handleRequest(org.springframework.ws.context.MessageContext)
method has successfully completed.- Parameters:
messageContext
- contains both request and response messages, the response should contains a Faultex
- exception thrown on handler execution, if any- Throws:
WebServiceClientException
- in case of errors- Since:
- 2.2
-