01: /* *****************************************************************************
02: * LZSOAPHandler.java
03: * ****************************************************************************/
04:
05: /* J_LZ_COPYRIGHT_BEGIN *******************************************************
06: * Copyright 2001-2007 Laszlo Systems, Inc. All Rights Reserved. *
07: * Use is subject to license terms. *
08: * J_LZ_COPYRIGHT_END *********************************************************/
09:
10: package org.openlaszlo.remote.swf.soap;
11:
12: import java.util.*;
13: import javax.xml.namespace.QName;
14: import javax.xml.rpc.handler.*;
15: import javax.xml.rpc.handler.soap.*;
16: import javax.xml.soap.*;
17: import org.apache.log4j.*;
18:
19: public class LZSOAPHandler extends GenericHandler {
20: private static Logger mLogger = Logger
21: .getLogger(LZSOAPHandler.class);
22:
23: public QName[] getHeaders() {
24: return null;
25: }
26:
27: public boolean handleRequest(MessageContext context) {
28: if (mLogger.isDebugEnabled()) {
29: mLogger.debug(
30: /* (non-Javadoc)
31: * @i18n.test
32: * @org-mes="========== handleRequest(" + p[0] + ") "
33: */
34: org.openlaszlo.i18n.LaszloMessages.getMessage(
35: LZSOAPHandler.class.getName(), "051018-34",
36: new Object[] { context }));
37: displaySOAPMessage(context);
38: mLogger.debug("==========");
39: }
40: return true;
41: }
42:
43: public boolean handleResponse(MessageContext context) {
44: if (mLogger.isDebugEnabled()) {
45: mLogger.debug(
46: /* (non-Javadoc)
47: * @i18n.test
48: * @org-mes="========== handleResponse(" + p[0] + ") "
49: */
50: org.openlaszlo.i18n.LaszloMessages.getMessage(
51: LZSOAPHandler.class.getName(), "051018-50",
52: new Object[] { context }));
53: // displaySOAPMessage(context);
54: mLogger.debug("==========");
55: }
56: return true;
57: }
58:
59: public void displaySOAPMessage(MessageContext context) {
60: try {
61: SOAPMessageContext soapContext = (SOAPMessageContext) context;
62:
63: SOAPMessage message = soapContext.getMessage();
64: SOAPPart sp = message.getSOAPPart();
65: SOAPEnvelope envelope = sp.getEnvelope();
66: SOAPBody body = envelope.getBody();
67: SOAPHeader header = envelope.getHeader();
68:
69: mLogger.debug(envelope.getClass().getName() + '@'
70: + Integer.toHexString(envelope.hashCode()));
71: mLogger.debug(envelope);
72:
73: } catch (Exception e) {
74: e.printStackTrace();
75: }
76: }
77: }
|