1

I would like to enable dumping of HTTP headers in a JAX-WS RI client.

I do not want to dump the actual content, only the headers. Beware that under the hood JAX-WS RI uses HttpURLConnection so please don't reply with something related to Apache's HttpClient.

I need to enable it programmatically, not by way of a configuration file.

I'm aware of the answer on this question, but I'm really struggling to make that work with Java 7 so I'm wondering if I'm going about this the wrong way. In essence what I want to do is to be able to see the HTTP headers on the http traffic underlying JAX-WS and I don't really care how it is achieved as long as I can enable it programmatically.

Community
  • 1
  • 1
peterh
  • 18,404
  • 12
  • 87
  • 115
  • http://stackoverflow.com/questions/8065737/how-to-log-apache-cxf-soap-request-and-soap-response-using-log4j if you need just headers, you can write your own inceptor (it's simple) – MGorgon Dec 28 '13 at 20:26
  • @MGorgon. Wouldn't that be specific to Apache CXF?. As the question states I'm using JAX-WS RI, aka Metro. – peterh Dec 28 '13 at 22:32

1 Answers1

0

This section of JAX-WS guide about using handlers to access HTTP headers might help.

  • Thank you for that. The method in the link is part of JAX-WS itself. I don't think it will work if you get a JAX-WS exception. What I'm looking for has to be 'below' the JAX-WS layer otherwise you cannot be certain it will actually be triggered. Just to give you an example: A typical web service workflow also includes the client fetching the WSDL from the server which is not a SOAP request (yet part of what JAX-WS does) and the method in the link will certainly not work in that case. – peterh Dec 29 '13 at 19:43