I'm using JAX-WS reference implementation (2.1.7) and I want to trace SOAP request/responses on the client side. Actually, what I need is to examine some Http headers when I receive the response.

Following these previous questions ( Tracing XML request/responses with JAX-WS and Java JAX-WS web-service client: how log request & response xml? ), I've created my own handler to log when I send a request and receive a response:

public class SHandler implements SOAPHandler<SOAPMessageContext>
{

  private static final Logger log = Logger.getLogger(SHandler.class);

  @Nullable
  @Override
  public Set<QName> getHeaders()
  {    
    log.debug(">>>>>>>>>>> GetHeaders");
    return null;    
  }

  @Override
  public boolean handleMessage(SOAPMessageContext soapMessageContext)
  {
    log.debug(">>>>>>>>>>> HandleMessage");
    return true;
  }

  @Override
  public boolean handleFault(SOAPMessageContext soapMessageContext)
  {
    log.debug(">>>>>>>>>>> HandleFault");
    return true;
  }

  @Override
  public void close(MessageContext messageContext)
  {
    log.debug(">>>>>>>>>>> Close");    
  }
}

and I add the handler to the handler chain during the service initialisation:

@WebServiceClient(name = "MyService", targetNamespace = "http://www.whatever.com/", wsdlLocation = "file:/path/to/wsdl")
public class MyService extends Service
{

    public MyService(URL wsdlLocation) {
        super(...);
        initializeBinding();
    }

    @WebEndpoint(name = "MyOperation")
    public MyPort getMyPort() {
        return super
Edit
Report