@Test
public void resolveArgumentFromCustomSAXSource() throws JAXBException {

	// Create a custom SAXSource that generates an appropriate sequence of events.
	XMLReader xmlReader = new AbstractXmlReader() {
		@Override
		public void parse(String systemId) throws IOException, SAXException {
			parse();
		}
		@Override
		public void parse(InputSource input) throws IOException, SAXException {
			parse();
		}
		private void parse() throws SAXException {
			ContentHandler handler = getContentHandler();
			// <root xmlns='http://springframework.org'><string>Foo</string></root>
			handler.startDocument();
			handler.startPrefixMapping("", "http://springframework.org");
			handler.startElement("http://springframework.org", "root", "root", new AttributesImpl());
			handler.startElement("http://springframework.org", "string", "string", new AttributesImpl());
			handler.characters("Foo".toCharArray(), 0, 3);
			handler.endElement("http://springframework.org", "string", "string");
			handler.endElement("http://springframework.org", "root", "root");
			handler.endPrefixMapping("");
			handler.endDocument();
		}
	};
	final SAXSource source = new SAXSource(xmlReader, new InputSource());
	// Create a mock WebServiceMessage that returns the SAXSource as payload source.
	WebServiceMessage request = new WebServiceMessage() {
		@Override
		public void writeTo(OutputStream outputStream) throws IOException {
			throw new UnsupportedOperationException();
		}
		@Override
		public Source getPayloadSource() {
			return source;
		}
		@Override
		public Result getPayloadResult() {
			throw new UnsupportedOperationException();
		}
	};
	// Create a message context with that request. Note that the message factory doesn't matter here:
	// it is required but not used.
	MessageContext messageContext = new DefaultMessageContext(request, new MockWebServiceMessageFactory());
	Object result = processor.resolveArgument(messageContext, rootElementParameter);
	assertTrue("result not a MyRootElement", result instanceof MyRootElement);
	MyRootElement rootElement = (MyRootElement) result;
	assertEquals("invalid result", "Foo", rootElement.getString());
}