1 package org.objectweb.celtix.systest.ws.rm; 2 3 import java.util.ArrayList ; 4 import java.util.List ; 5 import java.util.Map ; 6 import java.util.Set ; 7 8 import javax.xml.namespace.QName ; 9 import javax.xml.soap.SOAPMessage ; 10 import javax.xml.ws.handler.MessageContext; 11 12 import org.objectweb.celtix.bus.ws.addressing.ContextUtils; 13 import org.objectweb.celtix.context.StreamMessageContext; 14 import org.objectweb.celtix.handlers.StreamHandler; 15 16 public class SOAPMessageRecorder implements StreamHandler { 17 18 private static List <SOAPMessage > outbound; 19 20 public SOAPMessageRecorder() { 21 if (null == outbound) { 22 outbound = new ArrayList <SOAPMessage >(); 23 } 24 } 25 26 public void init(Map <String , Object > map) { 27 } 28 29 public Set <QName > getHeaders() { 30 return null; 31 } 32 33 public boolean handleMessage(StreamMessageContext context) { 34 record(context); 35 return true; 36 } 37 38 public boolean handleFault(StreamMessageContext context) { 39 record(context); 40 return true; 41 } 42 43 public void close(MessageContext arg0) { 44 } 45 46 protected List <SOAPMessage > getOutboundMessages() { 47 return outbound; 48 } 49 50 private void record(StreamMessageContext context) { 51 if (ContextUtils.isOutbound(context)) { 52 SOAPMessage sm = (SOAPMessage )context.get("org.objectweb.celtix.bindings.soap.message"); 53 outbound.add(sm); 54 } 55 } 56 57 58 59 60 61 } 62 | Popular Tags |