/**
   * Find the correct Fault part for a particular exception.
   *
   * @param op
   * @param class1
   * @return
   */
  public FaultInfo getFaultForClass(OperationInfo op, Class class1) {
    for (Iterator itr = op.getFaults().iterator(); itr.hasNext(); ) {
      FaultInfo faultInfo = (FaultInfo) itr.next();

      if (faultInfo.getExceptionClass().isAssignableFrom(class1)) {
        return faultInfo;
      }
    }

    return null;
  }
  public void invoke(MessageContext context) throws Exception {
    XFireFault fault = (XFireFault) context.getExchange().getFaultMessage().getBody();

    Throwable cause = fault.getCause();
    OperationInfo op = null;

    if (context.getExchange() != null) op = context.getExchange().getOperation();

    if (cause == null || op == null) return;

    FaultInfo faultPart = getFaultForClass(op, cause.getClass());

    if (faultPart != null) {
      handleFault(context, fault, cause, (MessagePartInfo) faultPart.getMessageParts().get(0));
    }
  }