1 package org.codehaus.xfire.handler;
2
3 import javax.xml.stream.XMLStreamException;
4
5 import org.codehaus.xfire.MessageContext;
6 import org.codehaus.xfire.fault.XFireFault;
7 import org.codehaus.xfire.util.STAXUtils;
8
9 /***
10 * A handler which echoes the SOAP Body back.
11 *
12 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
13 * @since Feb 18, 2004
14 */
15 public class EchoHandler
16 extends AbstractHandler
17 implements Handler
18 {
19 /***
20 * @see org.codehaus.xfire.handler.Handler#invoke(org.codehaus.xfire.MessageContext)
21 */
22 public void invoke( MessageContext context )
23 throws XFireFault
24 {
25 try
26 {
27 STAXUtils.copy(context.getXMLStreamReader(), getXMLStreamWriter(context));
28 getXMLStreamWriter(context).flush();
29 }
30 catch (XMLStreamException e)
31 {
32 throw new XFireFault("Couldn't parse the request document.", e, XFireFault.SENDER);
33 }
34 }
35 }