PayloadTransformingInterceptor extends TransformerObjectSupport implements EndpointInterceptor, InitializingBean { @Override public boolean handleRequest(MessageContext messageContext, Object endpoint) throws Exception { if (requestTemplates != null) { WebServiceMessage request = messageContext.getRequest(); Transformer transformer = requestTemplates.newTransformer(); transformMessage(request, transformer); logger.debug("Request 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 testHandleRequest() throws Exception { interceptor.setRequestXslt(xslt); interceptor.afterPropertiesSet(); MockWebServiceMessage request = new MockWebServiceMessage(input); MessageContext context = new DefaultMessageContext(request, new MockWebServiceMessageFactory()); boolean result = interceptor.handleRequest(context, null); Assert.assertTrue("Invalid interceptor result", result); StringResult expected = new StringResult(); transformer.transform(new SAXSource(SaxUtils.createInputSource(output)), expected); assertXMLEqual(expected.toString(), request.getPayloadAsString()); }