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.json.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: mLogger.debug(
29: /* (non-Javadoc)
30: * @i18n.test
31: * @org-mes="========== handleRequest(" + p[0] + ") "
32: */
33: org.openlaszlo.i18n.LaszloMessages.getMessage(
34: LZSOAPHandler.class.getName(), "051018-34",
35: new Object[] { context }));
36: displaySOAPMessage(context);
37: mLogger.debug("==========");
38:
39: return true;
40: }
41:
42: public boolean handleResponse(MessageContext context) {
43: mLogger.debug(
44: /* (non-Javadoc)
45: * @i18n.test
46: * @org-mes="========== handleResponse(" + p[0] + ") "
47: */
48: org.openlaszlo.i18n.LaszloMessages.getMessage(
49: LZSOAPHandler.class.getName(), "051018-50",
50: new Object[] { context }));
51: displaySOAPMessage(context);
52: mLogger.debug("==========");
53: return true;
54: }
55:
56: public void displaySOAPMessage(MessageContext context) {
57: try {
58: SOAPMessageContext soapContext = (SOAPMessageContext) context;
59:
60: SOAPMessage message = soapContext.getMessage();
61: SOAPPart sp = message.getSOAPPart();
62: SOAPEnvelope envelope = sp.getEnvelope();
63: SOAPBody body = envelope.getBody();
64: SOAPHeader header = envelope.getHeader();
65:
66: mLogger.debug(envelope.getClass().getName() + '@'
67: + Integer.toHexString(envelope.hashCode()));
68: mLogger.debug(envelope);
69:
70: } catch (Exception e) {
71: e.printStackTrace();
72: }
73: }
74: }
|