【发布时间】:2013-05-07 17:59:48
【问题描述】:
我编写了一个自定义 CXF 拦截器来将所有 SOAP 请求和响应记录到数据库中,它似乎可以很好地处理正面测试用例和服务器错误。
但是当 SOAP 错误发生时,它只是忽略了我的拦截器并且没有记录任何内容。
自定义 CXF 拦截器。
public class DbLogOutInterceptor extends AbstractSoapInterceptor {
public void handleMessage(SoapMessage message) {
logger.info("Handling outbound request");
String transaction = MDC.get(mdcKey);
logger.info("OutBound Transaction ID : {} ", transaction);
//code to log the SOAP message in database
.......
}
}
我没有看到此方法的日志语句,而是看到了
11:56:34,102 INFO [Soap12FaultOutInterceptor] class org.apache.cxf.binding.soap.interceptor.Soap12FaultOutInterceptor$Soap12FaultOutInterceptor Internalapplication/soap+xml
11:56:34,103 INFO [EligibilityInfo] Outbound Message
---------------------------
ID: 2
Response-Code: 500
Encoding: UTF-8
Content-Type: application/soap+xml
Headers: {}
Payload :
为了在我的自定义拦截器中捕获 SOAP 错误错误,我必须做些什么。
【问题讨论】:
-
您能告诉我您是如何使用 CXF 的吗,即您是使用 Spring 和 CXF 还是仅仅将其用作 JAX-WS 提供程序?
-
带有弹簧的CXF和拦截器使用CXF总线注册
标签: java soap cxf interceptor soapfault