@Test
public void testInvoke() throws Exception {

	MockWebServiceMessage request = new MockWebServiceMessage("<request/>");
	final Transformer transformer = TransformerFactoryUtils.newInstance().newTransformer();
	PayloadEndpoint endpoint = new PayloadEndpoint() {
		public Source invoke(Source request) throws Exception {
			StringWriter writer = new StringWriter();
			transformer.transform(request, new StreamResult(writer));
			assertXMLEqual("Invalid request", "<request/>", writer.toString());
			return new StreamSource(new StringReader("<response/>"));
		}
	};
	endpoint.invoke(request.getPayloadSource());
	MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
	adapter.invoke(messageContext, endpoint);
	MockWebServiceMessage response = (MockWebServiceMessage) messageContext.getResponse();
	Assert.assertNotNull("No response created", response);
	assertXMLEqual("Invalid payload", "<response/>", response.getPayloadAsString());
}