public class PayloadTransformingInterceptor extends TransformerObjectSupport implements EndpointInterceptor, org.springframework.beans.factory.InitializingBean
WebServiceMessages 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(org.springframework.core.io.Resource requestXslt)
Sets the XSLT stylesheet to use for transforming incoming request.
|
void |
setResponseXslt(org.springframework.core.io.Resource responseXslt)
Sets the XSLT stylesheet to use for transforming outgoing responses.
|
createTransformer, getTransformerFactory, newTransformerFactory, setTransformerFactoryClass, transformpublic void setRequestXslt(org.springframework.core.io.Resource requestXslt)
public void setResponseXslt(org.springframework.core.io.Resource responseXslt)
public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception
requestXslt has been set.handleRequest in interface EndpointInterceptormessageContext - the message contextendpoint - chosen endpoint to invoketrueException - 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 EndpointInterceptormessageContext - the message contextendpoint - chosen endpoint to invoketrueException - in case of errorssetResponseXslt(org.springframework.core.io.Resource)public boolean handleFault(MessageContext messageContext, Object endpoint) throws Exception
handleFault in interface EndpointInterceptormessageContext - 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.Exceptionpublic void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex)
afterCompletion in interface EndpointInterceptormessageContext - contains both request and response messages, the response should contains a Faultendpoint - chosen endpoint to invokeex - exception thrown on handler execution, if any