I created an implementation of LoggingHandler
that implements SOAPHandler<SOAPMessageContext>
It should log whenever handleMessage
triggers (and it is never called in my case)
MyService service = new MyService();
MyServicePort port = service.getPortType();
now I try this:
BindingProvider bindingProvider = (BindingProvider)port;
bindingProvider.getBinding().getHandlerChain().add(new LoggingHandler());
I do not see any request / response xml though.
Can you suggest any solution? Maybe there's another way to see output and request XML?
If anyone is wondering the 'why' of @EugeneP excellent answer.
In the Interface javax.xml.ws.Binding, there is the following comment.
So the getHandlerChain() method returns a copy of the List not the list itself. So you have to use setHandlerChain to update the actual List.
you can add a logger in you log4j.xml file :
It starts working if you use this method:
So, first initialize this list with
then add your element to the list and after all