1 16 17 package org.apache.axis.handlers ; 18 19 import org.apache.axis.AxisFault; 20 import org.apache.axis.Constants; 21 import org.apache.axis.Message; 22 import org.apache.axis.MessageContext; 23 import org.apache.axis.components.logger.LogFactory; 24 import org.apache.axis.message.SOAPEnvelope; 25 import org.apache.axis.message.SOAPHeaderElement; 26 import org.apache.axis.utils.Messages; 27 import org.apache.commons.logging.Log; 28 29 30 34 public class DebugHandler extends BasicHandler { 35 protected static Log log = 36 LogFactory.getLog(DebugHandler.class.getName()); 37 38 public static final String NS_URI_DEBUG = "http://xml.apache.org/axis/debug"; 39 40 public void invoke(MessageContext msgContext) throws AxisFault { 41 log.debug("Enter: DebugHandler::invoke"); 42 try { 43 Message msg = msgContext.getRequestMessage(); 44 45 SOAPEnvelope message = (SOAPEnvelope)msg.getSOAPEnvelope(); 46 SOAPHeaderElement header = message. 47 getHeaderByName(NS_URI_DEBUG, "Debug"); 48 49 if (header != null) { 50 Integer i = ((Integer )header 51 .getValueAsType(Constants.XSD_INT)); 52 if (i == null) 53 throw new AxisFault(Messages.getMessage("cantConvert03")); 54 55 int debugVal = i.intValue(); 56 log.debug(Messages.getMessage("debugLevel00", "" + debugVal) ); 57 header.setProcessed(true); 59 } 60 } 61 catch( Exception e ) { 62 log.error( Messages.getMessage("exception00"), e ); 63 throw AxisFault.makeFault(e); 64 } 65 log.debug("Exit: DebugHandler::invoke"); 66 } 67 68 public void onFault(MessageContext msgContext) { 69 log.debug("Enter: DebugHandler::onFault"); 70 log.debug("Exit: DebugHandler::onFault"); 71 } 72 73 }; 74 | Popular Tags |