public class PayloadTransformingInterceptor extends TransformerObjectSupport implements EndpointInterceptor, InitializingBean
WebServiceMessage
s using XSLT stylesheet. Allows for seperate
stylesheets for request and response. This interceptor is especially useful when supporting with multiple version of
a Web service: you can transform the older message format to the new format.
The stylesheets to use can be set using the requestXslt
and responseXslt
properties. Both
of these are optional: if not set, the message is simply not transformed. Setting one of the two is required,
though.
setRequestXslt(org.springframework.core.io.Resource)
,
setResponseXslt(org.springframework.core.io.Resource)
Constructor and Description |
---|
PayloadTransformingInterceptor() |
Modifier and Type | Method and Description |
---|---|
void |
afterCompletion(MessageContext messageContext,
Object endpoint,
Exception ex)
Does nothing by default.
|
void |
afterPropertiesSet() |
boolean |
handleFault(MessageContext messageContext,
Object endpoint)
Does nothing by default.
|
boolean |
handleRequest(MessageContext messageContext,
Object endpoint)
Transforms the request message in the given message context using a provided stylesheet.
|
boolean |
handleResponse(MessageContext messageContext,
Object endpoint)
Transforms the response message in the given message context using a stylesheet.
|
void |
setRequestXslt(Resource requestXslt)
Sets the XSLT stylesheet to use for transforming incoming request.
|
void |
setResponseXslt(Resource responseXslt)
Sets the XSLT stylesheet to use for transforming outgoing responses.
|
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transform
public void setRequestXslt(Resource requestXslt)
public void setResponseXslt(Resource responseXslt)
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception
requestXslt
has been set.handleRequest
in interface EndpointInterceptor
messageContext
- the message contextendpoint
- chosen endpoint to invoketrue
Exception
- in case of errorssetRequestXslt(org.springframework.core.io.Resource)
public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception
responseXslt
has been set.handleResponse
in interface EndpointInterceptor
messageContext
- the message contextendpoint
- chosen endpoint to invoketrue
Exception
- in case of errorssetResponseXslt(org.springframework.core.io.Resource)
public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception
handleFault
in interface EndpointInterceptor
messageContext
- contains both request and response messages, the response should contains a Faultendpoint
- chosen endpoint to invoketrue
to continue processing of the response interceptor chain; false
to indicate
blocking of the response handler chain.Exception
public void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex)
afterCompletion
in interface EndpointInterceptor
messageContext
- contains both request and response messages, the response should contains a Faultendpoint
- chosen endpoint to invokeex
- exception thrown on handler execution, if anypublic void afterPropertiesSet() throws Exception
afterPropertiesSet
in interface InitializingBean
Exception