TestHandler.javaAPI DocApache Axis 1.42437Sat Apr 22 18:57:28 BST 2006test.soap


public class TestHandler extends org.apache.axis.handlers.BasicHandler
This is a test Handler which interacts with the TestService below in order to test header processing. If a particular header appears in the message, we mark the MessageContext so the TestService knows to double its results (which is a detectable way of confirming header processing on the client side).

Fields Summary
Constructors Summary
Methods Summary
public voidinvoke(org.apache.axis.MessageContext msgContext)

        SOAPEnvelope env = msgContext.getRequestMessage().getSOAPEnvelope();
        if (env.getHeaderByName(TestHeaderAttrs.GOOD_HEADER_NS, 
                                TestHeaderAttrs.GOOD_HEADER_NAME) != null) {
            // Just the header's presence is enough - mark the property
            // so it can be picked up by the service (see below)
            msgContext.setProperty(TestHeaderAttrs.PROP_DOUBLEIT, Boolean.TRUE);
        if (env.getHeaderByName(TestOnFaultHeaders.TRIGGER_NS,
                                TestOnFaultHeaders.TRIGGER_NAME) != null) {
            // Fault trigger header is there, so throw an Exception
            throw new AxisFault("triggered exception");
public voidonFault(org.apache.axis.MessageContext msgContext)

        try {
            SOAPEnvelope env = msgContext.getResponseMessage().getSOAPEnvelope();
            SOAPHeaderElement header = new SOAPHeaderElement("ns", "local", "val");
        } catch (Exception e) {
            throw new RuntimeException("Exception during onFault processing");