当前位置: 首页>>代码示例>>Java>>正文


Java Fault.getMessage方法代码示例

本文整理汇总了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);
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:8,代码来源:WeatherSoapFaultHelper.java

示例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);	        
    }
}
 
开发者ID:jonashackt,项目名称:tutorial-soap-spring-boot-cxf,代码行数:15,代码来源:CustomSoapFaultInterceptor.java

示例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();
}
 
开发者ID:kantega,项目名称:respiro,代码行数:13,代码来源:LogCorrelationInterceptor.java

示例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;
        }

    }
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:45,代码来源:CxfConsumer.java


注:本文中的org.apache.cxf.interceptor.Fault.getMessage方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。