本文整理汇总了Java中org.apache.cxf.interceptor.Fault.getMessage方法的典型用法代码示例。如果您正苦于以下问题:Java Fault.getMessage方法的具体用法?Java Fault.getMessage怎么用?Java Fault.getMessage使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.cxf.interceptor.Fault
的用法示例。
在下文中一共展示了Fault.getMessage方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: buildWeatherFaultAndSet2SoapMessage
import org.apache.cxf.interceptor.Fault; //导入方法依赖的package包/类
public static void buildWeatherFaultAndSet2SoapMessage(SoapMessage message, FaultConst faultContent) {
Fault exceptionFault = (Fault) message.getContent(Exception.class);
String originalFaultMessage = exceptionFault.getMessage();
exceptionFault.setMessage(faultContent.getMessage());
exceptionFault.setDetail(createFaultDetailWithWeatherException(originalFaultMessage, faultContent));
message.setContent(Exception.class, exceptionFault);
}
示例2: handleMessage
import org.apache.cxf.interceptor.Fault; //导入方法依赖的package包/类
@Override
public void handleMessage(SoapMessage soapMessage) throws Fault {
Fault fault = (Fault) soapMessage.getContent(Exception.class);
Throwable faultCause = fault.getCause();
String faultMessage = fault.getMessage();
if (containsFaultIndicatingNotSchemeCompliantXml(faultCause, faultMessage)) {
LOG.schemaValidationError(FaultConst.SCHEME_VALIDATION_ERROR, faultMessage);
WeatherSoapFaultHelper.buildWeatherFaultAndSet2SoapMessage(soapMessage, FaultConst.SCHEME_VALIDATION_ERROR);
} else if (containsFaultIndicatingSyntacticallyIncorrectXml(faultCause)) {
LOG.schemaValidationError(FaultConst.SYNTACTICALLY_INCORRECT_XML_ERROR, faultMessage);
WeatherSoapFaultHelper.buildWeatherFaultAndSet2SoapMessage(soapMessage, FaultConst.SYNTACTICALLY_INCORRECT_XML_ERROR);
}
}
示例3: transformMessage
import org.apache.cxf.interceptor.Fault; //导入方法依赖的package包/类
private String transformMessage(Fault fault, String logCorrId) {
StringBuilder msgBuilder = new StringBuilder();
msgBuilder.append("[logCorrelationId:").append(logCorrId).append("] ");
String origMessage = fault.getMessage();
if (origMessage != null) {
msgBuilder.append(origMessage);
} else {
msgBuilder.append(fault.getClass().getName());
}
return msgBuilder.toString();
}
示例4: checkFailure
import org.apache.cxf.interceptor.Fault; //导入方法依赖的package包/类
private void checkFailure(org.apache.camel.Exchange camelExchange, Exchange cxfExchange) throws Fault {
final Throwable t;
if (camelExchange.isFailed()) {
org.apache.camel.Message camelMsg = camelExchange.hasOut() ? camelExchange.getOut() : camelExchange.getIn();
if (camelMsg.isFault()) {
t = camelMsg.getBody(Throwable.class);
} else {
t = camelExchange.getException();
}
cxfExchange.getInMessage().put(FaultMode.class, FaultMode.UNCHECKED_APPLICATION_FAULT);
if (t instanceof Fault) {
cxfExchange.getInMessage().put(FaultMode.class, FaultMode.CHECKED_APPLICATION_FAULT);
throw (Fault)t;
} else if (t != null) {
// This is not a CXF Fault. Build the CXF Fault manually.
Fault fault = new Fault(t);
if (fault.getMessage() == null) {
// The Fault has no Message. This is the case if it has
// no message, for example was a NullPointerException.
fault.setMessage(t.getClass().getSimpleName());
}
WebFault faultAnnotation = t.getClass().getAnnotation(WebFault.class);
Object faultInfo = null;
try {
Method method = t.getClass().getMethod("getFaultInfo");
faultInfo = method.invoke(t, new Object[0]);
} catch (Exception e) {
// do nothing here
}
if (faultAnnotation != null && faultInfo == null) {
// t has a JAX-WS WebFault annotation, which describes
// in detail the Web Service Fault that should be thrown. Add the
// detail.
Element detail = fault.getOrCreateDetail();
Element faultDetails = detail.getOwnerDocument()
.createElementNS(faultAnnotation.targetNamespace(), faultAnnotation.name());
detail.appendChild(faultDetails);
}
throw fault;
}
}
}