werner 2005/06/05 12:00:36
Modified: wss4j/src/org/apache/ws/security/handler WSS4JHandler.java
Log:
Enable debug dynamically, insert/re-arrange some debug
statements to catch the problem of testcase failure. Seems
to be an Axis problem.
Revision Changes Path
1.7 +16 -8
ws-fx/wss4j/src/org/apache/ws/security/handler/WSS4JHandler.java
Index: WSS4JHandler.java
===================================================================
RCS file:
/home/cvs/ws-fx/wss4j/src/org/apache/ws/security/handler/WSS4JHandler.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -r1.6 -r1.7
--- WSS4JHandler.java 21 May 2005 19:41:01 -0000 1.6
+++ WSS4JHandler.java 5 Jun 2005 19:00:36 -0000 1.7
@@ -91,7 +91,7 @@
static Log log = LogFactory.getLog(WSS4JHandler.class.getName());
static final WSSecurityEngine secEngine = new WSSecurityEngine();
- private boolean doDebug = true;
+ private boolean doDebug = false;
private static Hashtable cryptos = new Hashtable(5);
private SOAPMessageContext msgContext = null;
@@ -160,6 +160,7 @@
* Switch for transfering control to doReceiver and doSender
*/
public boolean processMessage(MessageContext mc, boolean messageType) {
+ doDebug = log.isDebugEnabled();
String deployment = null;
if ((deployment = (String)
handlerInfo.getHandlerConfig().get(DEPLOYMENT)) == null) {
deployment = (String) msgContext.getProperty(DEPLOYMENT);
@@ -253,7 +254,8 @@
*/
Document doc = null;
SOAPMessage message = msgContext.getMessage();
-
+ Boolean propFormOptimization =
(Boolean)msgContext.getProperty("axis.form.optimization");
+ log.debug("Form optimzation: " + propFormOptimization);
/*
* If the message context property conatins a document then this is a
* chained handler.
@@ -267,6 +269,12 @@
throw new JAXRPCException("WSS4JHandler: cannot get SOAP
envlope from message" + e);
}
}
+ if (doDebug) {
+ log.debug("WSS4JHandler: orginal SOAP request: ");
+ log.debug(org.apache.axis.utils.XMLUtils
+ .PrettyDocumentToString(doc));
+ }
+
soapConstants =
WSSecurityUtil.getSOAPConstants(doc.getDocumentElement());
/*
@@ -372,12 +380,6 @@
ByteArrayOutputStream os = new ByteArrayOutputStream();
// documentToStream(doc, os);
XMLUtils.outputDOM(doc, os, true);
-
- try {
- sPart.setContent(new StreamSource(new
ByteArrayInputStream(os.toByteArray())));
- } catch (SOAPException se) {
- throw new JAXRPCException("Couldn't set content on SOAPPart"
+ se.getMessage());
- }
if (doDebug) {
String osStr = null;
try {
@@ -388,6 +390,12 @@
log.debug("Send request:");
log.debug(osStr);
}
+
+ try {
+ sPart.setContent(new StreamSource(new
ByteArrayInputStream(os.toByteArray())));
+ } catch (SOAPException se) {
+ throw new JAXRPCException("Couldn't set content on SOAPPart"
+ se.getMessage());
+ }
msgContext.setProperty(WSHandlerConstants.SND_SECURITY, null);
}
if (doDebug) {