2017-01-30 14 views
0

を私はAbstractSoapInterceptorを拡張CXFインターセプタからのメッセージを記録しようとし AbstractSoapInterceptorは、CXFで動作していない。cxfEndpoint

`<cxf:cxfEndpoint id="reportEndpoint" address="/report/" 
     serviceClass="com.shajeer.integration.helloworld.incident.IncidentService"> 
     <cxf:inInterceptors> 
      <bean id="inInterceptor" 
      class="com.shajeer.integration.helloworld.logging.LoggingInSetupInterceptor" /> 
     </cxf:inInterceptors> 
    </cxf:cxfEndpoint>` 

Blueprint.xml

にインターセプタをそのインターセプターを追加しました

`import org.apache.cxf.binding.soap.SoapMessage; 
    import org.apache.cxf.binding.soap.interceptor.AbstractSoapInterceptor; 
    import org.apache.cxf.interceptor.Fault; 
    import org.apache.cxf.phase.Phase; 
    import org.slf4j.Logger; 
    import org.slf4j.LoggerFactory; 
    public class LoggingInSetupInterceptor extends AbstractSoapInterceptor{ 
    private static final Logger LOGGER = LoggerFactory.getLogger(LoggingInSetupInterceptor.class); 
     public LoggingInSetupInterceptor() { 
      super(Phase.PRE_INVOKE); 
     } 
     @Override 
     public void handleMessage(SoapMessage soapMessage) throws Fault { 
      System.out.println("In LoggingInSetupInterceptor :: LoggingInSetupInterceptor"); 
      LOGGER.info("In LoggingInSetupInterceptor :: LoggingInSetupInterceptor");  
     } 
    }` 

しかし、制御フローは前夜インターセプタに到達し、ラクダの文脈に直接入ります。理由は何でしょうか?

`xmlns:cxf="http://camel.apache.org/schema/blueprint/cxf"` 

答えて

0

はそれがSOAP11またはSOAP12以下のスニペットとデバッグ

public void handleMessage(SoapMessage message) throws Fault { 
     if (message.getVersion() instanceof Soap11) { 
      Map<String, List<String>> headers = CastUtils.cast((Map)message.get(Message.PROTOCOL_HEADERS)); 
      if (headers != null) { 
       List<String> sa = headers.get("SOAPAction"); 
       if (sa != null && sa.size() > 0) { 
        String action = sa.get(0); 
        if (action.startsWith("\"")) { 
         action = action.substring(1, action.length() - 1); 
        } 
        getAndSetOperation(message, action); 
       } 
      } 
     } else if (message.getVersion() instanceof Soap12) { 

     } 
を追加でwheteherメッセージバージョンであるかどうか確認してくださいCXF名前空間宣言
関連する問題