axis-java-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From d...@apache.org
Subject svn commit: r398304 - in /webservices/axis2/trunk/java/modules: addressing/src/org/apache/axis2/handlers/addressing/ core/src/org/apache/axis2/context/ core/src/org/apache/axis2/engine/
Date Sun, 30 Apr 2006 10:13:04 GMT
Author: dims
Date: Sun Apr 30 03:12:59 2006
New Revision: 398304

URL: http://svn.apache.org/viewcvs?rev=398304&view=rev
Log:
try not to create the whole om tree looking for the soap:Header

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
    webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java?rev=398304&r1=398303&r2=398304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
(original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingInHandler.java
Sun Apr 30 03:12:59 2006
@@ -45,13 +45,16 @@
 
     public void invoke(MessageContext msgContext) throws AxisFault {
         String namespace = addressingNamespace;
-        SOAPHeader header = msgContext.getEnvelope().getHeader();
 
         // if there is some one who has already found addressing, do not do anything here.
         if (msgContext.getProperty(WS_ADDRESSING_VERSION) != null) {
             return;
         }
 
+        SOAPHeader header = null;
+        if(msgContext.isHeaderPresent()) {
+            header = msgContext.getEnvelope().getHeader();
+        }
         // if there are not headers put a flag to disable addressing temporary
         if (header == null) {
             msgContext.setProperty(Constants.Configuration.DISABLE_ADDRESSING_FOR_OUT_MESSAGES,
Boolean.TRUE);

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java?rev=398304&r1=398303&r2=398304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/context/MessageContext.java
Sun Apr 30 03:12:59 2006
@@ -19,6 +19,9 @@
 import org.apache.axiom.soap.SOAP11Constants;
 import org.apache.axiom.soap.SOAP12Constants;
 import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPConstants;
+import org.apache.axiom.om.OMNode;
+import org.apache.axiom.om.OMElement;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.addressing.EndpointReference;
 import org.apache.axis2.addressing.RelatesTo;
@@ -937,5 +940,24 @@
             }
         }
         return false;
+    }
+
+    /**
+     * Gets the first child of the envelope, check if it is a soap:Body, which means there
is no header.
+     * We do this basically to make sure we don't parse and build the om tree of the whole
envelope
+     * looking for the soap header. If this method returns true, there still is no guarantee
that there is
+     * a soap:Header present, use getHeader() and also check for null on getHeader() to be
absolutely sure.
+     * 
+     * @return boolean
+     */
+    public boolean isHeaderPresent() {
+        OMNode node = getEnvelope().getFirstOMChild();
+        if(node instanceof OMElement){
+            OMElement firstChild = (OMElement) node;
+            if(firstChild.getQName().getLocalPart().equals(SOAPConstants.BODY_LOCAL_NAME))
{
+                return false;
+            }
+        }
+        return true;
     }
 }

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java?rev=398304&r1=398303&r2=398304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/AxisEngine.java
Sun Apr 30 03:12:59 2006
@@ -65,6 +65,9 @@
     }
 
     private void checkMustUnderstand(MessageContext msgContext) throws AxisFault {
+        if(!msgContext.isHeaderPresent()) {
+            return;
+        }
         SOAPEnvelope se = msgContext.getEnvelope();
         if (se.getHeader() == null) {
             return;

Modified: webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java
URL: http://svn.apache.org/viewcvs/webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java?rev=398304&r1=398303&r2=398304&view=diff
==============================================================================
--- webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java
(original)
+++ webservices/axis2/trunk/java/modules/core/src/org/apache/axis2/engine/InstanceDispatcher.java
Sun Apr 30 03:12:59 2006
@@ -18,7 +18,9 @@
 package org.apache.axis2.engine;
 
 import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMNode;
 import org.apache.axiom.soap.SOAPHeader;
+import org.apache.axiom.soap.SOAPConstants;
 import org.apache.axis2.AxisFault;
 import org.apache.axis2.Constants;
 import org.apache.axis2.context.MessageContext;
@@ -144,6 +146,9 @@
     }
 
     private void extractServiceGroupContextId(MessageContext msgContext) throws AxisFault
{
+        if(!msgContext.isHeaderPresent()) {
+            return;
+        }
         SOAPHeader soapHeader = msgContext.getEnvelope().getHeader();
         if (soapHeader != null) {
             OMElement serviceGroupId = soapHeader.getFirstChildWithName(new QName(Constants.AXIS2_NAMESPACE_URI,
@@ -153,14 +158,11 @@
                 ServiceGroupContext serviceGroupContext = msgContext.getConfigurationContext().
                         getServiceGroupContext(groupId, msgContext);
                 if (serviceGroupContext == null) {
-//                handleNoServiceGroupContextIDCase(msgContext);
                     throw new AxisFault(Messages.getMessage(
                             "invalidservicegrouoid", groupId));
                 }
                 msgContext.setServiceGroupContextId(serviceGroupId.getText());
             }
         }
-
     }
-
 }



Mime
View raw message