You are viewing a plain text version of this content. The canonical link for it is here.
Posted to java-dev@axis.apache.org by pr...@apache.org on 2006/09/23 15:28:43 UTC

svn commit: r449233 - /webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java

Author: pradine
Date: Sat Sep 23 06:28:43 2006
New Revision: 449233

URL: http://svn.apache.org/viewvc?view=rev&rev=449233
Log:
Ensure that the correct WS-Addressing namespace is used when when fault response messages are generated.

Modified:
    webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java

Modified: webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java
URL: http://svn.apache.org/viewvc/webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java?view=diff&rev=449233&r1=449232&r2=449233
==============================================================================
--- webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java (original)
+++ webservices/axis2/trunk/java/modules/addressing/src/org/apache/axis2/handlers/addressing/AddressingOutHandler.java Sat Sep 23 06:28:43 2006
@@ -35,7 +35,6 @@
 import org.apache.axis2.client.Options;
 import org.apache.axis2.context.MessageContext;
 import org.apache.axis2.context.ServiceContext;
-import org.apache.axis2.wsdl.WSDLConstants;
 
 import javax.xml.namespace.QName;
 import java.util.Iterator;
@@ -44,54 +43,22 @@
 public class AddressingOutHandler extends AddressingHandler {
 
     public void invoke(MessageContext msgContext) throws AxisFault {
-
-        SOAPFactory factory = (SOAPFactory)msgContext.getEnvelope().getOMFactory();
-        
-        OMNamespace addressingNamespaceObject;
-        String namespace = addressingNamespace;
-
         // it should be able to disable addressing by some one.
         Object property = msgContext.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
-        if (property == null && msgContext.getOperationContext() != null) {
-            // check in the IN message context, if available
-            MessageContext inMsgCtxt = msgContext.getOperationContext().getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-            if (inMsgCtxt != null) {
-                property = inMsgCtxt.getProperty(DISABLE_ADDRESSING_FOR_OUT_MESSAGES);
-            }
-        }
         if (property != null && JavaUtils.isTrueExplicitly(property)) {
             log.debug("Addressing is disabled .....");
             return;
         }
 
-
         Object addressingVersionFromCurrentMsgCtxt = msgContext.getProperty(WS_ADDRESSING_VERSION);
-        if (addressingVersionFromCurrentMsgCtxt != null) {
-            // since we support only two addressing versions I can avoid multiple  ifs here.
-            // see that if message context property holds something other than Final.WSA_NAMESPACE
-            // we always defaults to Submission.WSA_NAMESPACE. Hope this is fine.
-            namespace = Final.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)
-                    ? Final.WSA_NAMESPACE : Submission.WSA_NAMESPACE;
-        } else if (msgContext.getOperationContext() != null)
-        { // check for a IN message context, else default to WSA Final
-            MessageContext inMessageContext = msgContext.getOperationContext()
-                    .getMessageContext(WSDLConstants.MESSAGE_LABEL_IN_VALUE);
-            if (inMessageContext != null) {
-                namespace =
-                        (String) inMessageContext.getProperty(
-                                WS_ADDRESSING_VERSION);
-            }
-        }
-
-        if (namespace == null || "".equals(namespace)) {
-            namespace = Final.WSA_NAMESPACE;
-        }
-        addressingNamespaceObject = factory.createOMNamespace(
-                namespace, WSA_DEFAULT_PREFIX);
+        String namespace = Submission.WSA_NAMESPACE.equals(addressingVersionFromCurrentMsgCtxt)
+                    ? Submission.WSA_NAMESPACE : Final.WSA_NAMESPACE;
+        
+        SOAPFactory factory = (SOAPFactory) msgContext.getEnvelope().getOMFactory();
+        OMNamespace addressingNamespaceObject = factory.createOMNamespace(namespace, WSA_DEFAULT_PREFIX);
         String anonymousURI = namespace.equals(Final.WSA_NAMESPACE) ? Final.WSA_ANONYMOUS_URL : Submission.WSA_ANONYMOUS_URL;
         String relationshipType = namespace.equals(Final.WSA_NAMESPACE) ? Final.WSA_DEFAULT_RELATIONSHIP_TYPE : Submission.WSA_RELATES_TO_RELATIONSHIP_TYPE_DEFAULT_VALUE;
 
-
         Options messageContextOptions = msgContext.getOptions();
         SOAPEnvelope envelope = msgContext.getEnvelope();
         SOAPHeader soapHeader = envelope.getHeader();
@@ -143,9 +110,6 @@
 
         // process fault headers, if present
         processFaultsInfoIfPresent(envelope, msgContext, addressingNamespaceObject, replaceHeaders);
-
-        // We are done, cleanup the references
-        addressingNamespaceObject = null;
     }
 
     private void processWSAAction(Options messageContextOptions, SOAPEnvelope envelope,



---------------------------------------------------------------------
To unsubscribe, e-mail: axis-cvs-unsubscribe@ws.apache.org
For additional commands, e-mail: axis-cvs-help@ws.apache.org