Logging XML request in Java-WS invoke method

SpartanMikeK

New Member
I'm using the Provider implementation of java-ws and wish to log the XML request prior to attempting to work with it, preferably using log4j. I've tried using \[code\]TransformerFactory\[/code\] and \[code\]stdout\[/code\] to log the incoming raw XML (below), which works, but when I do, the Source object can then no longer be used and generates NULL errors beyond the logging. I'm assuming this is because it's a stream object and can only be used once.\[code\]private void printSource(Source source) { try { System.out.println("==========RESPONSE============"); TransformerFactory factory = TransformerFactory.newInstance(); Transformer transformer = factory.newTransformer(); transformer.transform(source, new StreamResult(System.out)); System.out.println("\n=============================="); } catch(Exception e) { System.out.println(e.getMessage()); } }\[/code\]
 
Back
Top