1 package org.codehaus.xfire.handler;
2
3 import org.codehaus.xfire.MessageContext;
4 import org.codehaus.xfire.exchange.OutMessage;
5 import org.codehaus.xfire.fault.XFireFault;
6
7 /***
8 * Reads in the message body using the service binding.
9 *
10 * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
11 */
12 public class DispatchServiceHandler
13 extends AbstractHandler
14 {
15 public String getPhase()
16 {
17 return Phase.DISPATCH;
18 }
19
20 public void invoke(MessageContext context)
21 throws XFireFault
22 {
23 context.getInPipeline().addHandlers(context.getService().getInHandlers());
24
25 if (context.getExchange().hasOutMessage())
26 {
27 HandlerPipeline pipeline = new HandlerPipeline(context.getXFire().getOutPhases());
28 pipeline.addHandlers(context.getService().getOutHandlers());
29 pipeline.addHandlers(context.getXFire().getOutHandlers());
30 OutMessage msg = context.getExchange().getOutMessage();
31 pipeline.addHandlers(msg.getChannel().getTransport().getOutHandlers());
32
33 context.setOutPipeline(pipeline);
34 }
35 }
36 }