1 17 package org.apache.servicemix.components.activesoap; 18 19 import javax.jbi.messaging.MessageExchange; 20 import javax.jbi.messaging.NormalizedMessage; 21 import javax.xml.stream.XMLStreamReader; 22 23 import org.apache.servicemix.components.util.OutBinding; 24 import org.codehaus.activesoap.RestService; 25 26 32 public class ASOutBinding extends OutBinding { 33 34 private RestService service; 35 private ASMarshaler marshaler = new ASMarshaler(); 36 37 public ASOutBinding(RestService service) { 38 this.service = service; 39 } 40 41 44 public ASMarshaler getMarshaller() { 45 return marshaler; 46 } 47 48 51 public void setMarshaller(ASMarshaler marshaler) { 52 this.marshaler = marshaler; 53 } 54 55 58 public ASMarshaler getMarshaler() { 59 return marshaler; 60 } 61 62 65 public void setMarshaler(ASMarshaler marshaler) { 66 this.marshaler = marshaler; 67 } 68 69 protected void process(MessageExchange messageExchange, NormalizedMessage inMessage) throws Exception { 72 XMLStreamReader in = marshaler.createStreamReader(inMessage); 73 74 org.codehaus.activesoap.MessageExchange asExchange = service.createMessageExchange(in, null); 75 marshaler.fromNMS(asExchange, inMessage); 76 service.invoke(asExchange); 77 78 done(messageExchange); 79 } 80 } 81 | Popular Tags |