Florian Rosenberg wrote:
[...]
public static void main(String[] args) {
ClientProxyFactoryBean factory = new JaxWsProxyFactoryBean();
factory.setAddress("http://localhost:10000/ErrorService");
factory.setServiceClass(ErrorService.class);
ErrorService ess = (ErrorService)factory.create();
Client c = ClientProxy.getClient(ess);
List<Interceptor> infault = c.getInFaultInterceptors();
infault.add(new SimpleInterceptor(Phase.RECEIVE));
infault.add(new SimpleInterceptor(Phase.PRE_STREAM));
infault.add(new SimpleInterceptor(Phase.PRE_PROTOCOL));
infault.add(new SimpleInterceptor(Phase.UNMARSHAL));
infault.add(new SimpleInterceptor(Phase.PRE_LOGICAL));
infault.add(new SimpleInterceptor(Phase.PRE_INVOKE));
List<Interceptor> in = c.getInInterceptors();
in.add(new SimpleInterceptor(Phase.RECEIVE));
in.add(new SimpleInterceptor(Phase.PRE_STREAM));
in.add(new SimpleInterceptor(Phase.PRE_PROTOCOL));
in.add(new SimpleInterceptor(Phase.UNMARSHAL));
in.add(new SimpleInterceptor(Phase.PRE_LOGICAL));
in.add(new SimpleInterceptor(Phase.PRE_INVOKE));
try {
ess.buggyOperation("something wrong");
} catch (DummyException_Exception e) {
e.printStackTrace();
}
}
found the problem, very subtile: you need to invoke
factory.getClientFactoryBean().get[In|Out|InFault|OutFault]Interceptors();
on the client factory bean not directly on the factory, then it works.
Is this desired behavior? Besides that, I still do not really unterstand
when handleFault() is called in an interceptor and what are the
consequences....
Thanks,
-Florian