1 16 package test.soap; 17 18 import org.apache.axis.AxisFault; 19 import org.apache.axis.MessageContext; 20 import org.apache.axis.handlers.BasicHandler; 21 import org.apache.axis.message.SOAPEnvelope; 22 import org.apache.axis.message.SOAPHeaderElement; 23 24 31 public class TestHandler extends BasicHandler { 32 public void invoke(MessageContext msgContext) throws AxisFault { 33 SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope(); 34 if (env.getHeaderByName(TestHeaderAttrs.GOOD_HEADER_NS, 35 TestHeaderAttrs.GOOD_HEADER_NAME) != null) { 36 msgContext.setProperty(TestHeaderAttrs.PROP_DOUBLEIT, Boolean.TRUE); 39 } 40 41 if (env.getHeaderByName(TestOnFaultHeaders.TRIGGER_NS, 42 TestOnFaultHeaders.TRIGGER_NAME) != null) { 43 throw new AxisFault("triggered exception"); 45 } 46 } 47 48 public void onFault(MessageContext msgContext) { 49 try { 50 SOAPEnvelope env = msgContext.getResponseMessage().getSOAPEnvelope(); 51 SOAPHeaderElement header = new SOAPHeaderElement("ns", "local", "val"); 52 env.addHeader(header); 53 } catch (Exception e) { 54 throw new RuntimeException ("Exception during onFault processing"); 55 } 56 } 57 } 58 | Popular Tags |