當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。