private boolean handleFault(int i) {
    Handler handler = _chain.get(i);

    boolean success = false;
    _invoked[i] = true;

    try {
      if (handler instanceof LogicalHandler) {
        _logicalContext.getMessage().setPayload(_source);
        success = handler.handleFault(_logicalContext);
        _source = _logicalContext.getMessage().getPayload();
      } else if (handler instanceof SOAPHandler) {
        try {
          _soapContext.setMessage(_source);
          success = handler.handleFault(_soapContext);
          _source = _soapContext.getMessage().getSOAPPart().getContent();
        } catch (SOAPException e) {
          throw new WebServiceException(e);
        }
      } else {
        throw new WebServiceException(
            L.l("Unsupported Handler type: {0}", handler.getClass().getName()));
      }

      _protocolException = null;
    } catch (ProtocolException e) {
      _protocolException = e;
      serializeProtocolException();
    } catch (RuntimeException e) {
      _runtimeException = e;
      serializeRuntimeException();
    }

    return success;
  }
  public String toString() {
    StringBuilder sb = new StringBuilder("HandlerChainInvoker[\n");

    for (Handler handler : _chain) {
      sb.append(handler.toString());
      sb.append('\n');
    }

    sb.append(']');

    return sb.toString();
  }
  private void close(int i) {
    Handler handler = _chain.get(i);

    if (!_invoked[i]) return;

    _invoked[i] = false;

    if (handler instanceof LogicalHandler) {
      _logicalContext.getMessage().setPayload(_source);
      handler.close(_logicalContext);
      _source = _logicalContext.getMessage().getPayload();
    } else if (handler instanceof SOAPHandler) {
      try {
        _soapContext.setMessage(_source);
        handler.close(_soapContext);
        _source = _soapContext.getMessage().getSOAPPart().getContent();
      } catch (SOAPException e) {
        throw new WebServiceException(e);
      }
    }
  }