I am using jax-ws (cxf 2.4.3) dispatch client to invoke a webservice. Since
the wsdl specifies some policies, my call fails with the error
"javax.xml.ws.soap.SOAPFaultException: None of the policy alternatives can
be satisfied".

After researching the forums, it seems I need to add an interceptor to
handle this situation. Now all the sample code that I have seen to do this
is like:
...
Client client = ClientProxy.getClient(servicePort);
...

My code using the dispatch client is like:

Service svc = Service.create(wsdlurl, serviceNs);
dispatch = svc.createDispatch(portName, SOAPMessage.class,
Service.Mode.MESSAGE);
Binding binding = dispatch.getBinding();
List<Handler> handlerChain = binding.getHandlerChain();
handlerChain.add(new SOAPLoggingHandler(logger));
binding.setHandlerChain(handlerChain);

I dont know how to get a Client object from the dispatch api so that I can
set interceptors like:
cxfClient.getInInterceptors().add(...);

I found this link in this forum which suggests it should be very easy:
http://cxf.547215.n5.nabble.com/adding-features-and-or-interceptors-to-a-dynamic-jax-ws-dispatcher-client-td3200104.html
But after observing the interfaces for these classes and a few others, I am
unable to figure it out. Pls help.




--
View this message in context: 
http://cxf.547215.n5.nabble.com/adding-interceptors-to-a-dynamic-jax-ws-dispatcher-client-tp5723001.html
Sent from the cxf-user mailing list archive at Nabble.com.

Reply via email to