我遇到了和你一样的问题:message.getContent(xxx.class) 返回 null。我不知道为什么,稍后我会检查这种行为。
因此,我改为使用这样的拦截器(我检索 MessageContentsList):
public class ApiSoapActionInInterceptorService extends AbstractPhaseInterceptor<Message> {
public ApiSoapActionInInterceptorService(){
super(Phase.PRE_INVOKE);
}
@Override
public void handleMessage(Message message) throws Fault {
MessageContentsList inObjects = MessageContentsList.getContentsList(message);
if (inObjects != null && !inObjects.isEmpty()){
for (Iterator<Object> it = inObjects.iterator(); it.hasNext() ;){
Object ob = it.next();
if (ob instanceof InputMessageType){
//TODO
}
}
} else {
//TODO
}
}
}