PayloadTransformingInterceptor extends TransformerObjectSupport implements EndpointInterceptor, InitializingBean { @Override public boolean handleResponse(MessageContext messageContext, Object endpoint) throws Exception { if (responseTemplates != null) { WebServiceMessage response = messageContext.getResponse(); Transformer transformer = responseTemplates.newTransformer(); transformMessage(response, transformer); logger.debug("Response message transformed"); } return true; }  void setRequestXslt(Resource requestXslt); void setResponseXslt(Resource responseXslt); @Override boolean handleRequest(MessageContext messageContext, Object endpoint); @Override boolean handleResponse(MessageContext messageContext, Object endpoint); @Override boolean handleFault(MessageContext messageContext, Object endpoint); @Override void afterCompletion(MessageContext messageContext, Object endpoint, Exception ex); @Override void afterPropertiesSet();  }
@Test public void testHandleResponse() throws Exception { interceptor.setResponseXslt(xslt); interceptor.afterPropertiesSet(); MockWebServiceMessage request = new MockWebServiceMessage(input); MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory()); MockWebServiceMessage response = (MockWebServiceMessage) context.getResponse(); response.setPayload(input); boolean result = interceptor.handleResponse(context, null); Assert.assertTrue("Invalid interceptor result", result); StringResult expected = new StringResult(); transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected); assertXMLEqual(expected.toString(), response.getPayloadAsString()); }