2017-01-30 22 views
0

Я попытался войти сообщение от CxF перехватчик, который проходит AbstractSoapInterceptor и добавил, что перехватчик в цепиAbstractSoapInterceptor не работает с CXF: cxfEndpoint

Blueprint.xml

`<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>` 

перехватчик

`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");  
     } 
    }` 

Но контрольный поток не накануне n доходит до перехватчика и непосредственно переходит в контекст верблюда. что может быть причиной?

CXF объявление пространства имен

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

ответ

0

Пожалуйста, проверьте, какая версия сообщение wheteher это 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) { 

     }