org.apache.tuscany.sca.invocation.Message.setFaultBody()方法的使用及代码示例

x33g5p2x  于2022-01-25 转载在 其他  
字(8.8k)|赞(0)|评价(0)|浏览(196)

本文整理了Java中org.apache.tuscany.sca.invocation.Message.setFaultBody()方法的一些代码示例,展示了Message.setFaultBody()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Message.setFaultBody()方法的具体详情如下:
包路径:org.apache.tuscany.sca.invocation.Message
类名称:Message
方法名:setFaultBody

Message.setFaultBody介绍

[英]Set the message body with a fault object. After this method is called, isFault() returns true.
[中]将消息正文设置为故障对象。调用此方法后,isFault()返回true。

代码示例

代码示例来源:origin: com.jns.apps/scallop-binding-rmi-runtime

public Message invoke(Message msg) {
  try {
    Object[] args = msg.getBody();
    Object resp = invokeTarget(args);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    msg.setFaultBody(e.getCause());
  } catch (Exception e) {
    msg.setFaultBody(e);
  }
  return msg;
}

代码示例来源:origin: com.jns.apps/scallop-binding-rmi-runtime

public Message invoke(Message msg) {
  try {
    Object[] args = msg.getBody();
    Object resp = invokeTarget(args);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    if (e.getCause() instanceof ServiceRuntimeException) {
      msg.setFaultBody(e.getCause().getCause());
    } else {
      msg.setFaultBody(e.getCause());
    }
  } catch (Exception e) {
    msg.setFaultBody(e);
  }
  return msg;
}

代码示例来源:origin: com.jns.apps/scallop-binding-rmi-runtime

public Message invoke(Message msg) {
  try {
    Object[] args = msg.getBody();
    Object resp = invokeTarget(args);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    if (e.getCause() instanceof ServiceRuntimeException) {
      msg.setFaultBody(e.getCause().getCause());
    } else {
      msg.setFaultBody(e.getCause());
    }
  } catch (Exception e) {
    msg.setFaultBody(e);
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-rmi-runtime

public Message invoke(Message msg) {
  try {
    Object[] args = msg.getBody();
    Object resp = invokeTarget(args);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    msg.setFaultBody(e.getCause());
  } catch (Throwable e) {
    msg.setFaultBody(e);
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca.aggregation/tuscany-binding-rmi-runtime-aggregation

public Message invoke(Message msg) {
  try {
    Object[] args = msg.getBody();
    Object resp = invokeTarget(args);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    msg.setFaultBody(e.getCause());
  } catch (Throwable e) {
    msg.setFaultBody(e);
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-osgi-runtime

public Message invoke(Message msg) {
  try {
    Object resp = invokeTarget(msg);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    msg.setFaultBody(e.getCause());
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-spring-runtime

/**
 * @param msg the message to invoke on the target bean
 */
public Message invoke(Message msg) {
  try {
    Object resp = doInvoke(msg.getBody());
    msg.setBody(resp);
  } catch (SpringInvocationException e) {
    msg.setFaultBody(e.getCause());
  } catch (Throwable e) {
    msg.setFaultBody(e);
  }
  //System.out.println("Spring Invoker - invoke called");
  return msg;
} // end method invoke

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

private void setFault(Message msg, SOAPFaultException e) {
  SOAPFault fault = e.getFault();
  Detail detail = fault.getDetail();
  if (detail != null) {
    for (Iterator i = detail.getDetailEntries(); i.hasNext();) {
      DetailEntry entry = (DetailEntry)i.next();
      FaultException fe = new FaultException(e.getMessage(), entry, e);
      fe.setFaultName(entry.getElementQName());
      msg.setFaultBody(fe);
    }
  } else {
    msg.setFaultBody(e);
  }
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-bpel-runtime

public Message invoke(Message msg) {
  try {
    if( isCallback ) {
      // Extract the callback endpoint metadata
      callbackEPR = msg.getFrom();
    } // end if
    Object[] args = msg.getBody();
    Object resp = doTheWork(args);
    msg.setBody(resp);
  } catch (InvocationTargetException e) {
    msg.setFaultBody(e.getCause());
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

public Message invokeResponse(Message msg) {
  if (msg.getBody() != null){
    Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
    if (response instanceof InvocationTargetException) {
      msg.setFaultBody(((InvocationTargetException) response).getCause());
    } else {
      if (response != null){
        msg.setBody(response);
      } else {
        msg.setBody(null);
      }
    }
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

public Message invokeResponse(Message msg) {
  if (msg.getBody() != null){
    Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
    
    if (response instanceof InvocationTargetException) {
      msg.setFaultBody(((InvocationTargetException) response).getCause());
    } else {
      if (response != null){
        msg.setBody(response);
      } else {
        msg.setBody(null);
      }
    }
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

public Message invokeResponse(Message msg) {
  if (msg.getBody() != null){
    Object response = responseMessageProcessor.extractPayloadFromJMSMessage((javax.jms.Message)msg.getBody());
    
    if (response instanceof InvocationTargetException) {
      msg.setFaultBody(((InvocationTargetException) response).getCause());
    } else {
      if (response != null){
        msg.setBody(response);
      } else {
        msg.setBody(null);
      }
    }
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-ws-runtime-axis2

public Message invoke(Message msg) {
  try {
    Object resp = null; 
    
    if (msg.getOperation().isNonBlocking()) {
      resp = invokeTargetOneWay(msg);
    } else {
      resp = invokeTarget(msg);
    }
    
    msg.setBody(resp);
  } catch (AxisFault e) {
    if (e.getDetail() != null ) {
      FaultException f = new FaultException(e.getMessage(), e.getDetail(), e);
      f.setFaultName(e.getDetail().getQName());
      msg.setFaultBody(f);
    } else {
      msg.setFaultBody(e);
    }
  } catch (Throwable e) {
    msg.setFaultBody(e);
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-implementation-script-runtime

public Message invoke(Message msg) {
  try {
    Object resp = doInvoke((Object[])msg.getBody(), msg.getOperation());
    msg.setBody(resp);
  } catch (ScriptException e) {
    msg.setFaultBody(e.getCause());
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-sca-runtime

/**
 * Regular (sync) processing of response message
 */
public Message processResponse(Message msg){
  if (passByValue) {
    // Note source and target operation swapped so result is in source class loader
    if (msg.isFault()) {
      Object transformedFault = bindingSCATransformer.transformFault(msg.getBody());
      msg.setFaultBody(transformedFault);
    } else {
      Object transformedOutput = bindingSCATransformer.transformOutput(msg.getBody()); 
      msg.setBody(transformedOutput);
    } // end if
  } // end if
  return msg;
} // end method processResponse

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

/**
 * Regular (sync) processing of response message
 */
public Message processResponse(Message msg){
  if (passByValue) {
    // Note source and target operation swapped so result is in source class loader
    if (msg.isFault()) {
      Object transformedFault = bindingSCATransformer.transformFault(msg.getBody());
      msg.setFaultBody(transformedFault);
    } else {
      Object transformedOutput = bindingSCATransformer.transformOutput(msg.getBody()); 
      msg.setBody(transformedOutput);
    } // end if
  } // end if
  return msg;
} // end method processResponse

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

public Message invokeResponse(Message msg) {
  if (msg.getBody() != null){
    javax.jms.Message jmsMsg = (javax.jms.Message)msg.getBody();
    Object response = responseMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
    if (response != null ){
      msg.setBody(response);
      try {
        if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
          FaultException e = new FaultException("remote exception", response);
          xmlhelper.setFaultName(e, response);
          msg.setFaultBody(e);
        }
      } catch (JMSException e) {
        throw new JMSBindingException(e);
      }
    } else {
      msg.setBody(null);
    }
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-binding-jms-runtime

public Message invokeResponse(Message msg) {
  if (msg.getBody() != null){
    javax.jms.Message jmsMsg = (javax.jms.Message)msg.getBody();
    Object response = responseMessageProcessor.extractPayloadFromJMSMessage(jmsMsg);
    if (response != null ){
      msg.setBody(response);
      try {
        if (jmsMsg.getBooleanProperty(JMSBindingConstants.FAULT_PROPERTY)) {
          FaultException e = new FaultException("remote exception", response);
          xmlhelper.setFaultName(e, response);
          msg.setFaultBody(e);
        }
      } catch (JMSException e) {
        throw new JMSBindingException(e);
      }
    } else {
      msg.setBody(null);
    }
  }
  return msg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-base-runtime

public Message invoke(Message msg) {
  if (chain.allowsPassByReference()) {
    return nextInvoker.invoke(msg);
  }
  msg.setBody(mediator.copyInput(msg.getBody(), operation));
  Message resultMsg = nextInvoker.invoke(msg);
  if (!resultMsg.isFault() && operation.getOutputType() != null) {
    resultMsg.setBody(mediator.copyOutput(resultMsg.getBody(), operation));
  }
  if (resultMsg.isFault()) {
    resultMsg.setFaultBody(mediator.copyFault(resultMsg.getBody(), operation));
  }
  return resultMsg;
}

代码示例来源:origin: org.apache.tuscany.sca/tuscany-core-databinding

public Message invoke(Message msg) {
  if (chain.allowsPassByReference()) {
    return nextInvoker.invoke(msg);
  }
  msg.setBody(mediator.copyInput(msg.getBody(), operation));
  Message resultMsg = nextInvoker.invoke(msg);
  if (!resultMsg.isFault() && operation.getOutputType() != null) {
    resultMsg.setBody(mediator.copyOutput(resultMsg.getBody(), operation));
  }
  if (resultMsg.isFault()) {
    resultMsg.setFaultBody(mediator.copyFault(resultMsg.getBody(), operation));
  }
  return resultMsg;
}

相关文章