At this point, there are really two options:

1) Initialize the interceptors/features yourself after creation.   You can get 
the "Client" object out of the proxy via the ClientProxy.getClient(proxy) call 
and either add the interceptors directly or call "new 
MyLoggingFeature().initialize(client)" or similar.

2) Use a @Features(…) annotation on the interface that points to your feature 
class.

Dan


On Apr 4, 2013, at 10:19 AM, "Pieper, Aaron" <[email protected]> wrote:

> We're using CXF 2.7.1. We have some code which contacts a web service
> using a proxy. The proxy is initialized like this:
> 
> 
> 
> W3CEndpointReferenceBuilder w3cerBuilder = new
> W3CEndpointReferenceBuilder();
> 
> w3cerBuilder.address(myAddress);
> 
> W3CEndpointReference w3ceReference = w3cerBuilder.build();
> 
> MessagingManager messagingManager =
> w3ceReference.getPort(MessagingManager.class, new AddressingFeature());
> 
> 
> 
> We want to add a LoggingFeature to this proxy, so that we can monitor
> the SOAP messages which get sent/received. Unfortunately, it looks like
> this feature list is initialized, and immediately consumed, during lines
> 407-410 in
> org.apache.cxf.jaxws.ServiceImpl.createPort(QName,EndpointReferenceType,
> Class<T>,WebServiceFeature...):
> 
> 
> 
> JaxWsProxyFactoryBean proxyFac = new JaxWsProxyFactoryBean();
> 
> JaxWsClientFactoryBean clientFac = (JaxWsClientFactoryBean)
> proxyFac.getClientFactoryBean();
> 
> JaxWsServiceFactoryBean serviceFactory = (JaxWsServiceFactoryBean)
> proxyFac.getServiceFactory();
> 
> proxyFac.initFeatures();
> 
> 
> 
> Our stack trace looks something like this:
> 
> 
> 
> W3CEndpointReference(EndpointReference).getPort(Class<T>,
> WebServiceFeature...) line: 158              
> 
> ProviderImpl(ProviderImpl).getPort(EndpointReference, Class<T>,
> WebServiceFeature...) line: 374        
> 
> ServiceImpl.getPort(EndpointReference, Class<T>, WebServiceFeature...)
> line: 711        
> 
> 
> 
> So, we call W3CEndpointReference.getPort(), which delegates to these
> other classes, and eventually to ServiceImpl.getPort(). Within
> ServiceImpl.getPort(), the JaxWsProxyFactoryBean is initialized, then
> the features are immediately initialized -- it doesn't look like we ever
> get an opportunity to specify our own feature list. Is this by design?
> Is there a better way for us to inject our LoggingFeature here? I think
> we can enable logging by manually adding our own logging interceptors,
> but it's a little clumsier that way.
> 

-- 
Daniel Kulp
[email protected] - http://dankulp.com/blog
Talend Community Coder - http://coders.talend.com

Reply via email to