请教使用WebService CXF如何用自定义拦截器获取报文 现在拦截器已经配置好了,客户端调用服务端接口的时候也能进入到拦截器,请问在自己定义的拦截器里怎样获取报文信息?信息~ 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 package com.gosophia.metadataEngine.webservice.interceptor; import javax.xml.ws.WebServiceException; import org.apache.cxf.interceptor.Fault; import org.apache.cxf.message.Message; import org.apache.cxf.phase.AbstractPhaseInterceptor; import org.apache.cxf.phase.Phase; import org.slf4j.Logger; import org.slf4j.LoggerFactory; /** *继承一个拦截器类 */ public class ErrorInterceptor extends AbstractPhaseInterceptor<Message>{ public ErrorInterceptor(String phase) { super(phase); } public ErrorInterceptor(){ super(Phase.RECEIVE); } public void handleMessage(Message arg0) throws Fault { } //出现错误输出错误信息和栈信息 public void handleFault(Message message) { Logger logger = LoggerFactory.getLogger(getClass()); Exception exeption=message.getContent(Exception.class); logger.error(exeption.getMessage(),exeption); } } 配置拦截器 <jaxws:endpoint id="dataViewWebServiceEP" address="/DataViewWebService"> <jaxws:implementor ref="dataViewWebService" /> <jaxws:inInterceptors> <bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean> <bean class="com.gosophia.metadataEngine.webservice.interceptor.ErrorInterceptor"></bean> </jaxws:inInterceptors> <jaxws:outInterceptors> <!-- 输出日志 --> <bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean> </jaxws:outInterceptors> </jaxws:endpoint> 你们为什么不百度呢 一大把 http://cxf.apache.org/docs/interceptors.html public void handleMessage(Message arg0) throws Fault { //获取webservice的入参 List<Object> result = MessageContentsList.getContentsList(message); } 高手帮忙,javamail收附件问题? 100分 求 J2EE的医疗门诊查询系统 J2EE与oracle联系 javamail中怎样中断正在发送的邮件? 关于tiles的问题,我就剩10分了,拜托了 BeanPostProcessor 问题 spring依赖的第三方类库 有用过JMSN做MSN机器人开发的高手吗? Torque来操作Linux中的DB2的时候不能插入数据,谢谢高手解答,接高分!!!!!!! tomcat应如何存储JAVABEAN?盼回答!! json转日期出错 急求:lucene问题
import javax.xml.ws.WebServiceException;
import org.apache.cxf.interceptor.Fault;
import org.apache.cxf.message.Message;
import org.apache.cxf.phase.AbstractPhaseInterceptor;
import org.apache.cxf.phase.Phase;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
*继承一个拦截器类
*/
public class ErrorInterceptor extends AbstractPhaseInterceptor<Message>{
public ErrorInterceptor(String phase) {
super(phase);
}
public ErrorInterceptor(){
super(Phase.RECEIVE);
}
public void handleMessage(Message arg0) throws Fault {
}
//出现错误输出错误信息和栈信息
public void handleFault(Message message) {
Logger logger = LoggerFactory.getLogger(getClass());
Exception exeption=message.getContent(Exception.class);
logger.error(exeption.getMessage(),exeption);
}
}
配置拦截器
<jaxws:endpoint id="dataViewWebServiceEP" address="/DataViewWebService">
<jaxws:implementor ref="dataViewWebService" />
<jaxws:inInterceptors>
<bean class="org.apache.cxf.interceptor.LoggingInInterceptor"></bean>
<bean class="com.gosophia.metadataEngine.webservice.interceptor.ErrorInterceptor"></bean>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<!-- 输出日志 -->
<bean class="org.apache.cxf.interceptor.LoggingOutInterceptor"></bean>
</jaxws:outInterceptors>
</jaxws:endpoint> 你们为什么不百度呢 一大把
//获取webservice的入参
List<Object> result = MessageContentsList.getContentsList(message); }