01: /*
02: * Copyright (c) 2005 Sun Microsystems, Inc.
03: * All rights reserved.
04: */
05: package demo.handlers.common;
06:
07: import java.io.FileOutputStream;
08: import java.io.IOException;
09: import java.io.PrintStream;
10:
11: import java.util.Map;
12: import java.util.Set;
13:
14: import javax.xml.namespace.QName;
15: import javax.xml.ws.handler.soap.SOAPMessageContext;
16:
17: /*
18: * This simple SOAPHandler will output the contents of incoming
19: * and outgoing messages into a file.
20: */
21: public class FileLoggingHandler extends LoggingHandler {
22:
23: public FileLoggingHandler() {
24: try {
25: setLogStream(new PrintStream(new FileOutputStream(
26: "demo.log")));
27: } catch (IOException ex) {
28: System.err.println("Could not open log file demo.log");
29: }
30: }
31:
32: public void init(Map c) {
33: System.out.println("FileLoggingHandler : init() Called....");
34: }
35:
36: public Set<QName> getHeaders() {
37: return null;
38: }
39:
40: public boolean handleMessage(SOAPMessageContext smc) {
41: System.out
42: .println("FileLoggingHandler : handleMessage Called....");
43: logToSystemOut(smc);
44: return true;
45: }
46:
47: public boolean handleFault(SOAPMessageContext smc) {
48: System.out
49: .println("FileLoggingHandler : handleFault Called....");
50: logToSystemOut(smc);
51: return true;
52: }
53: }
|