1 4 5 9 10 package org.openlaszlo.remote.soap; 11 12 import java.util.*; 13 import javax.xml.namespace.QName ; 14 import javax.xml.rpc.handler.*; 15 import javax.xml.rpc.handler.soap.*; 16 import javax.xml.soap.*; 17 import org.apache.log4j.*; 18 19 public class LZSOAPHandler extends GenericHandler 20 { 21 private static Logger mLogger = Logger.getLogger(LZSOAPHandler.class); 22 23 public QName [] getHeaders() { 24 return null; 25 } 26 27 public boolean handleRequest(MessageContext context) { 28 if (mLogger.isDebugEnabled()) { 29 mLogger.debug("========== handleRequest(" + context + ") "); 30 displaySOAPMessage(context); 31 mLogger.debug("=========="); 32 } 33 return true; 34 } 35 36 public boolean handleResponse(MessageContext context) { 37 if (mLogger.isDebugEnabled()) { 38 mLogger.debug("========== handleResponse(" + context + ") "); 39 mLogger.debug("=========="); 41 } 42 return true; 43 } 44 45 public void displaySOAPMessage(MessageContext context) { 46 try { 47 SOAPMessageContext soapContext = (SOAPMessageContext)context; 48 49 SOAPMessage message = soapContext.getMessage(); 50 SOAPPart sp = message.getSOAPPart(); 51 SOAPEnvelope envelope = sp.getEnvelope(); 52 SOAPBody body = envelope.getBody(); 53 SOAPHeader header = envelope.getHeader(); 54 55 mLogger.debug(envelope.getClass().getName() + '@' + Integer.toHexString(envelope.hashCode())); 56 mLogger.debug(envelope); 57 58 } catch (Exception e) { 59 e.printStackTrace(); 60 } 61 } 62 } 63 | Popular Tags |