6 September 2018

RD EE6 Web Services module 12 alternate lab: Logging Handler

 Make a copy of the project you made in module08 and work in that copy.
 Add a SOAPHandler that logs every message to System.out for the BookWS webservice.

  1. Write a class handler.LoggingHandler that implements SOAPHandler. For each message
    • Log if it is a REQUEST or a RESPONSE
    • Log the SOAP message using
       context.getMessage().writeTo(System.out);
    • catch any Exceptions and return true
  2. Annotate the BookService with @HandlerChain, and refer to the "../../handlers.xml" file
  3. Write the handlers.xml file and put it in the WEB-INF directory
  4. Test and correct until it works
Note: you can achieve a similar result by passing this property to your server
-Dcom.sun.xml.ws.transport.http.HttpAdapter.dump=true

No comments:

Post a Comment